Repository navigation
fix(review): let --cleanup run with a bad OFFLOAD_REVIEW_TIMEOUT - #699
Merged
Merged
Conversation
The OFFLOAD_REVIEW_TIMEOUT check ran before the --cleanup branch. A bad value made `--cleanup` exit 1, although cleanup runs no reviewer. Move the check after the --cleanup branch. It still runs before any reviewer worktree or session is touched. Follow-up to #697. Listed in #658. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
amiddavid
commented
Oct 25, 2026
amiddavid
left a comment
Collaborator
Author
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.310 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | a680f54615d0 |
approve |
Verdict: approve
Findings
None.
Non-blocking
scripts/offload-review.sh:127— The check forOFFLOAD_REVIEW_TIMEOUTnow runs after two network calls (gh repo viewat line 97,gh api userat line 98). A user who sets a bad value gets the error only after those calls. Harmless. Note only.- The script has no tests. This repo has no shell test harness, and the change is a 5-line move, so I do not ask for one here.
What I checked
- Read the full diff: one commit,
scripts/offload-review.sh, 5 insertions and 3 deletions. The commit moves theOFFLOAD_REVIEW_TIMEOUTvalidation from line 94 to line 127, past the--cleanupbranch. - Proved the fixed bug. Before the change,
OFFLOAD_REVIEW_TIMEOUT=abc scripts/offload-review.sh <pr> --cleanuphit the check before the cleanup branch and exited 1. The cleanup at lines 101-123 never ran. After the change, the check sits at line 127, after cleanup exits at line 122, so--cleanupworks with a bad value. - Checked every use of
review_timeout. It is read at line 347 (run_limited "$review_timeout") and line 349 (log text), both insideattempt, which runs from line 398. No use before line 127. The script runs underset -u, so an earlier use would fail loudly; there is none. - Checked that the new position keeps the safety the comment claims. In a normal run, the validation at line 127 happens before
gh pr viewfor the head (line 130), beforegit fetch(line 170), and before any worktree or session is touched (ensure_wtat line 190, first called at line 398). A bad value still stops the run before any reviewer work. - Checked the exit codes. A bad value still exits 1 with the same message, which matches the documented "input is wrong" code. Cleanup still exits 0.
- Checked the cleanup branch itself. It uses no timeout and touches no reviewer session beyond its own
backend_cleanup, so the move changes nothing for it except that it can now run. - Checked flag combinations.
--cleanupwith other flags still takes the cleanup path, same as before the change. - Read the commit message. It states the bug, the fix, and the follow-up links (#697, #658), and matches the code.
amiddavid
commented
Oct 25, 2026
amiddavid
left a comment
Collaborator
Author
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.310 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | a680f54615d0 |
approve |
Verdict: approve
Findings
None.
Non-blocking
scripts/offload-review.sh:127— with a badOFFLOAD_REVIEW_TIMEOUT, a normal run now makes
two network calls (gh repo viewline 97,gh api userline 98) before it fails. Before this
change, the check ran first. This costs two round-trips in an already-failing run. Not a defect.- The script has no test harness in the repo, so the new behavior ("
--cleanupworks with a bad
OFFLOAD_REVIEW_TIMEOUT") has no automated test. The repo has no shell tests at all, so adding
one only for this would be a larger change than the fix itself.
What I checked
- Read the full diff: one commit,
scripts/offload-review.sh, 5 insertions and 3 deletions. - Traced every use of
review_timeoutin the script. First read isscripts/offload-review.sh:347,
insideattempt.attemptruns only throughrun_reviewerat line 398, after the new check at
line 128. Soset -ucannot fire, and no reviewer runs with an unset or unchecked value. - Checked the
--cleanupblock (lines 101–123). It never readsreview_timeout, and it sources
backend scripts only forbackend_cleanup(line 113–114), which runs no reviewer. So moving the
check after it is safe, and the fix works:--cleanupnow runs with a bad
OFFLOAD_REVIEW_TIMEOUT. - Checked the code between the old and new check positions (lines 94–123):
main,repo,me,
the PR-number check, and the cleanup block. None needs the timeout. - Verified the new comment's claims: the check still runs once, before any worktree is created
(firstensure_wtuse is at line 280) and before any session is touched. - Confirmed the regex still rejects non-numeric values, and
0still means "no limit" in
run_limited(line 236), matching the documented behavior in the header and SKILL.md. - Checked
.claude/skills/offload-review/SKILL.mdline 72. Its description of the time limit
stays true after this change.
This was referenced Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--cleanupno longer fails whenOFFLOAD_REVIEW_TIMEOUTis bad.What we found
scripts/offload-review.shcheckedOFFLOAD_REVIEW_TIMEOUTbefore the--cleanupbranch.OFFLOAD_REVIEW_TIMEOUT=30m ... <pr> --cleanupexited 1.What changed
--cleanupbranch.How it was tested
Tests ran on the laptop with a fake
gh. No Go is involved.OFFLOAD_REVIEW_TIMEOUT=30m OFFLOAD_FORCE=1 offload-review.sh 990 --cleanupexits 0. It removes the fakereview-pr990-glm-r1worktree.OFFLOAD_REVIEW_TIMEOUT=30m offload-review.sh 991 --backend glmstill exits 1 with the message. Noreview-pr991-*worktree exists afterwards.bash -npasses.