Skip to content

feat(review): let offload-review run a round on the same head - #609

Merged
amiddavid merged 2 commits into
mainfrom
feat/offload-same-head
Oct 20, 2026
Merged

amiddavid merged 2 commits into
mainfrom
feat/offload-same-head

Conversation

@amiddavid

Copy link
Copy Markdown
Collaborator

Summary

  • offload-review.sh gets a --same-head flag. It starts the next review round on a head that already has both reviews of its round.
  • Without the flag, nothing changes: the script exits 3. Its message now names the flag.
  • The round counts toward the budget of 2.

Why

The script refuses a second round when the head did not move. Two real cases need one:

  1. The reviewers could not run their tests. On test(dash): start the WAL checkpoint test after the background migrations finish #563 and test(thread): pin that a replaced trailing system message keeps the thread (#519) #559 the eval box SSH link failed, so all 4 Bob reviewers reviewed with no test run. The box works again, but the script will not start round 2.
  2. The author rejected a finding with proof and no code change. The reviewer never sees the reply, so its blocking verdict stays.

What changed

  • scripts/offload-review.sh:
    • New flag --same-head. When the last round has both reviews on this head, the flag starts round N+1 instead of exit 3.
    • Each reviewer resumes its own session. The prompt says that the head did not move, and that the reviewer must look at new replies and test results, and run the tests it could not run.
    • The budget check still applies (exit 2).
  • 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:

Command Result
offload-review.sh 563 exit 3; the message names --same-head
OFFLOAD_MAX_ROUNDS=1 offload-review.sh 563 --same-head exit 2 (budget used): the flag starts round 2, and the budget stops it
offload-review.sh 563 --bogus exit 1, usage
bash -n clean

A real --same-head round with Bob runs next, on #563, #568, #576 and #559, after this PR merges.

🤖 Generated with Claude Code

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 amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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-head flag 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, sets todo=(1 2), sets rehead=1
    • Round budget check at line 133-137 happens AFTER the increment, preventing budget bypass
  • 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=resumed is set independently of rehead (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 pipefail and 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:

  1. Reviewers could not run tests (eval box was down), now they can
  2. 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 amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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

  1. 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-head exits 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)) and rehead=1 when same_head=1. Then line 135 checks if [ "$round" -gt "$max_rounds" ] and exits 2. With default max_rounds=2, after round 2 completes, last=2, so round=3, which is > 2, triggering exit 2. The --same-head flag was honored (set rehead=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.
  2. 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.md and docs/design.md for 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 rehead flag 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-head requested: 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]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Author reply to round 1 (head d67786018f7f).

Reviewer 1, finding 1 — the budget check stops a same-head round: rejected. This is the intended behaviour.

  • SKILL.md "Same head" says: "The round counts toward the budget, so the user may need to grant more rounds (see 'More rounds')."
  • The rule of the skill is that only the user grants rounds past the budget. A same-head round is still a round, and it costs reviewer time and coins.
  • When the budget is used, exit 2 sends the session to "More rounds". There it asks the user, and the user can grant one more round with OFFLOAD_MAX_ROUNDS. This is the same path as for a normal round.
  • The fix you propose, && [ "$rehead" = 0 ], lets --same-head run past the budget with no user decision. That removes the budget for exactly the case where no code changed.
  • The PR body tests this path: OFFLOAD_MAX_ROUNDS=1 ... --same-head exits 2.

Reviewer 1, finding 2 — grammar: fixed in 860b36f62e0c. The line now reads "Expect no new commits. That is not a skip."

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.

@amiddavid
amiddavid merged commit e09ce09 into main Oct 20, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant