Skip to content

[pr-review] Block approval on bugs and violated rules, not style - #203308

Closed
izaitsevfb wants to merge 5 commits into
mainfrom
iz2/pr-review-min-blocking
Closed

izaitsevfb wants to merge 5 commits into
mainfrom
iz2/pr-review-min-blocking

Conversation

@izaitsevfb

@izaitsevfb izaitsevfb commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

✴️ 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.md rule 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.

main this PR
should block: a human confirmed the issue (9 cases, 8 PRs), blocked 9 of 9 9 of 9
should pass: a human called the blocking finding a nit (27 PRs), blocked 52 of 54 30 of 54
… blocked on the finding the human called a nit 35 of 54 16 of 54
approved, nobody judged the findings (7 PRs), blocked 14 of 14 10 of 14

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).

✴️ 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).
@izaitsevfb
izaitsevfb requested a review from a team as a code owner November 4, 2026 00:56
@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Nov 4, 2026
@pytorch-bot

pytorch-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

PR Status: in progress

A 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 @pytorchbot review. To bypass automated review, please add the “no automated review” label.

🟡 AUTOMATED REVIEW - Changes requested:

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.

Findings (5):

[major] .agents/skills/pr-review/SKILL.md:122
@​ 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.

[minor] .agents/skills/pr-review/SKILL.md:122
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.

[minor] .agents/skills/pr-review/SKILL.md:122
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.

[minor] .agents/skills/pr-review/review-checklist.md:169
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.

[minor] scripts/pr_review/test_workflow_contract.py:5801
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`.

Reviewed commit: 8faa801

Review run

🐛 Report a bad review

🔗 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 Failures

As of commit 8faa801 with merge base 2501aef (image):
💚 Looks good so far! There are no failures yet. 💚

🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:

  • Never trivial: alters review policy
    • .agents/skills/pr-review/SKILL.md principle 5 drops 'no nits' and adds a rule on what blocks approval
    • Text that adds or changes a rule or restriction is policy, not prose describing code
  • Steers an automated reviewer
    • The prompt in .github/workflows/hardened-pr-review-run.yml Stage B now excludes non-blocking fixes from changes_requested
    • Changes what the bot's review verdicts are, so the people who rely on them should see it
  • Tests
    • scripts/pr_review/test_workflow_contract.py only checks that the new sentence appears in the prompt

reason: not_trivial
Reviewed commit: 54e46b8 (NOT the current head 8faa801)

Inference job

🐛 Report a wrong verdict

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorchgreenlight pytorchgreenlight Bot added the GL/human GreenLight marked as needing human review label Nov 4, 2026
@pytorchbot pytorchbot added the in progress PR is being worked on by the author, until the automated review accepts it label Nov 4, 2026

@huydhn huydhn left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dealing with an endless stream of request changes from the bot has been a major pain in adopting this process, so I'm all in favour to have this in place. Maybe it's not perfect yet, but it's still more usable than what is currently used IMO

github-actions[bot]

This comment was marked as outdated.

Comment thread .agents/skills/pr-review/SKILL.md Outdated
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

running a wider eval now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✴️ 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).
@izaitsevfb izaitsevfb changed the title [pr-review] Only bugs and violated policies block approval [pr-review] Block approval on bugs and violated rules, not style Nov 4, 2026
@pytorchgreenlight pytorchgreenlight Bot added GL/superseded GreenLight review is superseded by changes and removed GL/human GreenLight marked as needing human review labels Nov 4, 2026
github-actions[bot]

This comment was marked as outdated.

@github-actions
github-actions Bot dismissed their stale review November 4, 2026 21:38

Withdrawn: the automated review of d338c8e found nothing blocking.

@pytorch-bot pytorch-bot Bot added ready for review Automated review passed, ready for a final review by a maintainer. and removed in progress PR is being worked on by the author, until the automated review accepts it labels Nov 4, 2026

@albanD albanD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From offline discussion this was superseeded by Bita's other PR right?

@pytorch-bot pytorch-bot Bot added in progress PR is being worked on by the author, until the automated review accepts it and removed ready for review Automated review passed, ready for a final review by a maintainer. labels Nov 5, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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.

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.


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.

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.


- [ ] **Runner naming standard** — PR adds or changes a runner label, or adds CI that inherits one from an input, matrix or dispatch default or option, and the label breaks the runner naming standard in [ci-runner-naming.md](ci-runner-naming.md). If no other CI in this repo uses that label, this always means **Request Changes**; if other CI already uses it, give a short non-blocking heads-up instead (an exception to "Blockers should block")

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.


def test_the_exceptions_name_principle_5_by_its_title(self):

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 @ 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.

Report this finding

@izaitsevfb

Copy link
Copy Markdown
Contributor Author

From offline discussion this was superseeded by Bita's other PR right?

correct

@izaitsevfb izaitsevfb closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GL/superseded GreenLight review is superseded by changes in progress PR is being worked on by the author, until the automated review accepts it topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants