Review the PR to mergeable within budget: blockers are fixed and verified, and every other comment has a written disposition. Review answers "does this PR deliver its intent", not "what else can be picked out of this code"; holding scope and fixing bugs are equally your responsibility. Merging is carried out separately under existing authorization.
When tests fail, first perform "Test failure handling"; this also applies before a PR is opened. If the task is only to handle test failures, finish that section and stop.
Before opening a PR
"Complete before creating PR" in the template is the delivery gate: missing items will be raised first by reviewers as comments, costing an extra round for nothing.
- Use the repository's own template:
.github/PULL_REQUEST_TEMPLATE.md(including all-lowercase and the.github/PULL_REQUEST_TEMPLATE/directory),docs/templates underCONTRIBUTING.md. Fill it out fully according to its structure; when in conflict, the repository prevails; HTML comments are only filling instructions, and the body carries no comments. - When the repository has no template, use references/pr-template.md: replace placeholders with the repository's real entry points and delete irrelevant sections.
- State clearly in the descriptionintent: behavior that must be delivered, invariants that must be preserved, and scope explicitly not done. Grading is based on it; for an existing PR, first recover intent from the original requirements.
- Fill in "Complete before creating PR" and then create it: GitHub
gh pr create --body-file '<文件>',Forgejofj pr create; on other hosts, submit the same body via the repository's entry point.
Test failure handling
- Triage: preserve the commit, command, failure signature (test case and assertion), logs, and concurrency conditions; distinguish code defects, test defects, and infrastructure failures; keep it undetermined when evidence is insufficient. A passing rerun only proves the result is unstable; passing in isolation or the PR not touching related files does not rule out a real race.
- Rerun with purpose: for a first rerun of a failing case or gate, state the hypothesis to verify; isolated runs serve only as a comparison. If the same signature blocks again, or there is no new hypothesis, fix, or environment change, switch to
$diagnosing-bugsto build a reproduction and locate it; repeated full gates must be able to test a new hypothesis or verify a disposition result. Counts and evidence accumulate across commits, sessions, and agents. - Disposition: fix regressions introduced by this change and critical correctness issues immediately. Only when evidence confirms an existing test defect and other reliable coverage protects the critical behavior may the specific case be temporarily moved to a separate run and reported as a non-blocking check that fails; at the same time link the issue, owner, restoration deadline, and restoration conditions. If the repository has no isolation mechanism, fix or establish it first; the original gate remains blocking. For infrastructure failures such as scheduling and toolchains, fix them or clearly report them as blocking; missing verification is recorded as incomplete.
- Verification and recording: after the fix, perform bounded repeated verification under the original failure conditions, confirm the assertion can still detect the target defect, and then run the affected required checks. Follow the repository's issue tracking and recording locations; update counts and evidence summaries for the same issue together, submit them in batches with substantive dispositions, and do not push separately just for counts. Before reusing existing checks, verify the final source, toolchain, and coverage; only add evidence that is invalid or missing.
Completion criteria: the required checks actually pass on the final commit; temporarily isolated items are listed separately with failure evidence, coverage gaps, and follow-up arrangements, and do not count as passing. If critical correctness risks remain or required verification is incomplete, stay blocked and state the next step.
Budget
- Rounds are counted by the reviewed HEAD: comments from all reviewers on the same HEAD count as one round; restarting the session, rebasing, re-sending the request, or switching PRs all continue the round count in the ledger.
- **Default is 3 rounds.** Round 1 is full; after that, each round only checks the code changed since the previous round and comments still open. Newly raised comments on unchanged code are treated as nits unless they are blockers.
- Extend to 5 roundsonly in two cases: security, permission, data loss, or concurrency/state blockers with evidence are still open; or the user requests it.
- Stop early: if after a round of re-review only nits, wrong, or recorded should remain, reply and go straight to "Finish".
- Stop when the budget runs out, running out of budget does not mean passing: if blockers remain, hand back to the user via "Pause", with each side writing 2–3 lines of basis; if there are no blockers, record the leftovers and go to "Finish".
Grading
Re-review each comment yourself by intent before grading; the reviewer's P0/P1/P2/Note is only a hint, and P2 is often just a nit.
| Level | Meaning | Action |
|---|---|---|
| blocker | A scenario within the intent goes wrong; data loss or corruption, credential leak/privilege escalation, crash/deadlock, breaking a public contract, large-scale regression introduced by this PR | Fix: minimal fix, prefer deletion or narrowing; add a test that fails without the fix when needed |
| should | A real bug introduced by this PR that callers will hit on common paths, with a local fix | Fix with the batch in rounds 1–2; from round 3, record as accepted unless evidence upgrades it to a blocker |
| nit | Other paths, rare edge cases, minor performance overhead, extra compatibility, tests or guards the intent does not need, maintainability, all Notes | No code change: reply with one line of reasoning, list as follow-up |
| wrong | Wrong or missing context | Reject with evidence (file:line, test, output) |
- Potentially high-consequence, insufficient evidence: do a minimal reproduction first; treat as blocker until confirmed.
- Only push commits for blockers and should; nits and wrong only get replies.
- Before pushing, check
git diff --shortstat <base>: if review made the diff bigger, cut first, then push. - If a comment rejected in a previous round is raised again by another reviewer, cite the previous reply link; do not re-debate.
- Cloud bots have different inputs (some read the description, some only the diff); "both bots raised it" does not directly determine the level.
Each round
- Snapshot: read the latest comments, reviews, and checks on the latest headRefOid. The comment list includes
--paginate(see "Reply" in Forgejo); bots often rewrite comments in place, so judge novelty byupdated_at. Comments under a reviewer account are comments; those under your own account are replies; only when the same account is shared by another agent do you distinguish by the<!-- pr-review-loop:reply -->marker. - Wait for all: act only after the reviewers requested this round and those auto-triggered by pushes have concluded on the latest HEAD (or given up per the wait limit); do not edit while they are still arriving.
- Disposition: grade each comment → write the ledger → batch-fix blockers/should and run checks covering the changes → one push → reply to each. When there are visible UI changes, retake screenshots and update the PR description before pushing: automated review reads the description at the moment of the push.
- When there is no push: After replying, press "End" to self-check; do not start another round. If a reviewer marks the status red solely due to nit/wrong: state the disposition in the reply.
- When there is a push: Trigger the reviewers that require manual triggering per "Reviewer status", briefly tell the user "round N/budget, open items, next step", then register the watch and end this round. The completion criterion is that the watch call returns successfully (under T3, the PR is already linked,
watch_pull_requestsucceeded, and the fallback scheduled task exists).
Before ending follow-up, pausing, having the user call a stop, or handing back to the user, remove any watches still running.
Reviewer status
Update this when the roster changes:
| Reviewer | Trigger | Wait limit |
|---|---|---|
| fast-ship-bot | Auto-triggered when the PR opens and on each push; you can also post a top-level comment @fast-ship-bot |
30 minutes after a push or comment |
**The wait limit is spent only once.** If a reviewer times out without a conclusion, skip it this round and record it in the ledger; in subsequent rounds do not wait for it, and if it later produces a conclusion on its own, collect it normally. On timeout you may retry once and record it; do not use empty commits to prompt review. If host metadata is abnormal, first check the difference between the remote ref and the API, and treat it as an external blocker.
Ledger
The TSV is kept outside the working tree and accumulates across rounds:轮次 / 受审 HEAD / 审查者 / 意见摘要 / 级别 / 处置理由 / 回复链接 / 状态。状态 Use 待回报 to mark requests that have been sent but have no conclusion returned; while this line remains, "End" does not hold. If the ledger is missing or stuck at an old round, backfill it from PR history first.
Each reviewer's ledger record includes the HEAD, trigger event (comment ID or push), host time, retry count, and conclusion. Timeouts are counted from that valid trigger; reconcile duplicate requests first, and only the one sent under the timeout rule counts as a retry; thread reply time does not replace trigger time.
Do not chase the target branch
Review only answers whether this PR's changes hold; target branch advancement and conflict events are only recorded and left to $pr-finish for a single integration. Exception: when this PR must use new changes from the target branch to pass validation, integrate early and state the reason in the ledger.
When stuck
If the same blocker recurs after two rounds of fixes, the fix keeps reversing, or a new blocker emerges from the same mechanism every round: stop fixing item by item and read references/direction-audit.md. An audit does not reset the round count.
Replies
When replying to comments, updating the PR description, or reading host comments and checks, read references/replies.md, and submit via file per host with the reply marker.
Pause
Stop and ask the user in two situations: a comment requires changing user-visible behavior, copy, or interaction semantics while neither the requirements nor the docs have an answer; or the budget is exhausted and blockers remain. Remove watches first, give the question, options, and recommendation, and resume after receiving a choice.
End
Conditions: on the latest HEAD every review request has a conclusion or has been abandoned per the limit, there are no open blockers, all other comments have been replied to, the ledger has no 待回报, and CI passes. If fixes have not been pushed yet, push first, then judge.
- Remove any watches still running.
- Check off the "review comment handling" todo item in the PR description (see "Replies" for the interface).
- Briefly report to the user: rounds used/budget; what was fixed; which comments were not changed and why; which reviewer was absent.
- When merge, wrap-up, or end-to-end delivery authorization already exists, directly execute
$pr-finishto MERGED; when only reviewing or asked to stop at ready-to-merge, deliver the mergeable result.