diff --git a/.agents/rules/pr.md b/.agents/rules/pr.md index a1332ac6b7..49495e7498 100644 --- a/.agents/rules/pr.md +++ b/.agents/rules/pr.md @@ -66,9 +66,14 @@ Before drafting any pull request description, strictly adhere to the rules in `"do not merge"` label is applied if open questions remain. ## PR Review Comments & Thread Resolution -* End every posted PR comment or review reply with an italicized disclosure line - identifying it as an agent-generated response and indicating whether it was - automatically generated or user-reviewed/approved. +* End every posted PR comment or review reply with an italicized disclosure + line: + * If the exact comment text was not shown to and approved by the user before + posting (including automatic PR AI disclosure comments): + `*This is an automatically generated agent comment.*` + * Only if the user was shown the exact comment text and explicitly approved + posting it: + `*This is an agent-generated comment reviewed and approved by the user.*` * After fixing an inline PR review thread, reply with the commit hash and explanation (`addPullRequestReviewThreadReply`) and resolve the thread (`resolveReviewThread`) via `gh api graphql`, batching at most 3-4 threads per diff --git a/.agents/skills/create-pr/SKILL.md b/.agents/skills/create-pr/SKILL.md index 908511889c..25c15aed00 100644 --- a/.agents/skills/create-pr/SKILL.md +++ b/.agents/skills/create-pr/SKILL.md @@ -20,29 +20,43 @@ to a subagent. NEVER create or draft PRs directly in the main conversation. rules/skills). - **PR Body**: Explain *why* and conceptual *how*. Wrap strictly at 72 columns max. Use concise, active phrasing (Strunk & White). + - **AI Disclosure Comment**: Draft (and post via `gh pr comment` if creating + the PR) the AI disclosure comment stating the level of human oversight and + how PR comments will be handled. When posted automatically during `create + pr` without prior user review of the comment text, end it with: + `*This is an automatically generated agent comment.*` + Only use `*This is an agent-generated comment reviewed and approved by the + user.*` if the user previously reviewed `pr_info.md` and approved the + draft text. - **Artifact Requirements**: Create `pr_info.md` in the subagent's own artifact directory (do not attempt to write to the parent's artifact directory) with: - - PR title, 72-column wrapped body, and PR number/URL (if created). - - **User decision choices**: + - PR title, 72-column wrapped body, AI disclosure comment text (and + comment URL if posted), and PR number/URL (if created). + - **User decision choices** (include only when proposing/drafting before + PR creation): 1. Create a regular PR 2. Create a draft PR 3. Provide feedback on the draft text 4. Discard the draft text - **Propose vs. Create**: If proposing or drafting a PR, do NOT run - `gh pr create`—only create the `pr_info.md` artifact. Only execute - `gh pr create` when explicitly requested to create the PR. + `gh pr create` or `gh pr comment`—only create the `pr_info.md` artifact. + Execute `gh pr create` and `gh pr comment` immediately when explicitly + requested to create the PR (e.g., `create pr`). - **Targeting Upstream Repo**: When creating, target upstream using `--repo bazel-contrib/rules_python` and `--head :`. - **Open Questions Label**: If the PR description contains open questions, apply the `"do not merge"` label (`--label "do not merge"`). -4. **Return Status**: Direct subagent to report the PR number/draft status and - the absolute file path to its `pr_info.md` artifact back to the caller. +4. **Return Status**: Direct subagent to report the PR number/draft status, AI + disclosure comment URL (if posted), and the absolute file path to its + `pr_info.md` artifact back to the caller. 5. **Publish and Link Artifact in Main Agent**: Upon subagent completion, read the subagent's `pr_info.md` via `view_file`, publish it to the main agent's - own artifact directory via `write_to_file` (`UserFacing: true`, - `RequestFeedback: true`), and output a clickable markdown link to the main - agent's `pr_info.md` before prompting for confirmation. + own artifact directory via `write_to_file` (`UserFacing: true`, and + `RequestFeedback: true` when proposing), and output a clickable markdown + link to the main agent's `pr_info.md`. When the PR was created immediately, + summarize the created PR and posted AI disclosure comment in chat; when + proposing, prompt for confirmation. 6. **Interactive Actions**: When presenting choices via `ask_question`, always include the clickable markdown link to `pr_info.md` in the `question` prompt. diff --git a/.agents/skills/review-code/SKILL.md b/.agents/skills/review-code/SKILL.md index 1847d52816..9a35b66904 100644 --- a/.agents/skills/review-code/SKILL.md +++ b/.agents/skills/review-code/SKILL.md @@ -188,8 +188,11 @@ file from `.agents/skills/review-code/`: any issues addressed in the interim to `## Resolved Issues` in `code-review-results.md`, and drop their candidate comments. - When posting comments or replies to a PR, append an italicized disclosure line - at the end of each comment identifying it as an agent-generated response and - stating whether it was automatically generated or user-reviewed/approved. + at the end of each comment: + `*This is an agent-generated comment reviewed and approved by the user.*` if + the user reviewed and approved posting the comment, or + `*This is an automatically generated agent comment.*` if posted without user + review. ### Synthesis & Anti-Noise Gate (Guardrails)