Skip to content

fix(review): let --cleanup run with a bad OFFLOAD_REVIEW_TIMEOUT - #699

Merged
amiddavid merged 1 commit into
mainfrom
fix/review-timeout-cleanup
Oct 25, 2026
Merged

amiddavid merged 1 commit into
mainfrom
fix/review-timeout-cleanup

Conversation

@amiddavid

Copy link
Copy Markdown
Collaborator

Summary

  • --cleanup no longer fails when OFFLOAD_REVIEW_TIMEOUT is bad.
  • A review run still fails fast on a bad value.

What we found

What changed

How it was tested

Tests ran on the laptop with a fake gh. No Go is involved.

  1. Cleanup with a bad value. OFFLOAD_REVIEW_TIMEOUT=30m OFFLOAD_FORCE=1 offload-review.sh 990 --cleanup exits 0. It removes the fake review-pr990-glm-r1 worktree.
  2. Review with a bad value. OFFLOAD_REVIEW_TIMEOUT=30m offload-review.sh 991 --backend glm still exits 1 with the message. No review-pr991-* worktree exists afterwards.
  3. Mutation. With the check moved back before the cleanup branch, test 1 exits 1 and leaves the worktree. The fix restores exit 0.

bash -n passes.

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 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 (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 for OFFLOAD_REVIEW_TIMEOUT now runs after two network calls (gh repo view at line 97, gh api user at 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 the OFFLOAD_REVIEW_TIMEOUT validation from line 94 to line 127, past the --cleanup branch.
  • Proved the fixed bug. Before the change, OFFLOAD_REVIEW_TIMEOUT=abc scripts/offload-review.sh <pr> --cleanup hit 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 --cleanup works 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 inside attempt, which runs from line 398. No use before line 127. The script runs under set -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 view for the head (line 130), before git fetch (line 170), and before any worktree or session is touched (ensure_wt at 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. --cleanup with 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 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 (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 bad OFFLOAD_REVIEW_TIMEOUT, a normal run now makes
    two network calls (gh repo view line 97, gh api user line 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 ("--cleanup works 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_timeout in the script. First read is scripts/offload-review.sh:347,
    inside attempt. attempt runs only through run_reviewer at line 398, after the new check at
    line 128. So set -u cannot fire, and no reviewer runs with an unset or unchecked value.
  • Checked the --cleanup block (lines 101–123). It never reads review_timeout, and it sources
    backend scripts only for backend_cleanup (line 113–114), which runs no reviewer. So moving the
    check after it is safe, and the fix works: --cleanup now 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
    (first ensure_wt use is at line 280) and before any session is touched.
  • Confirmed the regex still rejects non-numeric values, and 0 still means "no limit" in
    run_limited (line 236), matching the documented behavior in the header and SKILL.md.
  • Checked .claude/skills/offload-review/SKILL.md line 72. Its description of the time limit
    stays true after this change.

@amiddavid
amiddavid merged commit aa116d0 into main Oct 25, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Oct 25, 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