agents(review-code): drop report draft comments and cap fix prose (#4555) Storing verbatim `Draft Comment` blocks alongside `Problem` and `Proposed Fix` duplicated every finding and bloated `code-review-results.md`. Omit `Draft Comment` from `/review-code` reports while preserving the mechanical comment structure (`Suggested fix:` under 10 lines / 50 words, plus optional `Where:`) when posting comments to GitHub, and align `.agents/rules/pr.md` disclosure rules accordingly. Require `Proposed Fix` to lead with a direct sentence under 20 words plus up to 50 additional words of fix detail, with `Where` separated from that limit.
diff --git a/.agents/rules/pr.md b/.agents/rules/pr.md index 30fbf04..4cfa603 100644 --- a/.agents/rules/pr.md +++ b/.agents/rules/pr.md
@@ -91,11 +91,12 @@ ## PR Review Comments & Thread Resolution * 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 disclosures and direct review replies): + * When posted without prior user review and approval of the comment text or + underlying `code-review-results.md` finding (including automatic PR + disclosures and direct review replies): `*This is an agent-generated comment unreviewed by the user.*` - * Only if the user was shown the exact comment text and explicitly approved - posting it: + * Only when the user reviewed and explicitly approved posting the comment + text or underlying `code-review-results.md` finding: `*This is an agent-generated comment reviewed and approved by the user.*` * **Reply Style (`arXiv:2610.29162v1`)**: Keep review replies to 1-3 short sentences (~15-60 words) leading with the commit hash or direct answer. Pair
diff --git a/.agents/skills/review-code/SKILL.md b/.agents/skills/review-code/SKILL.md index 72942fd..22024e9 100644 --- a/.agents/skills/review-code/SKILL.md +++ b/.agents/skills/review-code/SKILL.md
@@ -126,16 +126,15 @@ 14. Comment Readability Sub-Agent (`Role: "Comment Readability Editor"`): - Prompt file: `.agents/skills/review-code/review-comment-readability-prompt.md` - - Focus: Polishes `Problem`, `Proposed Fix`, `Draft Comment`, and + - Focus: Polishes `Problem`, `Proposed Fix`, optional `Where`, and `Draft Reply` text for rendered readability: - - Enforce the mechanical `Draft Comment` structure (`<brief/concise - description of issue>`, bounded `Suggested fix:`, and optional `Where:` - when multiple locations are affected). + - Enforce the `Proposed Fix` budget: a high-level, direct first sentence + under 20 words stating the suggested fix, plus up to 50 additional + words for more information on the fix (`Where` is not subject to this + limit). - Cut dense "wall of text" paragraphs down to 1–2 short, direct sentences. - Omit verbatim code snippets when a concise prose instruction suffices. - - Include concrete suggested error/message wording in `Draft Comment` - (not left only in `Proposed Fix`). - Remove excessive inline backticks across identifier lists (such as `UPPER_SNAKE_CASE` constants) and strip outer backtick wrappers. @@ -173,17 +172,11 @@ ### <ID>. [<SEVERITY>] <Short title> — [<file>:<line>](file:///...) * Action: <Post comment | Fix directly and push to PR> * Problem: <1-2 sentences stating what is wrong and why.> - * Proposed Fix: <concise prose fix instruction, or replacement snippet/diff - when non-trivial> - * Draft Comment (in user's voice): - ```markdown - <brief/concise description of issue> - - Suggested fix: <fix, under 20 lines / 10 sentences> - - Where: <other locations where this is applicable, if more than just the - commented location> - ``` + * Proposed Fix: <First sentence under 20 words, high-level, direct, and to the + point, stating the suggested fix. Up to 50 additional words for more + information on the fix.> + * Where: <Other locations where this applies, included only when more than + just the primary location is affected; not subject to the 50-word limit.> * Author Response: <If the author replied to this comment thread, quote or summarize their response here, bolding any question to answer.> * Draft Reply: <proposed reply in user's voice, if applicable> @@ -197,8 +190,8 @@ ## Passing Domains <Comma-separated list of audited domains with 0 issues> ```` -- Omit verbatim code snippets from `Proposed Fix` and `Draft Comment` when a - concise prose instruction suffices: +- Omit verbatim code snippets from `Proposed Fix` when a concise prose + instruction suffices: - Formatting and line wrapping: state what formatting rule to apply (e.g., wrap lines and `doc` strings to 80 columns) instead of pasting re-wrapped code. @@ -246,7 +239,7 @@ `.agents/skills/review-code/scripts/wrap_pr_body.py` with `--repo=bazel-contrib/rules_python -- "<pr>"` directly during synthesis. Do not pull raw PR descriptions into LLM context to re-wrap manually or - propose a long `Draft Comment`; the script re-fetches via `gh pr view`, + propose a long formatting comment; the script re-fetches via `gh pr view`, strips control characters, wraps prose deterministically, verifies non-whitespace token equivalence, and applies `gh pr edit`. - Only after `wrap_pr_body.py` exits `0` with `status=updated`: @@ -263,8 +256,8 @@ omit the notice comment and drop the finding (or move it to `## Resolved Issues` if previously recorded). - If `wrap_pr_body.py` fails (e.g., `gh pr edit` lacks permissions), keep - the finding under `## Open Issues` in `code-review-results.md` with a - 1-sentence `Draft Comment` requesting 72-column prose wrapping. + the finding under `## Open Issues` in `code-review-results.md` requesting + 72-column prose wrapping. - Once all sub-agents finish, finalize `code-review-results.md` and provide a concise summary with the overall verdict and a clickable markdown link to `code-review-results.md` in the response. @@ -305,8 +298,23 @@ the latest PR description, commits, and review comments (`gh pr view`), move 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: +- When posting review comments to a PR, phrase them mechanically in the user's + voice from `Problem`, `Proposed Fix`, and (when multiple locations are + affected) `Where` without storing the verbatim comment in + `code-review-results.md`: + + ```markdown + <brief/concise description of issue> + + Suggested fix: <fix, under 10 lines / 50 words> + + Where: <other locations where this is applicable, if more than just the + commented location> + ``` + + Include `Where:` only when more than just the commented location is affected + (omit `Where:` for single-location issues). Append an italicized disclosure + line at the end of every posted comment or reply: `*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 agent-generated comment unreviewed by the user.*` if posted
diff --git a/.agents/skills/review-code/review-comment-readability-prompt.md b/.agents/skills/review-code/review-comment-readability-prompt.md index b128c49..958bdd4 100644 --- a/.agents/skills/review-code/review-comment-readability-prompt.md +++ b/.agents/skills/review-code/review-comment-readability-prompt.md
@@ -1,14 +1,14 @@ -You are the Comment Readability Editor sub-agent. Your job is to review and -polish the `Problem`, `Proposed Fix`, `Draft Comment`, and `Draft Reply` fields -of candidate code-review findings so they read naturally and scan effortlessly +You are the Comment Readability Editor sub-agent. Review and polish the +`Problem`, `Proposed Fix`, optional `Where`, and `Draft Reply` fields of +candidate code-review findings so they read naturally and scan effortlessly when rendered in Markdown (`code-review-results.md`) and GitHub pull request -comments. +replies. 1. Eliminate Rapid Formatting Jumps (Excessive Inline Backticks): - When a sentence lists multiple identifiers, constants, symbols, or paths (for example, `` `PY_BINARY_ATTRS`, `PY_TEST_ATTRS`, `PY_LIBRARY_ATTRS`, and `PY_IMPORT_ATTRS` ``), jumping repeatedly into and out of inline code - formatting makes the rendered text visually jarring and difficult to read. + formatting makes rendered text visually jarring and difficult to read. - Rewrite such lists to use un-backticked names when the identifiers are already visually distinct in prose (such as `UPPER_SNAKE_CASE` constants, `CamelCase` classes, or dotted module names), or group them into a single @@ -24,77 +24,46 @@ otherwise look like ordinary English words (`id`, `in`, `set`, `list`, `_`) or single isolated expressions. -2. No Outer Backtick Wrappers on Prose Comments: - - Never wrap an entire `Draft Comment` or `Draft Reply` sentence in outer - backticks. Any inner backticks inside an outer-backticked sentence invert - Markdown code spans, causing the prose to render in monospace and the code - tokens to render in proportional font. +2. No Outer Backtick Wrappers on Prose: + - Never wrap an entire `Problem`, `Proposed Fix`, or `Draft Reply` sentence + in outer backticks. Inner backticks inside an outer-backticked sentence + invert Markdown code spans, rendering prose in monospace and code tokens + in proportional font. -3. Mechanical Comment Structure & Minimal Prose: - - Phrase `Draft Comment` text mechanically in the user's voice rather than - with conversational prose, omitting throat-clearing openers and needless - words. - - Structure every `Draft Comment` as: - - ```markdown - <brief/concise description of issue> - - Suggested fix: <fix, under 20 lines / 10 sentences> - - Where: <other locations where this is applicable, if more than just the - commented location> - ``` - - - Include `Where:` only when more than just the commented location is - affected; omit `Where:` for single-location issues. +3. Concise `Proposed Fix` Budget & Optional `Where`: + - Make the first sentence of `Proposed Fix` under 20 words—high-level, + direct, and to the point—stating what the suggested fix is. + - Limit any follow-up detail in `Proposed Fix` to at most 50 additional + words for more information about the suggested fix (such as concrete + diagnostic wording). + - List other affected locations in the separate `Where` field only when more + than just the primary location is affected (omit `Where` for + single-location issues); `Where` is not subject to the `Proposed Fix` + 50-word limit. 4. No "AI Slop" Walls of Text (`arXiv:2610.29162v1`): - - Keep `Draft Comment` prose to 1–2 short, direct sentences (~40 words max) - and `Draft Reply` prose to 1–3 short sentences (~15–60 words) leading with - the commit hash or direct answer. + - Keep `Problem` prose to 1–2 short, direct sentences and `Draft Reply` + prose to 1–3 short sentences (~15–60 words) leading with the commit hash + or direct answer. - Pair direct subjects with concrete verbs; avoid inanimate subjects with agentive verbs (`"This commit facilitates..."`), denominal verbs, 3+ stacked nouns, and center-embedded relative clauses. - Cut parenthetical `e.g.` scenario lists, semicolon-chained - `"conversely..."` contrasts, and restated context that is already obvious - from the anchored file and line. - - Never emit a dense, multi-clause single paragraph. Separate distinct - points or suggested snippets with a blank line. + `"conversely..."` contrasts, and restated context obvious from the + anchored file and line. + - Never emit a dense, multi-clause single paragraph. -5. Omit Redundant Code Blocks, Keep Concrete Diagnostic Wording: - - Omit verbatim code snippets from `Proposed Fix` and `Draft Comment` when a - concise prose instruction suffices: +5. Omit Redundant Code Snippets: + - Omit verbatim code snippets from `Proposed Fix` when a concise prose + instruction suffices: - Formatting and line wrapping: state what formatting rule to apply (e.g., - wrap lines and `doc` strings to 80 columns) instead of pasting re-wrapped - code. + wrap lines and `doc` strings to 80 columns) instead of pasting + re-wrapped code. - Missing per-field `struct(...)` comments: state to document each field with a comment instead of pasting a commented `struct(...)` block. - Compound boolean or inline ternary expressions: describe how to split them into explicit `if` statements instead of pasting a replacement block. - - Only `Draft Comment` (not `Proposed Fix`) is posted to GitHub. When a - finding suggests specific wording for an error/failure message or a - non-trivial code change, `Draft Comment` must include the concrete - suggested text under `Suggested fix:` (within the 20-line / 10-sentence - limit). - - Bad: A 120-word paragraph explaining every hypothetical case and ending - with `"Should the failure message note that..."` while hiding the actual - replacement wording in `Proposed Fix`. - - Good: - - ````markdown - `fail()` here reports only the target label and omits the invalid - `python_version` value that triggered the mismatch. - - Suggested fix: Include the actual `python_version` in the `fail()` call: - - ```starlark - fail("Invalid python_version '{}' for target {}".format( - version, - ctx.label, - )) - ``` - ```` 6. Return the polished findings in the standard report format:
diff --git a/.agents/skills/review-code/review-pr-standards-prompt.md b/.agents/skills/review-code/review-pr-standards-prompt.md index 4ee78c5..18caa36 100644 --- a/.agents/skills/review-code/review-pr-standards-prompt.md +++ b/.agents/skills/review-code/review-pr-standards-prompt.md
@@ -35,9 +35,8 @@ `--repo=bazel-contrib/rules_python -- "<pr>"` first. When it reports `status=would_update`, report `Severity: NIT`, `Location: PR Description`, and `Proposed Fix:` instructing the orchestrator to run - `.agents/skills/review-code/scripts/wrap_pr_body.py` (and post the brief - notice comment only when modifying another contributor's PR), and a - 1-sentence fallback `Draft Comment` requesting 72-column prose wrapping - (used only if `gh pr edit` lacks permissions). + `.agents/skills/review-code/scripts/wrap_pr_body.py` (posting a brief notice + only on another contributor's PR, or requesting 72-column wrapping if + `gh pr edit` lacks permissions). @.agents/skills/review-code/review-report-format.md
diff --git a/.agents/skills/review-code/review-report-format.md b/.agents/skills/review-code/review-report-format.md index 88246e0..b1e206a 100644 --- a/.agents/skills/review-code/review-report-format.md +++ b/.agents/skills/review-code/review-report-format.md
@@ -13,33 +13,15 @@ - Problem: 1-2 sentences stating what is wrong and why (or, for `HUMAN-SIGN-OFF`, quoting the author's justification and evaluating whether it holds up). -- Proposed Fix: Concise prose fix instruction when a short description - suffices, or a concrete code snippet/diff for non-trivial changes. Omit - verbatim code snippets for: +- Proposed Fix: Start with a high-level, direct first sentence under 20 words + stating the suggested fix. Add up to 50 additional words for more information + about the suggested fix (such as concrete diagnostic wording) only when + needed. Omit verbatim code snippets when prose suffices, including: - Formatting and line wrapping (state what formatting rule to apply). - Missing per-field `struct(...)` comments (state to document each field with a comment). - Splitting compound boolean or inline ternary expressions into explicit `if` statements. -- Draft Comment: Ready-to-post comment in user's voice, phrased mechanically - with minimal prose and structured as (include `Where:` only when more than - just the commented location is affected): - ```markdown - <brief/concise description of issue> - - Suggested fix: <fix, under 20 lines / 10 sentences> - - Where: <other locations where this is applicable, if more than just the - commented location> - ``` - Format `Draft Comment` as follows: - - Keep `<brief/concise description of issue>` to 1–2 short, direct sentences - (no multi-clause "wall of text" paragraphs, parenthetical `e.g.` scenario - lists, or `"conversely..."` chains). - - Omit verbatim code blocks from `Suggested fix:` when prose suffices. - - Include concrete suggested text in `Suggested fix:` inside `Draft Comment` - (not only in `Proposed Fix`) when proposing specific error/failure message - wording or a non-trivial code change. - - Avoid wrapping lists of visually distinct identifiers (such as - `UPPER_SNAKE_CASE` constants) in individual backticks, and never wrap the - entire comment in outer backticks. +- Where: Other affected locations, included only when more than just the + primary `Location` is affected (not subject to the 50-word `Proposed Fix` + limit; omit for single-location issues).