Repository navigation
feat(review): let offload-review run a round on the same head - #609
Conversation
The script refused a second round when the head did not move (exit 3). That blocks two real cases: - The reviewers could not run their tests because the eval box was down. On PRs #563 and #559, all 4 reviewers approved or blocked with no test run. - The author answered a finding with a reply and proof, and no code change. The reviewer never sees the reply. --same-head starts the next round on the same head. Each reviewer resumes its own session, and the prompt says the head did not move and what to look at. The round counts toward the budget. Without the flag, the script still exits 3, and its message now names the flag. SKILL.md: a "Same head" section says when to use it (only when the user asks) and what to post on the PR first. Assisted-By: Claude Signed-off-by: DAVID AMID <[email protected]>
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (bob, user of @amiddavid) | IBM Bob Shell 1.0.3 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | d67786018f7f |
approve |
Verdict: approve
Findings
None. The implementation is correct.
Non-blocking
- The feature is well-designed and handles edge cases properly.
- Documentation is clear and consistent between SKILL.md and the script comments.
- The round budget check happens after the round increment, which is correct.
What I checked
- Full diff review: Read all 51 lines of changes across 2 files.
- Logic correctness: Verified the
--same-headflag handling in lines 116-130 of offload-review.sh:- When both reviews exist for current head and
same_head=0: exits with code 3 and helpful message - When both reviews exist and
same_head=1: increments round, setstodo=(1 2), setsrehead=1 - Round budget check at line 133-137 happens AFTER the increment, preventing budget bypass
- When both reviews exist for current head and
- Prompt generation: Verified lines 183-189 generate correct prompt header when
rehead=1:- Tells reviewers the head did not move
- Explains this round is for new PR content (replies, test results)
- Maintains session continuity by checking
backend_has_session
- Documentation consistency:
- SKILL.md "Same head" section matches script behavior
- Exit code 3 message updated in both places (line 62 of SKILL.md, line 122-123 of script)
- Usage string updated (line 4 of script, line 39 of SKILL.md)
- Edge cases:
- Round budget enforcement: works correctly, checked at line 133-137
- Session resumption:
mode=resumedis set independently ofrehead(line 166-170) - Worktree handling: unchanged, works for both new and resumed rounds
- Reviewer prompt: line 209 adds note only when
rehead=1
- Fail-open compliance: This is a review orchestration script, not a component. It has no fail-open requirement. The script already has proper error handling with
set -euo pipefailand the ERR trap. - Security: No credentials or sensitive data handling. The flag is a simple boolean.
- ASD-STE100 style: Documentation uses short sentences, simple words, active voice.
The implementation correctly handles the two use cases described in SKILL.md:
- Reviewers could not run tests (eval box was down), now they can
- Author replied to findings without code changes
The round still counts toward the budget, as documented. The reviewers resume their own sessions and are told the head did not move.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (bob, user of @amiddavid) | IBM Bob Shell 1.0.3 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | d67786018f7f |
blocking |
Verdict: blocking
Findings
-
scripts/offload-review.sh:135-137 — Budget check runs before same-head logic can execute
- What fails: When at max rounds (e.g., round 2 of 2), using
--same-headexits 2 (budget exceeded) before the same-head round can start. The user cannot use the feature they explicitly requested. - Proof: Lines 116-130 set
round=$((last + 1))andrehead=1whensame_head=1. Then line 135 checksif [ "$round" -gt "$max_rounds" ]and exits 2. With defaultmax_rounds=2, after round 2 completes,last=2, soround=3, which is> 2, triggering exit 2. The--same-headflag was honored (setrehead=1) but the round never runs. - Fix: Move the budget check after the same-head block, or exclude same-head rounds from the budget check with:
if [ "$round" -gt "$max_rounds" ] && [ "$rehead" = 0 ]; then. The second option is safer because same-head rounds should count toward the budget (as SKILL.md states), but the check should not prevent the explicitly-requested round from starting.
- What fails: When at max rounds (e.g., round 2 of 2), using
-
scripts/offload-review.sh:208 — Grammar error in prompt message
- What fails: The message reads "No new commits is expected" which is grammatically incorrect (subject-verb disagreement).
- Proof: Line 208:
[ "$rehead" = 0 ] || echo "- The head is the same as in round $((round - 1)). No new commits is expected, not a skip.". "Commits" is plural, so the verb should be "are" not "is". - Fix: Change to "No new commits are expected, not a skip." or the clearer "No new commits expected, not a skip."
Non-blocking
-
.claude/skills/offload-review/SKILL.md:72-74 — The "Same head" section says "Before the round, post on the PR what is new: the replies and any test results." This is good guidance, but it does not specify the format or exact content. Consider adding an example or template for what to post, so the agent knows what "post what is new" means in practice.
-
scripts/offload-review.sh:183-189 — The same-head prompt block is clear and well-structured. The distinction between "resumed with new commits" and "resumed on same head" is explicit. Good design.
What I checked
- Read
CLAUDE.mdanddocs/design.mdfor repo rules - Read the full diff:
git diff 984327dfc40b59ccd9b5fc1e77beaf235cfb6664..HEAD - Examined the complete implementation in
scripts/offload-review.sh(258 lines) - Verified the same-head logic flow: flag parsing (line 53), condition check (lines 116-130), prompt generation (lines 183-189, 208)
- Checked the
reheadflag usage and its effect on round increment and reviewer selection - Reviewed the prompt changes in both the script and SKILL.md
- Verified the backend interface remains unchanged (bob.sh not modified)
- Checked error handling: the script still fails open with proper exit codes
- Examined the documentation changes in SKILL.md for accuracy and completeness
- Verified the commit message follows conventions (DCO sign-off, Assisted-By, conventional commit format)
- Checked for security issues: no credential handling changes, no new external inputs beyond the flag
- Tested the logic mentally with scenarios:
- Normal round 1: works (no change)
- Normal round 2 after fixes: works (no change)
- Round 2 complete,
--same-headrequested: fails (finding 1) - Round 1 complete, one reviewer missing: works (no change)
Found by reviewer 1 of #609, round 1. Assisted-By: Claude Signed-off-by: DAVID AMID <[email protected]>
|
Author reply to round 1 (head Reviewer 1, finding 1 — the budget check stops a same-head round: rejected. This is the intended behaviour.
Reviewer 1, finding 2 — grammar: fixed in Reviewer 1, non-blocking — a template for what to post: not changed. The section names the 2 things to post: the replies and the test results. The content depends on the PR. |
Summary
offload-review.shgets a--same-headflag. It starts the next review round on a head that already has both reviews of its round.Why
The script refuses a second round when the head did not move. Two real cases need one:
What changed
scripts/offload-review.sh:--same-head. When the last round has both reviews on this head, the flag starts round N+1 instead of exit 3.SKILL.md: a "Same head" section says when to use the flag (only when the user asks) and what to post on the PR first. The exit-3 row points to it.How it was tested
On PR #563, which has both round-1 reviews on its head:
offload-review.sh 563--same-headOFFLOAD_MAX_ROUNDS=1 offload-review.sh 563 --same-headoffload-review.sh 563 --bogusbash -nA real
--same-headround with Bob runs next, on #563, #568, #576 and #559, after this PR merges.🤖 Generated with Claude Code