Repository navigation
[pr-review] Block approval on bugs and violated rules, not style - #203308
izaitsevfb wants to merge 5 commits into
Conversation
✴️ iz2: Two prompt changes so the automated review blocks on bugs, not on style.
- Skill principle 5 ("Everything is a must-fix") drops "There are no nits" and adds one sentence: only a bug,
including a test that cannot fail, or a violated applicable policy or `REVIEW.md` rule blocks approval; style,
structure or test coverage lean non-blocking. The title and other sentences stay, so the two references to it as
an exception (review-checklist.md, ci-runner-naming.md) still read correctly.
- Stage B: a fix the review itself treats as non-blocking (a docstring, comment or naming fix) is not "a defect
that must be fixed before approval". Since #202455 such Needs Discussion reviews became changes_requested.
Offline replay, pipeline before #202952, 51 PR revisions: on maintainer-approved PRs blocked runs went from 69%
(main) to 28% with this wording (1 run each; 19% over 2 runs without the test clause); on reviews reported as
nit-blocking, 86% to 55% (41%). Known defects reported as blocking: 4 of 6 runs, main 10 of 12. On today's
pipeline the test clause kept a known cannot-fail test blocking in 3 of 3 runs, where the wording without it did
not. The stage B line blocked 1 of 10 re-maps of docstring- or design-only reviews (7 of 10 without it) and all 10
that named a concrete code problem.
Evaluation: https://gist.github.com/izaitsevfb/907f158af97086f2b80529f535c41a9d
Test plan: `python3 -m unittest discover -p 'test_*.py'` in scripts/pr_review (551 pass).
PR Status: in progressA maintainer requested changes. Please address their feedback before the PR returns to maintainer review. To become ready for review, the change must pass automated review and every maintainer comment must be addressed, either with a code change or a reply explaining why no change is needed. Any running CI must finish and every failure must be classified as unrelated to your PR (see status below in this comment). To minimize iteration time, feel free to run the pr-review skill from the repo locally. If an automated review comment is irrelevant, react with 👎 on that specific comment to reject it, and leave a short reply explaining why. To trigger a fresh automated review, make a new push or comment 🟡 AUTOMATED REVIEW - Changes requested:
Findings (5): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/203308
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 8faa801 with merge base 2501aef ( 🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:
reason: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| 3. **Review the design, not just the implementation** — A PR can have perfectly correct implementation of a bad design. Question side-channel communication, on/off private flags, and demand concrete interface documentation for new contracts between components. | ||
| 4. **Focus on what CI cannot check** — Don't comment on formatting, linting, type errors, or CI failures. Focus on design quality, interface correctness, thread safety, BC implications, test patterns, and pattern adherence. | ||
| 5. **Everything is a must-fix** — There are no "nits." If it's worth mentioning, it's worth fixing. Every inconsistency degrades the codebase over time. | ||
| 5. **Everything is a must-fix** — If it's worth mentioning, it's worth fixing. Every inconsistency degrades the codebase over time. But only a bug, including a test that cannot fail, or a violated applicable policy or `REVIEW.md` rule blocks approval; style, structure or test coverage lean non-blocking. |
There was a problem hiding this comment.
humm my assumption is that the phrasing here is too round about and agents can get indecise.
I would rephrase this entirely, like:
5. **Blockers should block** - a bug, including a test that cannot fail, or a violated applicable policy or `REVIEW.md` rule blocks approval; style, structure or test coverage lean non-blocking
sounds more reasonable to me
There was a problem hiding this comment.
it performs worse on the small eval:
The spot test with ground truth added (B = blocked, R = sent to human review):
| case | truth | Jean | PR + maintainer clause | main |
|---|---|---|---|---|
| Alban's miss | bug | B | B | B |
| HUD retry | bug | B | B | B |
| test that cannot fail | bug | B | B | B |
| int32 truncation | bug | B | running | running |
| 200730 | clean | R | R | B |
| ob-201773 | clean | R | R | B |
| 197338 | clean | B | R | B |
| ob-201926 | clean | B | B | B |
There was a problem hiding this comment.
running a wider eval now
There was a problem hiding this comment.
✴️ iz2: A wider eval reversed the small one. On today's two-stage pipeline, labelled by what people said about each finding: on 9 PRs where a human confirmed a bug or asked for changes, "Blockers should block" blocked all 9, like main. On the 3 PRs where a human called the blocking finding a nit and every wording ran, it blocked 3 of 6 runs; the earlier wording blocked 6 of 6. Switched principle 5 to it in d338c8e.
✴️ iz2: The automated review pointed out that "such as a docstring, comment or naming fix" exempts whole categories, including a public rename that breaks BC. The exception now covers documentation, comment or code-structure fixes the review does not tie to a bug or a violated rule. Re-mapping the 10 runs where the #202455 path decided the verdict, twice each: the one known real defect stayed blocking 2 of 2; blocks on maintainer-approved or nit-reported PRs went from 15 of 18 (current stage B) to 8 of 18. A "docstring or comment fix the review treats as non-blocking" variant leaked the real defect once, since an Approve review reads as treating everything as non-blocking. Test plan: `python3 -m unittest discover -p 'test_*.py'` in scripts/pr_review (551 pass).
…rding ✴️ iz2: Principle 5 now reads "Blockers should block — a bug, including a test that cannot fail, or a violated applicable policy or `REVIEW.md` rule blocks approval; style, structure or test coverage lean non-blocking" (suggested in review). It drops the "must-fix" title the body contradicted and the "only" that made the list exclusive, so rules elsewhere that always mean Request Changes still apply. The two exceptions that named the old title now name the new one; a contract test pins the title in all three places. Replay of the two-stage pipeline with this commit's stage B, 19 borderline PR revisions, 1 run each: clean PRs blocked 4 of 10 (main 10 of 10, the previous wording plus an always-Request-Changes clause 7 of 10); known-bug PRs blocked 7 of 7, on the known bug in 6 of 6 checked. Test plan: `python3 -m unittest discover -p 'test_*.py'` in scripts/pr_review (552 pass; the new test fails on the previous principle 5).
Withdrawn: the automated review of d338c8e found nothing blocking.
albanD
left a comment
There was a problem hiding this comment.
From offline discussion this was superseeded by Bita's other PR right?
There was a problem hiding this comment.
Automated review of 8faa801: changes requested before human review.
The PR renames pr-review principle 5 from "Everything is a must-fix" to "Blockers should block", updates the two places that cite it by title, and adds a contract test for those citations. Recommendation: Request Changes. The one blocker is a maintainer's change request asking whether a superseding PR replaces this one, which has had no reply; every other point is non-blocking.
🔴 1 blocking finding is attached to the code below.
⚪ 4 non-blocking findings
pytorch/.agents/skills/pr-review/SKILL.md
Line 122 in 8faa801
Non-blocking, plausible rather than confirmed: a first review is never told to label the points principle 5 makes non-blocking. Principle 5 says style, structure or test coverage "lean non-blocking", but the only instruction to write "non-blocking" on a point, or to avoid Request Changes when only such points remain, is at SKILL.md:168, inside "Re-reviews converge", which applies only when there is an earlier automated review (:161). Stage B (hardened-pr-review-run.yml:1088-1090, :1100-1101) counts a point as minor only when the review labels it non-blocking; otherwise any "defect that must be fixed before approval" gives changes_requested (:1085-1086). Failure case: on a first review, Stage A writes a coverage or structure point as "should be fixed before merge" without the label, and Stage B maps it to changes_requested/major, the over-blocking this PR is meant to remove. Fix: move the :168 paragraph out of "Re-reviews converge" so it applies to every review, or repeat its two sentences in principle 5. This carries forward the last review's point asking for one blocker vocabulary shared by Stage A and Stage B.
pytorch/.agents/skills/pr-review/SKILL.md
Line 122 in 8faa801
Non-blocking, low confidence: "applicable policy" is still not defined in the skill. The earlier finding about "only" is fixed, but the undefined term was not addressed. BC breaks may be covered by the "[BC policy]" link at bc-guidelines.md:58. Security issues are not named, though re-review rule 3 (:165) lists "a security or backward-compatibility break" as a concrete failure. A public rename without deprecation (bc-guidelines.md:17) can now be read as "naming/style, leans non-blocking". Fix: add BC breaks and security issues to the list of blockers.
Non-blocking, wording consistency: review-checklist.md:258 (unchanged, so anchored here) still says "This is always a must-fix". That term came from the old principle 5 title, which this PR removes. The item describes a data race, so it still blocks as a bug. Rewording it to "always blocks approval" would match the new vocabulary.
Non-blocking: the new test is in the wrong class and only checks part of the contract. test_the_exceptions_name_principle_5_by_its_title is in TestStageBMapsPrReviewsReview, whose docstring (:5715-5716) is about Stage B mapping and whose setUp (:5718-5720) parses the Stage B step, which this test never uses. A Stage B parsing break would make it error for an unrelated reason. It also asserts the new title in two hard-coded files but does not check that the old title "Everything is a must-fix" is gone from the skill files, so a future file citing the old title would still pass. Fix: move it to its own small class, and scan .agents/skills/pr-review/*.md for the stale title, with each file's check in subTest.
Please address the findings and push; a new commit normally gets a fresh automated review.
Disagree with a finding? Reply with your reasoning, then comment @pytorchbot review to request a re-review. This review is AI-generated and advisory. Each new automated review replaces the previous one. Report a bad review
| 3. **Review the design, not just the implementation** — A PR can have perfectly correct implementation of a bad design. Question side-channel communication, on/off private flags, and demand concrete interface documentation for new contracts between components. | ||
| 4. **Focus on what CI cannot check** — Don't comment on formatting, linting, type errors, or CI failures. Focus on design quality, interface correctness, thread safety, BC implications, test patterns, and pattern adherence. | ||
| 5. **Everything is a must-fix** — There are no "nits." If it's worth mentioning, it's worth fixing. Every inconsistency degrades the codebase over time. Exceptions are marked where they apply; on a re-review, "Re-reviews converge" makes some points non-blocking. | ||
| 5. **Blockers should block** — a bug, including a test that cannot fail, or a violated applicable policy or `REVIEW.md` rule blocks approval; style, structure or test coverage lean non-blocking. On a re-review, "Re-reviews converge" makes some points non-blocking. |
There was a problem hiding this comment.
🔴 @ albanD (maintainer) left a CHANGES_REQUESTED review asking: "From offline discussion this was superseeded by Bita's other PR right?" Nobody has replied, and the PR has the GL/superseded label. The author needs to say whether this PR is still needed or should be closed in favour of the other PR.
correct |
✴️ iz2: A prompt change so the automated review blocks on bugs, not on style.
Skill principle 5 becomes Blockers should block — a bug, including a test that cannot fail, or a violated applicable policy or
REVIEW.mdrule blocks approval; style, structure or test coverage lean non-blocking (@jeanschmidt's wording). It keeps main's pointer to "Re-reviews converge" (#202634). The two exceptions that cited the old title (review-checklist.md, ci-runner-naming.md) now cite this one. Stage B (the verdict step in hardened-pr-review-run.yml) is unchanged.Offline replay of the two-stage pipeline on 43 cases, labelled by what people said about each finding (should-block cases 1 run each, the rest 2 runs each). Every run, including main's, replays main before #202634, so current main may block less on re-reviews.
An AI judge accepts at least one finding as a real blocker in 15 of main's 52 should-pass blocks and 14 of this PR's 30. On the approved-but-unjudged PRs it thinks 5 of 7 had a real blocker, so some of this PR's 4 extra passes there may be misses. The "this PR" runs used a stage B with one extra exception; every passing run was re-run through main's stage B, which this PR keeps, and 1 of 29 flipped to blocked (counted above). Replayed on this PR itself: main requests changes in 2 of 2 runs, and so does this wording with main's stage B.
Evaluation, per case: https://gist.github.com/izaitsevfb/907f158af97086f2b80529f535c41a9d
Test plan:
python3 -m unittest discover -p 'test_*.py'in scripts/pr_review (638 pass).