Skip to content

[review] Make the AI review catch what maintainers block on; code-owner override; agent self-review; rl/transport - #6407

Merged
tianyu-l merged 3 commits into
mainfrom
review-skill-v2
Nov 26, 2026
Merged

tianyu-l merged 3 commits into
mainfrom
review-skill-v2

Conversation

@tianyu-l

@tianyu-l tianyu-l commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary (human-written)

Why

Since #5667, @claude review has reviewed 459 PRs. Of the 380 PRs it approved,
30 then got a formal "request changes" from a maintainer, and about 20 more got
substantive inline asks. In nearly all of them the bot either saw the problem
and approved anyway, or never asked the questions maintainers ask most ("does
the repo already do this?", "who should own this?"). The opposite failure, the
bot blocking something a maintainer was fine with, is rare: in the PRs we
sampled, 2 of its 81 must-fix items were wrong and about a third were minor
(the empty human-written summary was the biggest source).

Example (#6112, controller sizes the rollout worker pool):

before: bot approved 10 times; tianyu-l then blocked: "the controller reads
        rollouter.rollouts_per_worker to compute a count it hands back to the
        Rollouter -- violates encapsulation"
after:  same commit, new skill -> Request changes, must-fix #1:
        "controller.py:589 -- wrong owner for the worker count ..."

There was also no way for a code owner to overrule the bot except dismissing
its review in the GitHub UI, and a later @claude review again would block
again.

What changed

Review skill (.claude/skills/pr-review/, review-checklist.md):

  • Verdict rules: Approve only when every remaining item is an edit the bot
    could write itself. Anything the author still owes (a design change, an
    unexplained golden change, evidence the PR rests on) is Request changes;
    anything only a maintainer can decide is Needs discussion. A hedge like "a
    maintainer should decide" can't come with Approve.
  • Always must-fix: a violated written rule, a silent wrong result, a second
    definition of an existing concept, a gate finding.
  • Design gate: new questions for the existing counterpart, in-repo ownership,
    and the design behind a bug; "ban only what doesn't work on main"; read the
    numbers behind a claim. The overlapping-PR search is mandatory and reported.
  • Re-review covers every commit since the last full review, including code
    taken from the bot's own suggestions. A scoped question gets a COMMENT, not
    a whole-PR verdict.
  • The bot fact-checks its own proposed fixes, and cites a source for claims
    about external tools or marks them unverified (never must-fix).
  • An empty "Summary (human-written)" is a one-line "Before merge" note that
    never affects the verdict.
  • Checklist: config ownership direction, general shared wrappers, dead code the
    PR creates, model variants as flavors, a mechanical pass over every new or
    changed function.

Code owner override (SKILL.md, claude-code.yml, CONTRIBUTING.md): a
code owner comments @claude override (optionally @claude override 2,3: <reason>); the bot approves if nothing else is open and doesn't re-raise the
overridden items. A code owner's GitHub approval or "LGTM" is not an override,
so a teammate can approve without the bot dropping its findings. Dismissing the
bot's review still unblocks the PR, but isn't an override: the bot can't tell
who dismissed it.

Agent self-review (CLAUDE.md, pr-description): an agent preparing a PR
runs pr-review in branch mode first and records unaddressed items in an
optional "Self-review" section. PRs written without an agent are unaffected; a
missing section is never a finding.

Where each new rule comes from (maintainer asks the bot missed):

Change PRs
No Approve with open design/evidence items or a "maintainer should decide" hedge #6007, #5837, #5997, #5712, #5511, #5996
Author waiver can't clear a must-fix #6201, #6202, #6203
Existing counterpart; one source of truth #5228, #6169, #5881, #5823, #5824, #6059, #5812
Responsibility owner; config ownership direction #6112, #6332, #5802, #5803, #6325
Fix the design behind the bug; a TODO doesn't justify a workaround #5572, #5689, #5657
Fact-check the bot's own suggested fixes #5740, #5802, #5511, #4819, #5543
Re-review covers all new commits; scoped asks don't approve #5824, #5842
Mandatory overlap search #5885, #6248
Ban only what doesn't work on main #5543
Summary placeholder no longer a must-fix #6119, #6174, #6112, #5868

Rules: design.md gets the one-general-wrapper rule (moved from
models.md, whose glob skipped torchtitan/rl), thin adapters, and the
consumer owning its values; config.md gets ownership direction and "a Config
doesn't read runtime state"; direction.md calls all-to-all the MoE reference
implementation, so a new vendor-specific dispatch path (e.g. #6242) needs a
reason the existing backends can't serve.

Area reviewers: .ci/ -> huydhn, wwwjn; torchtitan/rl/transport/ -> d4l3k.

Mechanical, skim: torchtitan/rl/transport/ holds data movement between RL
actors.

  • rl/model_state_dict_transport.py -> rl/transport/model_state_dict.py
  • rl/MODEL_STATE_DICT_TRANSPORT.md -> rl/transport/MODEL_STATE_DICT_TRANSPORT.md
  • rl/trainer/rdma_microbatch.py -> rl/transport/rdma_microbatch.py
  • tests: tests/rl/unit_tests/cpu/test_{model_state_dict_transport,rdma_microbatch}.py
    -> tests/rl/unit_tests/cpu/transport/test_{model_state_dict,rdma_microbatch}.py
  • imports, READMEs and scripts/install_rl_env.sh updated; no code changes.

User-facing changes

Before After
Overrule the bot: dismiss its review in the UI, and it blocks again on the next run @claude override [items]: <reason>; the bot approves and doesn't re-raise them
Empty human-written summary: bot must-fix One "Before merge" line, no effect on the verdict
from torchtitan.rl.model_state_dict_transport import ... from torchtitan.rl.transport.model_state_dict import ...
from torchtitan.rl.trainer.rdma_microbatch import ... from torchtitan.rl.transport.rdma_microbatch import ...

Testing

Backtest: the new skill run locally (nothing posted) on each PR at the commit
and thread state the bot originally saw.

PR Bot then New skill What the maintainer asked
#6112 Approve Request changes worker-count ownership (caught)
#5837 Approve Request changes apply to dp_shard too (caught)
#5572 Approve Request changes delete the injection design (caught)
#6201 Approve after author waived pins Request changes, waiver ignored pins broke GPU tests after merge (caught)
#6007 Approve Request changes fold K3.1 into K3 (caught)
#5543 Request changes: "ban it" Request changes: keep main's path don't break gpt-oss + DeepEP (fixed)
#6144, #5905 (controls) Approve Approve --
#6137 (control) Approve Needs discussion -- (merge gate on an upstream API)

Code owner override, simulated on #6201: override by a code owner lifts the
named item; @claude override from the author changes nothing; a code owner's
"LGTM" approval followed by "review again" keeps Request changes.

Transport move: 83 RL CPU unit tests pass locally
(transport/test_model_state_dict.py, test_trainer.py,
test_engine_loop.py). transport/test_rdma_microbatch.py, test_generator.py and
test_batcher_actor.py fail to collect in my env on origin/main too (stale
attention-gym / Monarch), so CI is the check for those.

Known issues / follow-ups

Self-review

pr-review (branch mode) at ad905a5: Needs discussion. Fixed: branch mode diffs
against origin/main and skips description findings before a description
exists; the "Config doesn't read runtime state" rule no longer contradicts
hardware validation; dismissal dropped as an override form (the bot can't tell
who dismissed); test_rdma_microbatch.py added to the transport area. Not
addressed:

  • One concern per PR -- the five changes ship together at the maintainer's
    request.
  • Open PRs touching the moved files -- listed above; the maintainer will
    coordinate.

@pytorch-bot pytorch-bot Bot added ciflow/fake-pg Run 1-GPU Fake PG integration tests ciflow/rl labels Nov 26, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 26, 2026
@github-actions
github-actions Bot requested a review from pzhan9 November 26, 2026 06:36
@tianyu-l

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @tianyu-l's task in 3m 57s —— View job


Verdict: Needs discussion -- see the review on #6407.

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

Verdict: Needs discussion -- the skill and override changes need two wording fixes, but whether the rl/transport/ move ships in this PR is a scope and placement decision for maintainers.

What this PR does.

  • Tightens the review skill so the bot stops approving PRs that still have open design or evidence items.
  • Adds a @claude override that lets a code owner overrule the bot's findings.
  • Asks agents to self-review before opening a PR.
  • Moves model_state_dict_transport.py and rdma_microbatch.py into a new torchtitan/rl/transport/ package, and adds area reviewers for it and for .ci/.

Example.

before: bot posts REQUEST_CHANGES; a code owner disagrees -> dismiss in the UI;
        the next "@claude review" blocks again
after:  code owner comments "@claude override 2: tracked in #NNNN"
        -> bot lists the open items, marks #2 overridden,
           APPROVEs if nothing else is open, and doesn't re-raise #2 later
move:   from torchtitan.rl.trainer.rdma_microbatch import RDMAMicrobatch
     -> from torchtitan.rl.transport.rdma_microbatch import RDMAMicrobatch

Must fix

  1. The "Summary (human-written)" section is empty. The skill on main treats that as a must-fix; this PR would turn it into a "Before merge" note. Either way, fill it in before merge.

  2. The rl/transport/ move is a separate concern bundled into a review-skill PR (CLAUDE.md PR Expectations: "One concern per PR"), and its placement goes against design.md:

    • rdma_microbatch.py is used only by rl/trainer/batcher.py and rl/trainer/trainer.py, plus their tests and Monarch wrappers. The move takes it out of its consumers' package.
    • The new folder holds two .py files, and design.md:60 says "Flatten folders that hold one or two files."
    • The case for the folder rests on #6309's delta transport, which hasn't landed. The new Step 2.7 text calls that kind of justification out.
    • #6309 and #6237 are editing rl/model_state_dict_transport.py right now.

    The self-review's reason ("at the maintainer's request") is a process reason, not an argument that the rule doesn't apply. Smallest fix: drop the move and the rl_transport area from this PR, and land them in their own PR coordinated with #6309. If maintainers want it here, they should say so on the PR.

  3. .claude/skills/pr-review/SKILL.md:367 -- an override is accepted from a code owner of any changed file, so an area owner can override findings on core files. It should require a code owner of every changed file, as branch protection does (inline).

  4. .claude/skills/pr-review/SKILL.md:383 -- the override flow approves without reviewing commits pushed after the last full review (inline).

Should consider

  • .claude/skills/pr-review/SKILL.md:424 -- "the event matches the verdict in every mode" contradicts the new scoped-request COMMENT default (inline).
  • .github/area_reviewers.yml:24 -- rl_transport leaves out the Monarch RDMAMicrobatch implementation (inline).
Details
  • Overlap search.
    • pr-review: #6239 (draft, felipemello1) edits pr-review/SKILL.md and claude-code.yml. That is a textual conflict only.
    • model_state_dict_transport: #6237 (GPU direct weight sync).
    • rdma_microbatch: none.
    • #6309 (delta transport) edits rl/model_state_dict_transport.py and adds rl/model_state_dict_delta_transport.py at the old top level.
  • Stale references. I grepped for rl.model_state_dict_transport, rl/model_state_dict_transport, trainer.rdma_microbatch, trainer/rdma_microbatch and rl/MODEL_STATE_DICT_TRANSPORT. Nothing is left at HEAD, and the moved doc has no relative links that break.
  • Area routing. rl_transport wins over rl by longest prefix, the same pattern as rl_attention. So transport-only PRs request d4l3k and not the RL reviewers. That looks intended.
  • Override scope. .github/CODEOWNERS lists the core owners on every line, so core owners always qualify. The scope question only matters for area owners: graph_trainer owners and d4l3k for torchft.
  • Workflow. The claude-code.yml change only adds "override" to the skill trigger text. The trigger phrase @claude already catches @claude override.

Not verified: whether huydhn has collaborator access for review requests. The workflow requests reviewers one at a time and tolerates failures, so this is harmless either way.

Before merge: fill in the human-written summary.

Comment thread .claude/skills/pr-review/SKILL.md Outdated
Comment on lines +367 to +368
A code owner can overrule the bot. Code owners are the users listed in
`.github/CODEOWNERS` for at least one file the PR changes. Use the base

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.

Must fix: "for at least one file the PR changes" gives area owners override power over files they don't own. .github/CODEOWNERS says area owners "can approve PRs that only touch their area", and branch protection needs a code owner for every changed file.

Concrete case: a PR edits torchtitan/experiments/torchft/... and torchtitan/trainer.py. d4l3k is a code owner for the torchft file, so under this text the bot accepts d4l3k's @claude override for a must-fix on trainer.py, and a core owner who approved while expecting that item to be fixed loses the bot's block. Use the same scope as branch protection:

Suggested change
A code owner can overrule the bot. Code owners are the users listed in
`.github/CODEOWNERS` for at least one file the PR changes. Use the base
A code owner can overrule the bot. A code owner here is a user listed in
`.github/CODEOWNERS` for every file the PR changes, as branch protection
requires. Use the base

(The other option is "for the file each overridden item is in". That is more permissive and harder for the bot to check.)

Comment thread .claude/skills/pr-review/SKILL.md Outdated
Comment on lines +383 to +384
1. Don't re-review. List the open must-fix items from your latest review and
mark the overridden ones.

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.

Must fix: "Don't re-review" followed by step 2's APPROVE contradicts the new Approve rule ("every change since your last full review was reviewed").

Scenario: the bot posts Request changes with items 1 and 2. The author pushes a commit that fixes item 1 and adds new code. A code owner comments @claude override 2: tracked in #NNNN. Under this text the bot doesn't review, sees nothing open, and approves a commit it never read. Also, "latest review" could be a scoped COMMENT that has no must-fix list.

Suggested change
1. Don't re-review. List the open must-fix items from your latest review and
mark the overridden ones.
1. List the open must-fix items from your latest full review and mark the
overridden ones. If commits landed after that review, review them first
(as in "review again"); a new must-fix there isn't covered by the override.

Comment thread .claude/skills/pr-review/SKILL.md Outdated
@@ -311,7 +424,8 @@ repo="torchtitan", pullNumber=N, event, body)` posts the review in one call.
review again, review my review, a question): `APPROVE` for Approve,

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.

Should consider: this paragraph still says the event matches the verdict "in every mode (... review my review, a question)". Line 72 now makes those scoped requests COMMENT by default unless every change since the last full review was reviewed. Drop "review my review, a question" from this list, or say "when a verdict line is posted", so the two places don't give different instructions.

Comment on lines +24 to +29
- name: rl_transport
paths:
- torchtitan/rl/transport/
- tests/rl/unit_tests/cpu/test_model_state_dict_transport.py
- tests/rl/unit_tests/cpu/test_rdma_microbatch.py
reviewers: [d4l3k]

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.

Should consider: rl_transport covers the RDMAMicrobatch interface but not its only implementation, torchtitan/rl/actors/monarch/rdma_microbatch.py. That file and test_batcher_actor.py, which imports _TensorRef from it, still route to the rl reviewers. If d4l3k should see RDMA microbatch changes, add that file here.

… before an override approves; scoped requests default to COMMENT
@tianyu-l
tianyu-l merged commit 40b63c7 into main Nov 26, 2026
28 checks passed
@tianyu-l
tianyu-l deleted the review-skill-v2 branch November 26, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/fake-pg Run 1-GPU Fake PG integration tests ciflow/rl CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants