Repository navigation
Conversation
[ghstack-poisoned]
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ✅ AUTOMATED REVIEW - OUTDATED (earlier commit) - Ready for human review:
Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/202634
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit abd49d3 with merge base 47ffd6f ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…the goalposts ## Linked issue or supporting maintainer Part of pytorch/test-infra#9243 ## BC-breaking? No. ## Summary (human written only) Everytime the review agent is running, it introduces some new blockers regardless of what has been ficed and what has been asked by the author to ignore. ## Agent details (if applicable) On a re-review, the pr-review skill re-reviews the whole PR from scratch, and "Everything is a must-fix" turns every new observation into a blocker, so a PR whose author fixes each round's findings can still collect new blockers every round (pytorch/test-infra#9243; on #199555 the production review raised 1, 2, 2, 5, 6, 5, 4, 7, 5, 6, 7, 7, 6, 6, 7, 5 blocking findings over 16 rounds). This adds "Re-reviews converge" to "Earlier Automated Findings": settle the earlier blocking findings first (report one still present again as a continuing finding, drop one fixed or convincingly answered); review what changed since the last review in full; on code unchanged since then, raise a new blocking finding only for a defect with a concrete failure and say why it was not raised before; keep earlier non-blocking points non-blocking unless the code got worse. It reads `/tmp/pr-interdiff.txt` when present (changes since the commit the last review saw) and otherwise compares the earlier findings' code with HEAD. Evaluation: local replays of #199555 rounds 9-11 with production's prompts and models, 3 runs each, every round given the previous round's findings from the same run, as production gives them. Blocking findings in rounds 10 and 11, compared with that run's previous review (matched by an LLM judge): | | Round 10 (author added code) | Round 11 (10 changed lines) | |---|---|---| | Today's skill | 7: 2 new, 2 previously non-blocking | 7: 1 new, on unchanged code | | This change, with an interdiff | 8: 4 new, all on the code added in that round | 8: 0 new, 0 previously non-blocking | The hardened workflow does not provide `/tmp/pr-interdiff.txt` yet; without it the skill compares the earlier findings' code with HEAD. Providing it is a follow-up. One PR and three runs: a signal, not a measurement. Test plan: ``` python3 -m unittest discover -s scripts/pr_review -t . lintrunner -a .agents/skills/pr-review/SKILL.md ``` This PR was authored with the help of an AI assistant (Claude). ghstack-source-id: 47ebb0d Pull-Request: #202634
izaitsevfb
left a comment
There was a problem hiding this comment.
lgtm, see one nit below.
also, should be merged together with interdiff one
| 1. **Settle the earlier blocking findings first.** For each one, check HEAD: fixed, still present, or answered by the author or a maintainer with a claim that holds up at HEAD. Report one that is still present again, with the same substance, as a continuing finding; drop one that is fixed or convincingly answered. | ||
| 2. **Review what changed since the last review in full.** `/tmp/pr-interdiff.txt`, when present, holds the changes to the PR's files since the commit the last review saw (`original_commit_id` on its findings). Without it, compare the code the earlier findings point at with HEAD. Changed and new code gets the same scrutiny as in a first review. | ||
| 3. **Don't move the goalposts on code the last review already covered.** For code unchanged since the last review, raise a new blocking finding only for a defect with a concrete failure (wrong behavior, a crash, a security or backward-compatibility break), and say why it was not raised before. Any other new point about unchanged code is non-blocking. | ||
| 4. **Keep earlier non-blocking points non-blocking** unless the code changed in a way that makes them worse. |
There was a problem hiding this comment.
might need to clarify this case
🟡 Rule 4 keeps an earlier non-blocking point non-blocking even when a later round shows it causes a concrete failure on unchanged code. (ai-generated section)
Rule 4 allows promotion only when "the code changed in a way that makes them worse". If a point first raised as non-blocking turns out to cause a crash or wrong behavior, with the code unchanged, it has to stay non-blocking, while rule 3 would let the same defect block had it not been raised before. An earlier mis-rating then becomes permanent, and a PR can reach approval with a known concrete failure. pytorch/test-infra#9243 proposes "doesn't become more severe without new evidence". Letting rule 4 promote under rule 3's condition (a concrete failure, with the new evidence stated) would keep the two rules consistent.
Reviewed by codex gpt-6-astra + claude-fable-5 at high effort, against 0bf21f0.
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
There was a problem hiding this comment.
Automated review of f71676f: nothing blocking; ready for human review.
The PR adds a "Re-reviews converge" subsection to the pr-review skill: on a re-review, the reviewer first settles the earlier blocking findings and then reviews everything changed since the last review in full, and a new blocking finding on unchanged, already-reviewed code needs a concrete failure. The earlier blocking findings and the maintainer's inline comment are all resolved at HEAD, and the review found no new issues. Recommendation: Approve.
This review is AI-generated and advisory. Each new automated review replaces the previous one.
Withdrawn: the automated review of f71676f found nothing blocking.
|
|
||
| ### Re-reviews converge | ||
|
|
||
| The author is fixing what the last review asked for, so each round should leave fewer blocking findings, not new ones. When the conversation includes an earlier automated review: |
There was a problem hiding this comment.
So we asssume that the first review caught everything and follow up review are not catching things that the first one missed due to "noise" ?
There was a problem hiding this comment.
Excellent point, yes this is the trade off, as an example, a replay of 3 times on a single PR showed 4,5,7 findings per run where only 2 were in common (9 distinct issues). So if we only rely on run 1, we only capture 4/9 of those issues. We should tune the agent in a way that in first run, it captures all the issues.
|
I'm happy to try this but it's complicated so it's not obvious to me that we can't just make the reviewer less picky and that solves the problem. |
"Treat every line as potentially load-bearing" and "Everything is a must-fix" give the reviewer no way to call a true observation minor, so every observation becomes Request Changes. In the ciforge eval, main blocked 34/54 runs (63%) on PRs maintainers approved and merged unchanged, and in local replays of re-review rounds from the PRs in pytorch/test-infra#9243 it requested changes 88% of the time, which is what keeps agent edit/review loops going. Deleting the rule alone does not work: the skill then has no notion of severity. On #202692 at 731814c (a branch mutation silently written into a stride-fixing copy), the reviewer still found the bug but recommended Needs Discussion in 4/5 runs, which stage B maps to ready for human review. A flat "block only on concrete failures" rule overcorrected the other way: in ciforge it cut false blocks to 9% and loop-round Request Changes to 42%, but kept only 22/30 blocks on maintainer-confirmed defects, because the reviewer found bugs and rated them non-blocking as "not reachable" or "already broken before this PR". This replaces the rule with three principles. Block in proportion to stakes, weighing irreversibility and silence (serialized formats, then silent wrong results, then APIs, then loud test or tooling crashes), with REVIEW.md for directory-specific history. A bug the PR creates, exposes or changes the failure of is the PR's even if the old code was also wrong, while an unrelated preexisting bug does not block and the author is reminded to fix it in a separate stacked PR. Before asking for a check, look for the invariant: drop what it rules out, report what a concrete path reaches, and treat a missing invariant as a design question rather than a demand for defensive code. It also drops the "load-bearing" paragraph (each example is already a checklist item), softens "pattern mismatches are always wrong", and removes the two references to the deleted rule. The non-blocking convention matches #202634, so first reviews and re-reviews share one severity model. Test Plan: The numbers above are for the flat "concrete failures" wording, not this text. Eval runs (production stage A+B, 3 reps per case): ``` gh workflow run pr-review-eval-maintainer.yml -R pytorch/ciforge -f prompt_refs=4f716f5fe1a35fef5679118f57387eb58eab32cb,pr:202820 -f reps=3 gh workflow run pr-review-eval-regressions.yml -R pytorch/ciforge -f prompt_refs=4f716f5fe1a35fef5679118f57387eb58eab32cb,pr:202820 -f reps=3 ``` Loop rounds and the #202692 control were replayed locally with a stage-A replica (headless `claude -p "/pr-review N"` with production's offline system prompt, tool allowlist, model and effort). This text should get the same ciforge pair before it lands. This PR was authored with an AI assistant (Claude). Pull-Request: #202820 ghstack-source-id: d355056
[ghstack-poisoned]
| before approval, `minor` for other problems, `info` for | ||
| suggestions. | ||
| suggestions. A point the review labels non-blocking is | ||
| `minor`, never `major`. |
There was a problem hiding this comment.
seems like a valid corner case.
🟡 When the review recommends Request Changes but labels every point non-blocking, the new second-stage rule makes every finding post as a blocker. (ai-generated section)
The second stage keeps a Request Changes recommendation as changes_requested (the verdict bullet above line 991), and this push makes it record every point labelled non-blocking as minor (lines 994-995). blocking_findings in scripts/pr_review/post_review.py (lines 263-268) returns all findings as blockers when the verdict is changes_requested and none is major. So if the first stage breaks line 168 (it recommends Request Changes with only non-blocking points, for example by citing one as the reason), every finding now posts as a blocker under Request Changes; before this line, the point cited as the reason became major and the rest were folded into the body. This is the outcome the description says the PR prevents. Making the second stage's verdict ready_for_human_review when every point the review raises is labelled non-blocking would close it at the same layer.
Reviewed by codex gpt-6-astra + claude-fable-5 at high effort, against 99743a6.
[ghstack-poisoned]
[ghstack-poisoned]
|
Starting merge as part of PR stack under #202667 |
…view (#202667) ## Linked issue or supporting maintainer Part of pytorch/test-infra#9243 ## BC-breaking? No. ## Summary (human written only) Pass the differences between PR after addressing some previous review feedback ## Agent details (if applicable) The previous PR in this stack tells re-reviews to settle their earlier findings and review what changed since the last review, reading `/tmp/pr-interdiff.txt` when present. This provides that file. Without it the review sees only the PR's full diff against its base, which does not say which lines are new since its last review, so a re-review reviews all of them again. - `fetch_pr_comments.py` adds `previous_review_sha` to its output: the commit the latest automated review saw (`commit_id` of the review it already selects), empty without one. A re-run on the same commit gets a "nothing changed" note. - `prepare` passes it on as an output, validated as a 40-hex SHA or empty, together with that commit's merge base with the PR's base, resolved by the compare endpoint on complete history like this run's merge base (empty if the commit is gone). - A new `review` step, after the size gate and before any credential, fetches those two commits (depth 1, as for the merge base) and runs the new `scripts/pr_review/interdiff.py` from the trusted checkout, which writes `/tmp/pr-interdiff.txt`. Diffing the earlier commit against HEAD would show a rebase's upstream changes to the PR's files as the author's, and ghstack PRs are rebased often. So the script replays the earlier version onto this run's merge base with `git merge-tree` (explicit merge base, no checkout, no shared history needed) and diffs HEAD against that, so upstream changes cancel out. A file the replay cannot merge changed both upstream and in the PR; it gets the plain diff under a heading saying it includes upstream changes. No earlier review, an unavailable commit, no changed files, any failure or a result over `MAX_DIFF_BYTES` give a one-line note instead, so the model's read rule always resolves and the review never fails for this file. File names are literal pathspecs and are decoded losslessly, so a non-UTF-8 name cannot fail the step. `interdiff.py` is part of the prompt hash, like `fetch_pr_comments.py`. - Stage A may read the file (`Read(//tmp/pr-interdiff.txt)`), and the Offline prompt names it. The contract tests pin the new read rule, list `interdiff.py` among the trusted programs the review job runs, and model `PREVIOUS_REVIEW_SHA` and `PREVIOUS_MERGE_BASE_SHA` as plain values, like `MERGE_BASE_SHA`. `test_interdiff.py` covers a rebase (upstream changes left out), a file changed on both sides, no rebase, a re-run on the same commit, the notes, an unexpected failure, the size cap, pathspec-like file names (the test fails without `--literal-pathspecs`) and a non-UTF-8 file name. Renames since the last review show up as new files; detecting them is a follow-up. Evaluation: replaying #199555 rounds 9-11 locally (3 runs each), re-reviews given an interdiff and the previous PR's skill raised 0 new and 0 previously non-blocking blocking findings in round 11, against 1 new with today's skill (see the previous PR). The step was also run on that PR's real commits. Round 10 -> 11 was a rebase: a plain diff of the two commits showed 10 changed lines in 5 files, all of them changes the base made; the rebase-aware interdiff shows none of those, plus the one file both sides changed (965 bytes instead of 9 KB). It wrote notes for no earlier review and an unavailable commit, and failed on a malformed SHA. Test plan: ``` python3 -m unittest discover -s scripts/pr_review -t . lintrunner -a .github/workflows/hardened-pr-review-run.yml scripts/pr_review/*.py ``` actionlint was not run locally (its binary could not be downloaded here); CI runs it. This PR was authored with the help of an AI assistant (Claude). Pull Request resolved: #202667 Approved by: https://github.com/izaitsevfb ghstack dependencies: #202634
…the goalposts (pytorch#202634) ## Linked issue or supporting maintainer Part of pytorch/test-infra#9243 ## BC-breaking? No. ## Summary (human written only) Everytime the review agent is running, it introduces some new blockers regardless of what has been ficed and what has been asked by the author to ignore. ## Agent details (if applicable) On a re-review, the pr-review skill re-reviews the whole PR from scratch, and "Everything is a must-fix" turns every new observation into a blocker, so a PR whose author fixes each round's findings can still collect new blockers every round (pytorch/test-infra#9243; on pytorch#199555 the production review raised 1, 2, 2, 5, 6, 5, 4, 7, 5, 6, 7, 7, 6, 6, 7, 5 blocking findings over 16 rounds). This adds "Re-reviews converge" to "Earlier Automated Findings": settle the earlier blocking findings first (report one still present again as a continuing finding, drop one fixed or convincingly answered); review what changed since the last review in full; on code the last review covered and that has not changed since, raise a new blocking finding only for a defect with a concrete failure and say why it was not raised before; keep earlier non-blocking points non-blocking unless the code got worse or the concrete failure that rule requires can now be shown. Supporting changes in the same file: - The commit the last review saw comes from its body header ("Automated review of <sha>"), which every review has; `/tmp/pr-interdiff.txt` holds the changes since then when present, and modes with git can run `git diff <sha> HEAD`. Code whose change status the reviewer cannot tell is reviewed as changed, so a missing interdiff costs convergence, not recall. - "Covered" excludes files an earlier review named as not reviewed (early posts under the Time Budget) and code whose earlier findings were left out (`truncated`, or a body that says some findings did not fit); those get a first review, and so does the whole PR when the reviewer cannot tell which code an omitted finding was about. - An unaddressed maintainer comment still always blocks, whatever code it is on. - "Everything is a must-fix" now says exceptions are marked where they apply (runner naming and workflow REVIEW.md advisories already are) and names re-reviews among them, and the skill says to write "non-blocking" in such points, keep them out of the Recommendation's justification, and not recommend Request Changes when only non-blocking points remain. Without that, stage B and post_review.py post every finding as blocking under a Request Changes verdict. - With fan-out (pytorch#202952), the four reviewer sub-agents review the full diff and do not apply these rules, so the main agent does: on a re-review each reviewer marks its candidates as on changed or unchanged code, Step 4 applies "Re-reviews converge" to every merged finding before writing it up, and Step 5's fact-check requires rule 3's concrete failure for a new blocking finding on covered code. - Stage B's prompt says a point the review labels non-blocking is minor, never major, and that a review whose points are all non-blocking gets ready_for_human_review even under Request Changes, so a non-blocking point is never posted as a blocker, whatever the Recommendation. Evaluation: local replays of pytorch#199555 rounds 9-11 with production's prompts and models, 3 runs each, every round given the previous round's findings from the same run, as production gives them. Blocking findings in rounds 10 and 11, compared with that run's previous review (matched by an LLM judge): | | Round 10 (author added code) | Round 11 (10 changed lines) | |---|---|---| | Today's skill | 7: 2 new, 2 previously non-blocking | 7: 1 new, on unchanged code | | This change, with an interdiff | 8: 4 new, all on the code added in that round | 8: 0 new, 0 previously non-blocking | The hardened workflow does not provide `/tmp/pr-interdiff.txt` yet; without it the skill compares the earlier findings' code with HEAD. Providing it is a follow-up. One PR and three runs: a signal, not a measurement. Test plan: ``` python3 -m unittest discover -s scripts/pr_review -t . lintrunner -a .agents/skills/pr-review/SKILL.md ``` This PR was authored with the help of an AI assistant (Claude). Pull Request resolved: pytorch#202634 Approved by: https://github.com/izaitsevfb
…view (pytorch#202667) ## Linked issue or supporting maintainer Part of pytorch/test-infra#9243 ## BC-breaking? No. ## Summary (human written only) Pass the differences between PR after addressing some previous review feedback ## Agent details (if applicable) The previous PR in this stack tells re-reviews to settle their earlier findings and review what changed since the last review, reading `/tmp/pr-interdiff.txt` when present. This provides that file. Without it the review sees only the PR's full diff against its base, which does not say which lines are new since its last review, so a re-review reviews all of them again. - `fetch_pr_comments.py` adds `previous_review_sha` to its output: the commit the latest automated review saw (`commit_id` of the review it already selects), empty without one. A re-run on the same commit gets a "nothing changed" note. - `prepare` passes it on as an output, validated as a 40-hex SHA or empty, together with that commit's merge base with the PR's base, resolved by the compare endpoint on complete history like this run's merge base (empty if the commit is gone). - A new `review` step, after the size gate and before any credential, fetches those two commits (depth 1, as for the merge base) and runs the new `scripts/pr_review/interdiff.py` from the trusted checkout, which writes `/tmp/pr-interdiff.txt`. Diffing the earlier commit against HEAD would show a rebase's upstream changes to the PR's files as the author's, and ghstack PRs are rebased often. So the script replays the earlier version onto this run's merge base with `git merge-tree` (explicit merge base, no checkout, no shared history needed) and diffs HEAD against that, so upstream changes cancel out. A file the replay cannot merge changed both upstream and in the PR; it gets the plain diff under a heading saying it includes upstream changes. No earlier review, an unavailable commit, no changed files, any failure or a result over `MAX_DIFF_BYTES` give a one-line note instead, so the model's read rule always resolves and the review never fails for this file. File names are literal pathspecs and are decoded losslessly, so a non-UTF-8 name cannot fail the step. `interdiff.py` is part of the prompt hash, like `fetch_pr_comments.py`. - Stage A may read the file (`Read(//tmp/pr-interdiff.txt)`), and the Offline prompt names it. The contract tests pin the new read rule, list `interdiff.py` among the trusted programs the review job runs, and model `PREVIOUS_REVIEW_SHA` and `PREVIOUS_MERGE_BASE_SHA` as plain values, like `MERGE_BASE_SHA`. `test_interdiff.py` covers a rebase (upstream changes left out), a file changed on both sides, no rebase, a re-run on the same commit, the notes, an unexpected failure, the size cap, pathspec-like file names (the test fails without `--literal-pathspecs`) and a non-UTF-8 file name. Renames since the last review show up as new files; detecting them is a follow-up. Evaluation: replaying pytorch#199555 rounds 9-11 locally (3 runs each), re-reviews given an interdiff and the previous PR's skill raised 0 new and 0 previously non-blocking blocking findings in round 11, against 1 new with today's skill (see the previous PR). The step was also run on that PR's real commits. Round 10 -> 11 was a rebase: a plain diff of the two commits showed 10 changed lines in 5 files, all of them changes the base made; the rebase-aware interdiff shows none of those, plus the one file both sides changed (965 bytes instead of 9 KB). It wrote notes for no earlier review and an unavailable commit, and failed on a malformed SHA. Test plan: ``` python3 -m unittest discover -s scripts/pr_review -t . lintrunner -a .github/workflows/hardened-pr-review-run.yml scripts/pr_review/*.py ``` actionlint was not run locally (its binary could not be downloaded here); CI runs it. This PR was authored with the help of an AI assistant (Claude). Pull Request resolved: pytorch#202667 Approved by: https://github.com/izaitsevfb ghstack dependencies: pytorch#202634
## Linked issue or supporting maintainer Related to #202634 (non-blocking points on re-reviews). ## BC-breaking? No. ## Summary (human written only) Clarify the severity issue vs everything must be blocking ## Agent details (if applicable) Review Philosophy 5, "Everything is a must-fix", makes every point the review raises a reason to block, so the agent requests changes on most PRs it reviews: in production at the end of October it requested changes on about 80-90% of the PRs it reviewed each day, while maintainers requested changes on about 20% of the PRs they reviewed. torchtitan's pr-review skill instead sorts findings into must-fix and should-consider and approves when only small, local items remain. This replaces item 5 with "Separate blocking from non-blocking": a point is blocking when the PR should not land until it is fixed (a correctness or security bug, a backward-compatibility break, a design problem that needs another look once addressed, or an unaddressed maintainer comment); everything else worth mentioning is written as "non-blocking". The blocking list keeps every rule in this skill's files that says a point always blocks or always means Request Changes (a non-exempt CI install, a new non-conforming runner label, the decref-before-update hazard), and review-checklist.md and ci-runner-naming.md no longer call those exceptions to "Everything is a must-fix". The Recommendation section now says to request changes only for a blocking point and to approve, listing the non-blocking points, when only those remain, except where the Time Budget says otherwise. The rest of the pipeline already handles non-blocking points since #202634: stage B records a point labelled non-blocking as `minor`, a review whose points are all non-blocking becomes `ready_for_human_review`, and post_review.py folds minor findings into a collapsed section instead of posting them as blockers. Evaluation: 30 clean PRs (a maintainer approved without comments; merged, never reverted) from ciforge's clean_approved, balanced across areas, and the 30 dev-split PRs of recall_strong with 45 maintainer issues the author fixed before merge (one more dev PR was skipped as too large by both versions). Local runs with production's prompts and model, one review per PR, main against this change: | | main | This change | |---|---|---| | Clean PRs blocked | 25 of 30 | 11 of 30 | | Blocking findings on those PRs | 93 | 23 | | All findings on those PRs | 166 | 170 | | Maintainer issues found | 27 of 45 | 27 of 45 | | Maintainer issues found and marked blocking | 14 | 12 | | Defects found / marked blocking | 4 / 2 | 5 / 1 | The change reports as many findings and finds the same maintainer issues (24 found by both, 3 only by each), but grades most findings non-blocking, so it blocks 11 clean PRs instead of 25. It also grades some real defects non-blocking: of the 5 defects it found, it marked 1 blocking, against 2 of 4 for main. A maintainer issue counts as found when an LLM judge matches one of the agent's findings to it by root cause. The runs used this change before the always-blocking rules and the Time Budget exception were added; none of the evaluated reviews raised a CI install, a runner label, a decref hazard or an early post. Test plan: ``` python3 -m unittest discover -s scripts/pr_review -t . ``` This PR was authored with the help of an AI assistant (Claude). ghstack-source-id: 4c76301 Pull-Request: #203531
## Linked issue or supporting maintainer Related to #202634 (non-blocking points on re-reviews). ## BC-breaking? No. ## Summary (human written only) Clarify the severity issue vs everything must be blocking ## Agent details (if applicable) Review Philosophy 5, "Everything is a must-fix", makes every point the review raises a reason to block, so the agent requests changes on most PRs it reviews: in production at the end of October it requested changes on about 80-90% of the PRs it reviewed each day, while maintainers requested changes on about 20% of the PRs they reviewed. torchtitan's pr-review skill instead sorts findings into must-fix and should-consider and approves when only small, local items remain. This replaces item 5 with "Separate blocking from non-blocking": a point is blocking when the PR should not land until it is fixed (a correctness or security bug, a backward-compatibility break, a design problem that needs another look once addressed, or an unaddressed maintainer comment); everything else worth mentioning is written as "non-blocking". The blocking list keeps every rule in this skill's files or an applicable REVIEW.md that says a point always blocks or defaults to Request Changes (a non-exempt CI install, a new non-conforming runner label, the decref-before-update hazard, a new weights_only allowlist entry), and says that a performance regression on a hot path blocks and that a missing test blocks only when the checklist or an applicable REVIEW.md requires it. Principle 7 now says a pattern mismatch within a file is always worth raising and blocks only when principle 5 says so, and review-checklist.md and ci-runner-naming.md no longer call those exceptions to "Everything is a must-fix". The Recommendation section now says to request changes only for a blocking point, to recommend Needs Discussion when the decision depends on maintainers (an open design question, or a potentially breaking change), and otherwise to approve when only non-blocking points remain, with those points kept in their own sections; the Time Budget's early-post rules come first. A contract test checks that SKILL.md still writes the "non-blocking" label stage B maps to `minor`. The rest of the pipeline already handles non-blocking points since #202634: stage B records a point labelled non-blocking as `minor`, a review whose points are all non-blocking becomes `ready_for_human_review`, and post_review.py folds minor findings into a collapsed section instead of posting them as blockers. Evaluation: 30 clean PRs (a maintainer approved without comments; merged, never reverted) from ciforge's clean_approved, balanced across areas, and the 30 dev-split PRs of recall_strong with 45 maintainer issues the author fixed before merge (one more dev PR was skipped as too large by both versions). Local runs with production's prompts and model, one review per PR, main against this change: | | main | This change | |---|---|---| | Clean PRs blocked | 25 of 30 | 11 of 30 | | Blocking findings on those PRs | 93 | 23 | | All findings on those PRs | 166 | 170 | | Maintainer issues found | 27 of 45 | 27 of 45 | | Maintainer issues found and marked blocking | 14 | 12 | | Defects found / marked blocking | 4 / 2 | 5 / 1 | The change reports as many findings and finds the same maintainer issues (24 found by both, 3 only by each), but grades most findings non-blocking, so it blocks 11 clean PRs instead of 25. It also grades some real defects non-blocking: of the 5 defects it found, it marked 1 blocking, against 2 of 4 for main. A maintainer issue counts as found when an LLM judge matches one of the agent's findings to it by root cause. The runs used an earlier version of this change, before the always-blocking rules, the Time Budget and Needs Discussion rules, the performance and missing-test grading and the principle 7 rewording were added. Test plan: ``` python3 -m unittest discover -s scripts/pr_review -t . ``` This PR was authored with the help of an AI assistant (Claude). ghstack-source-id: 8e5d417 Pull-Request: #203531
## Linked issue or supporting maintainer Related to #202634 (non-blocking points on re-reviews). ## BC-breaking? No. ## Summary (human written only) Clarify the severity issue vs everything must be blocking ## Agent details (if applicable) Review Philosophy 5, "Everything is a must-fix", makes every point the review raises a reason to block, so the agent requests changes on most PRs it reviews: in production at the end of October it requested changes on about 80-90% of the PRs it reviewed each day, while maintainers requested changes on about 20% of the PRs they reviewed. torchtitan's pr-review skill instead sorts findings into must-fix and should-consider and approves when only small, local items remain. This replaces item 5 with "Separate blocking from non-blocking": a point is blocking when the PR should not land until it is fixed (a correctness or security bug, a backward-compatibility break, a design problem that needs another look once addressed, or an unaddressed maintainer comment); everything else worth mentioning is written as "non-blocking". The blocking list keeps every rule in this skill's files or an applicable REVIEW.md that says a point always blocks or defaults to Request Changes (a non-exempt CI install, a new non-conforming runner label, the decref-before-update hazard, a new weights_only allowlist entry), and says that a performance regression on a hot path blocks and that a missing test blocks only when the checklist or an applicable REVIEW.md requires it. Principle 7 now says a pattern mismatch within a file is always worth raising and blocks only when principle 5 says so, and review-checklist.md and ci-runner-naming.md no longer call those exceptions to "Everything is a must-fix". The Recommendation section now says to request changes only for a blocking point, to recommend Needs Discussion when the decision depends on maintainers (an open design question, or a potentially breaking change), and otherwise to approve when only non-blocking points remain, with those points kept in their own sections; the Time Budget's early-post rules come first. A contract test checks that SKILL.md still writes the "non-blocking" label stage B maps to `minor`. The rest of the pipeline already handles non-blocking points since #202634: stage B records a point labelled non-blocking as `minor`, a review whose points are all non-blocking becomes `ready_for_human_review`, and post_review.py folds minor findings into a collapsed section instead of posting them as blockers. Evaluation: 30 clean PRs (a maintainer approved without comments; merged, never reverted) from ciforge's clean_approved, balanced across areas, and the 30 dev-split PRs of recall_strong with 45 maintainer issues the author fixed before merge (one more dev PR was skipped as too large by both versions). Local runs with production's prompts and model, one review per PR, main against this change: | | main | This change | |---|---|---| | Clean PRs blocked | 25 of 30 | 11 of 30 | | Blocking findings on those PRs | 93 | 23 | | All findings on those PRs | 166 | 170 | | Maintainer issues found | 27 of 45 | 27 of 45 | | Maintainer issues found and marked blocking | 14 | 12 | | Defects found / marked blocking | 4 / 2 | 5 / 1 | The change reports as many findings and finds the same maintainer issues (24 found by both, 3 only by each), but grades most findings non-blocking, so it blocks 11 clean PRs instead of 25. It also grades some real defects non-blocking: of the 5 defects it found, it marked 1 blocking, against 2 of 4 for main. A maintainer issue counts as found when an LLM judge matches one of the agent's findings to it by root cause. The runs used an earlier version of this change, before the always-blocking rules, the Time Budget and Needs Discussion rules, the performance and missing-test grading and the principle 7 rewording were added. Test plan: ``` python3 -m unittest discover -s scripts/pr_review -t . ``` This PR was authored with the help of an AI assistant (Claude). Pull Request resolved: #203531 Approved by: https://github.com/albanD, https://github.com/atalman
…the goalposts (pytorch#202634) ## Linked issue or supporting maintainer Part of pytorch/test-infra#9243 ## BC-breaking? No. ## Summary (human written only) Everytime the review agent is running, it introduces some new blockers regardless of what has been ficed and what has been asked by the author to ignore. ## Agent details (if applicable) On a re-review, the pr-review skill re-reviews the whole PR from scratch, and "Everything is a must-fix" turns every new observation into a blocker, so a PR whose author fixes each round's findings can still collect new blockers every round (pytorch/test-infra#9243; on pytorch#199555 the production review raised 1, 2, 2, 5, 6, 5, 4, 7, 5, 6, 7, 7, 6, 6, 7, 5 blocking findings over 16 rounds). This adds "Re-reviews converge" to "Earlier Automated Findings": settle the earlier blocking findings first (report one still present again as a continuing finding, drop one fixed or convincingly answered); review what changed since the last review in full; on code the last review covered and that has not changed since, raise a new blocking finding only for a defect with a concrete failure and say why it was not raised before; keep earlier non-blocking points non-blocking unless the code got worse or the concrete failure that rule requires can now be shown. Supporting changes in the same file: - The commit the last review saw comes from its body header ("Automated review of <sha>"), which every review has; `/tmp/pr-interdiff.txt` holds the changes since then when present, and modes with git can run `git diff <sha> HEAD`. Code whose change status the reviewer cannot tell is reviewed as changed, so a missing interdiff costs convergence, not recall. - "Covered" excludes files an earlier review named as not reviewed (early posts under the Time Budget) and code whose earlier findings were left out (`truncated`, or a body that says some findings did not fit); those get a first review, and so does the whole PR when the reviewer cannot tell which code an omitted finding was about. - An unaddressed maintainer comment still always blocks, whatever code it is on. - "Everything is a must-fix" now says exceptions are marked where they apply (runner naming and workflow REVIEW.md advisories already are) and names re-reviews among them, and the skill says to write "non-blocking" in such points, keep them out of the Recommendation's justification, and not recommend Request Changes when only non-blocking points remain. Without that, stage B and post_review.py post every finding as blocking under a Request Changes verdict. - With fan-out (pytorch#202952), the four reviewer sub-agents review the full diff and do not apply these rules, so the main agent does: on a re-review each reviewer marks its candidates as on changed or unchanged code, Step 4 applies "Re-reviews converge" to every merged finding before writing it up, and Step 5's fact-check requires rule 3's concrete failure for a new blocking finding on covered code. - Stage B's prompt says a point the review labels non-blocking is minor, never major, and that a review whose points are all non-blocking gets ready_for_human_review even under Request Changes, so a non-blocking point is never posted as a blocker, whatever the Recommendation. Evaluation: local replays of pytorch#199555 rounds 9-11 with production's prompts and models, 3 runs each, every round given the previous round's findings from the same run, as production gives them. Blocking findings in rounds 10 and 11, compared with that run's previous review (matched by an LLM judge): | | Round 10 (author added code) | Round 11 (10 changed lines) | |---|---|---| | Today's skill | 7: 2 new, 2 previously non-blocking | 7: 1 new, on unchanged code | | This change, with an interdiff | 8: 4 new, all on the code added in that round | 8: 0 new, 0 previously non-blocking | The hardened workflow does not provide `/tmp/pr-interdiff.txt` yet; without it the skill compares the earlier findings' code with HEAD. Providing it is a follow-up. One PR and three runs: a signal, not a measurement. Test plan: ``` python3 -m unittest discover -s scripts/pr_review -t . lintrunner -a .agents/skills/pr-review/SKILL.md ``` This PR was authored with the help of an AI assistant (Claude). Pull Request resolved: pytorch#202634 Approved by: https://github.com/izaitsevfb
…view (pytorch#202667) ## Linked issue or supporting maintainer Part of pytorch/test-infra#9243 ## BC-breaking? No. ## Summary (human written only) Pass the differences between PR after addressing some previous review feedback ## Agent details (if applicable) The previous PR in this stack tells re-reviews to settle their earlier findings and review what changed since the last review, reading `/tmp/pr-interdiff.txt` when present. This provides that file. Without it the review sees only the PR's full diff against its base, which does not say which lines are new since its last review, so a re-review reviews all of them again. - `fetch_pr_comments.py` adds `previous_review_sha` to its output: the commit the latest automated review saw (`commit_id` of the review it already selects), empty without one. A re-run on the same commit gets a "nothing changed" note. - `prepare` passes it on as an output, validated as a 40-hex SHA or empty, together with that commit's merge base with the PR's base, resolved by the compare endpoint on complete history like this run's merge base (empty if the commit is gone). - A new `review` step, after the size gate and before any credential, fetches those two commits (depth 1, as for the merge base) and runs the new `scripts/pr_review/interdiff.py` from the trusted checkout, which writes `/tmp/pr-interdiff.txt`. Diffing the earlier commit against HEAD would show a rebase's upstream changes to the PR's files as the author's, and ghstack PRs are rebased often. So the script replays the earlier version onto this run's merge base with `git merge-tree` (explicit merge base, no checkout, no shared history needed) and diffs HEAD against that, so upstream changes cancel out. A file the replay cannot merge changed both upstream and in the PR; it gets the plain diff under a heading saying it includes upstream changes. No earlier review, an unavailable commit, no changed files, any failure or a result over `MAX_DIFF_BYTES` give a one-line note instead, so the model's read rule always resolves and the review never fails for this file. File names are literal pathspecs and are decoded losslessly, so a non-UTF-8 name cannot fail the step. `interdiff.py` is part of the prompt hash, like `fetch_pr_comments.py`. - Stage A may read the file (`Read(//tmp/pr-interdiff.txt)`), and the Offline prompt names it. The contract tests pin the new read rule, list `interdiff.py` among the trusted programs the review job runs, and model `PREVIOUS_REVIEW_SHA` and `PREVIOUS_MERGE_BASE_SHA` as plain values, like `MERGE_BASE_SHA`. `test_interdiff.py` covers a rebase (upstream changes left out), a file changed on both sides, no rebase, a re-run on the same commit, the notes, an unexpected failure, the size cap, pathspec-like file names (the test fails without `--literal-pathspecs`) and a non-UTF-8 file name. Renames since the last review show up as new files; detecting them is a follow-up. Evaluation: replaying pytorch#199555 rounds 9-11 locally (3 runs each), re-reviews given an interdiff and the previous PR's skill raised 0 new and 0 previously non-blocking blocking findings in round 11, against 1 new with today's skill (see the previous PR). The step was also run on that PR's real commits. Round 10 -> 11 was a rebase: a plain diff of the two commits showed 10 changed lines in 5 files, all of them changes the base made; the rebase-aware interdiff shows none of those, plus the one file both sides changed (965 bytes instead of 9 KB). It wrote notes for no earlier review and an unavailable commit, and failed on a malformed SHA. Test plan: ``` python3 -m unittest discover -s scripts/pr_review -t . lintrunner -a .github/workflows/hardened-pr-review-run.yml scripts/pr_review/*.py ``` actionlint was not run locally (its binary could not be downloaded here); CI runs it. This PR was authored with the help of an AI assistant (Claude). Pull Request resolved: pytorch#202667 Approved by: https://github.com/izaitsevfb ghstack dependencies: pytorch#202634
) ## Linked issue or supporting maintainer Related to pytorch#202634 (non-blocking points on re-reviews). ## BC-breaking? No. ## Summary (human written only) Clarify the severity issue vs everything must be blocking ## Agent details (if applicable) Review Philosophy 5, "Everything is a must-fix", makes every point the review raises a reason to block, so the agent requests changes on most PRs it reviews: in production at the end of October it requested changes on about 80-90% of the PRs it reviewed each day, while maintainers requested changes on about 20% of the PRs they reviewed. torchtitan's pr-review skill instead sorts findings into must-fix and should-consider and approves when only small, local items remain. This replaces item 5 with "Separate blocking from non-blocking": a point is blocking when the PR should not land until it is fixed (a correctness or security bug, a backward-compatibility break, a design problem that needs another look once addressed, or an unaddressed maintainer comment); everything else worth mentioning is written as "non-blocking". The blocking list keeps every rule in this skill's files or an applicable REVIEW.md that says a point always blocks or defaults to Request Changes (a non-exempt CI install, a new non-conforming runner label, the decref-before-update hazard, a new weights_only allowlist entry), and says that a performance regression on a hot path blocks and that a missing test blocks only when the checklist or an applicable REVIEW.md requires it. Principle 7 now says a pattern mismatch within a file is always worth raising and blocks only when principle 5 says so, and review-checklist.md and ci-runner-naming.md no longer call those exceptions to "Everything is a must-fix". The Recommendation section now says to request changes only for a blocking point, to recommend Needs Discussion when the decision depends on maintainers (an open design question, or a potentially breaking change), and otherwise to approve when only non-blocking points remain, with those points kept in their own sections; the Time Budget's early-post rules come first. A contract test checks that SKILL.md still writes the "non-blocking" label stage B maps to `minor`. The rest of the pipeline already handles non-blocking points since pytorch#202634: stage B records a point labelled non-blocking as `minor`, a review whose points are all non-blocking becomes `ready_for_human_review`, and post_review.py folds minor findings into a collapsed section instead of posting them as blockers. Evaluation: 30 clean PRs (a maintainer approved without comments; merged, never reverted) from ciforge's clean_approved, balanced across areas, and the 30 dev-split PRs of recall_strong with 45 maintainer issues the author fixed before merge (one more dev PR was skipped as too large by both versions). Local runs with production's prompts and model, one review per PR, main against this change: | | main | This change | |---|---|---| | Clean PRs blocked | 25 of 30 | 11 of 30 | | Blocking findings on those PRs | 93 | 23 | | All findings on those PRs | 166 | 170 | | Maintainer issues found | 27 of 45 | 27 of 45 | | Maintainer issues found and marked blocking | 14 | 12 | | Defects found / marked blocking | 4 / 2 | 5 / 1 | The change reports as many findings and finds the same maintainer issues (24 found by both, 3 only by each), but grades most findings non-blocking, so it blocks 11 clean PRs instead of 25. It also grades some real defects non-blocking: of the 5 defects it found, it marked 1 blocking, against 2 of 4 for main. A maintainer issue counts as found when an LLM judge matches one of the agent's findings to it by root cause. The runs used an earlier version of this change, before the always-blocking rules, the Time Budget and Needs Discussion rules, the performance and missing-test grading and the principle 7 rewording were added. Test plan: ``` python3 -m unittest discover -s scripts/pr_review -t . ``` This PR was authored with the help of an AI assistant (Claude). Pull Request resolved: pytorch#203531 Approved by: https://github.com/albanD, https://github.com/atalman
Stack from ghstack (oldest at bottom):
Linked issue or supporting maintainer
Part of pytorch/test-infra#9243
BC-breaking?
No.
Summary (human written only)
Everytime the review agent is running, it introduces some new blockers regardless of what has been ficed and what has been asked by the author to ignore.
Agent details (if applicable)
On a re-review, the pr-review skill re-reviews the whole PR from scratch, and "Everything is a must-fix" turns every new observation into a blocker, so a PR whose author fixes each round's findings can still collect new blockers every round (pytorch/test-infra#9243; on #199555 the production review raised 1, 2, 2, 5, 6, 5, 4, 7, 5, 6, 7, 7, 6, 6, 7, 5 blocking findings over 16 rounds).
This adds "Re-reviews converge" to "Earlier Automated Findings": settle the earlier blocking findings first (report one still present again as a continuing finding, drop one fixed or convincingly answered); review what changed since the last review in full; on code the last review covered and that has not changed since, raise a new blocking finding only for a defect with a concrete failure and say why it was not raised before; keep earlier non-blocking points non-blocking unless the code got worse or the concrete failure that rule requires can now be shown.
Supporting changes in the same file:
/tmp/pr-interdiff.txtholds the changes since then when present, and modes with git can rungit diff <sha> HEAD. Code whose change status the reviewer cannot tell is reviewed as changed, so a missing interdiff costs convergence, not recall.truncated, or a body that says some findings did not fit); those get a first review, and so does the whole PR when the reviewer cannot tell which code an omitted finding was about.Evaluation: local replays of #199555 rounds 9-11 with production's prompts and models, 3 runs each, every round given the previous round's findings from the same run, as production gives them. Blocking findings in rounds 10 and 11, compared with that run's previous review (matched by an LLM judge):
The hardened workflow does not provide
/tmp/pr-interdiff.txtyet; without it the skill compares the earlier findings' code with HEAD. Providing it is a follow-up. One PR and three runs: a signal, not a measurement.Test plan:
This PR was authored with the help of an AI assistant (Claude).