Repository navigation
docs: add agent-assisted PR review guidelines #715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d0b6fea
docs: add agent-assisted PR review guidelines
zywind c25c819
docs: credit CodeRabbit review template
zywind 187e3b4
feat: complete agent-assisted review workflow
zywind 9fc33a4
fix: satisfy review workflow checks
zywind 8b3a595
docs: disambiguate review posting approval
zywind f99c403
Update .agents/skills/github-cli/scripts/gh_pr_helper.py
zywind 22b1184
fix: address review workflow feedback
zywind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
175 changes: 175 additions & 0 deletions
175
.agents/skills/github-cli/references/review-comments.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
| <!-- SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --> | ||
| <!-- SPDX-License-Identifier: Apache-2.0 --> | ||
|
|
||
| # Agent-Assisted Pull Request Reviews | ||
|
|
||
| Use this contract when drafting or posting new PR review findings. Replies in an | ||
| existing thread follow the reply workflow in `workflows.md`. | ||
|
|
||
| The finding-header shape and classification style are based on CodeRabbit's | ||
| review-comment template. Expected handling, exact approval, and agent | ||
| attribution are Safe Synthesizer additions. | ||
|
|
||
| ## Contents | ||
|
|
||
| - [Workflow](#workflow) | ||
| - [Submit an Approved Review](#submit-an-approved-review) | ||
| - [Finding Format](#finding-format) | ||
| - [Area](#area) | ||
| - [Impact](#impact) | ||
| - [Effort/Value](#effortvalue) | ||
| - [Expected Handling](#expected-handling) | ||
| - [Attribution and Approval](#attribution-and-approval) | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. Pin the PR head and verify every finding against that revision. Tie each | ||
| finding to changed code and a commentable diff line. | ||
| 2. Read existing inline comments, submitted review bodies, and top-level | ||
| comments. Remove duplicate findings and account for decisions already | ||
| recorded in the discussion. | ||
| 3. Classify each finding by area, impact, effort/value, and expected handling. | ||
| Keep these dimensions independent: a critical issue can be a quick win, and | ||
| a minor issue can be a heavy lift. | ||
| 4. Draft the exact comment text and line target for human review. Mark the draft | ||
| as unapproved and keep it off GitHub. | ||
| 5. Obtain explicit approval of the exact comments. A material text or line-target | ||
| change requires approval again. | ||
| 6. Recheck the PR head immediately before posting. Re-verify findings affected by | ||
| new commits and reapprove materially revised comments. | ||
| 7. Post only the approved artifact with the helper below. Return the review URL | ||
| and direct links to every posted comment. | ||
|
|
||
| Completion criterion: every posted finding is current, non-duplicative, | ||
| classified, explicitly approved, truthfully attributed, and linked in the | ||
| handoff. | ||
|
|
||
| ## Submit an Approved Review | ||
|
|
||
| Save the exact approved review as JSON. `head_sha` must be the full 40-character | ||
| SHA verified during review. Each comment targets a line in that revision's diff: | ||
|
|
||
| ```json | ||
| { | ||
| "head_sha": "0123456789abcdef0123456789abcdef01234567", | ||
| "body": "Review summary.\n\n_Agent-assisted review: generated by @reviewer's Agent and reviewed by @reviewer._", | ||
| "comments": [ | ||
| { | ||
| "path": "src/example.py", | ||
| "line": 42, | ||
| "side": "RIGHT", | ||
| "body": "🎯 _Functional Correctness_ | 🟡 _Minor_ | ⚡ _Quick win_ | 🤖 _Agent-fix candidate_\n\n**Reject the invalid value here.**\n\nExplain the trigger, impact, and smallest practical fix." | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| For a multiline target, also set `start_line` and `start_side`. Then submit all | ||
| approved findings as one non-approving `COMMENT` review: | ||
|
|
||
| ```bash | ||
| uv run --script .agents/skills/github-cli/scripts/gh_pr_helper.py -- \ | ||
| submit-review <PR_NUMBER> --review-file path/to/approved-review.json | ||
| ``` | ||
|
|
||
| The helper validates the artifact before making a network request, compares | ||
| `head_sha` with the live PR head, and aborts on a mismatch. On success it emits | ||
| one JSON object containing `review_url` and a direct `html_url` for each entry in | ||
| `comments`. Never edit the approved artifact between approval and submission. | ||
|
|
||
| ## Finding Format | ||
|
|
||
| Use this shape: | ||
|
|
||
| ```markdown | ||
| 🎯 _Functional Correctness_ | 🟡 _Minor_ | ⚡ _Quick win_ | 🤖 _Agent-fix candidate_ | ||
|
|
||
| **Reject a blank `replacement_plan` string here.** | ||
|
|
||
| An empty or whitespace-only string passes this validator. `resolve_plan` then | ||
| reports a generic plan-source error instead of identifying the invalid field. | ||
| Reject blank strings during config validation so the failure is precise. | ||
| ``` | ||
|
|
||
| After the metadata, write: | ||
|
|
||
| 1. A short, imperative title. | ||
| 2. One compact explanation containing the triggering condition, observable | ||
| impact, and smallest practical fix. | ||
| 3. An optional proposed fix or committable suggestion only when the change is | ||
| localized and unambiguous. | ||
|
|
||
| Use impact and expected handling instead of calling a finding a "blocker." | ||
|
|
||
| ## Area | ||
|
|
||
| Choose exactly one: | ||
|
|
||
| - `🎯 Security & Privacy` — exploitation, sensitive-data exposure, permissions, | ||
| authentication, or privacy guarantees. | ||
| - `🎯 Data Integrity & Integration` — corruption, schema/API contract mismatch, | ||
| migrations, or cross-system consistency. | ||
| - `🎯 Performance & Scalability` — latency, throughput, memory, algorithmic cost, | ||
| or load-dependent degradation. | ||
| - `🎯 Stability & Availability` — crashes, hangs, deadlocks, resource leaks, or | ||
| operational failure. | ||
| - `🎯 Functional Correctness` — behavior produces the wrong result or violates a | ||
| functional contract. | ||
| - `🎯 Maintainability & Code Quality` — structure creates concrete future change | ||
| risk without a current functional failure. | ||
|
|
||
| ## Impact | ||
|
|
||
| Choose exactly one: | ||
|
|
||
| - `🔴 Critical` — security/privacy exposure, data loss, contamination, or a | ||
| broken release or core pipeline. | ||
| - `🟠 Major` — materially incorrect behavior, a broken public contract, invalid | ||
| configuration behavior, or a likely production failure. | ||
| - `🟡 Minor` — localized incorrect behavior or missing focused regression | ||
| protection. | ||
| - `🔵 Trivial` — negligible behavioral impact; normally suppress. | ||
| - `⚪ Info` — context without required action; normally suppress. | ||
|
|
||
| ## Effort/Value | ||
|
|
||
| Choose exactly one. This is a cost/value judgment, not a linear size estimate: | ||
|
|
||
| - `⚡ Quick win` — a worthwhile, localized fix. | ||
| - `🏗️ Heavy lift` — worthwhile but requires substantial or cross-module work. | ||
| - `⚖️ Poor tradeoff` — implementation cost is disproportionate to the impact. | ||
| - `🫧 Low value` — little practical benefit; normally suppress. | ||
|
|
||
| ## Expected Handling | ||
|
|
||
| Choose exactly one: | ||
|
|
||
| - `🤖 Agent-fix candidate` — localized and unambiguous enough for an agent to | ||
| implement and test. The author verifies the patch. | ||
| - `👤 Author review required` — the author must evaluate the finding before | ||
| merge; an agent may assist but must not resolve the judgment autonomously. | ||
| - `🧭 Human decision required` — settle a product, contract, or architecture | ||
| decision before an agent implements a fix. | ||
| - `📌 Follow-up acceptable` — the finding may be deferred after acknowledgment. | ||
|
|
||
| `Agent-fix candidate` classifies suitability; it does not authorize repository | ||
| changes. Apply it automatically only inside a workflow that explicitly authorizes | ||
| review-fix iteration. Otherwise wait for implementation authorization. | ||
|
|
||
| ## Attribution and Approval | ||
|
|
||
| For several inline comments submitted as one review, end the review summary with: | ||
|
|
||
| ```markdown | ||
| _Agent-assisted review: generated by @<reviewer>'s Agent and reviewed by @<reviewer>._ | ||
| ``` | ||
|
|
||
| For comments posted individually without a shared summary, end each comment with: | ||
|
|
||
| ```markdown | ||
| _Generated by @<reviewer>'s Agent; reviewed by @<reviewer>._ | ||
| ``` | ||
|
|
||
| Claim human review only after the named reviewer approves the exact text and line | ||
| target. Before that approval, use draft-only language and make no attribution | ||
| claim on GitHub. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.