Repository navigation
Description
Motivation
#860 fixed the classification that kept --auto-wait (#804) inert, and recorded an explicit decision (docs/investigations/auto-wait-vs-halt-resume-860.md) to keep the in-process wait for now. That decision names two structural costs the in-process design cannot fix from inside:
- The per-issue lock is held for the entire wait (up to 5h). Nothing else can touch the issue; after a crash mid-wait, a stale lock whose PID is recycled reads as fresh (Nested phase claude that hangs after its turn is killed at ~106s, taking down the parent sequant run #856) and blocks the issue until manual
locks clearor 6h age-based recovery. - A reboot or power loss kills the run and buys nothing. The
claudesubprocess died at the failure, so the wait only ever purchases resumption, not continuity — after a reboot the phase restarts from scratch anyway, minus the run, plus a stale lock.
Halt-and-resume inverts both: exit cleanly at the window halt, record when to come back, and let re-entry (cheap since #837 skips completed issues) continue the run.
Proposed shape (from the #860 decision record)
resumeAtin issue state — written at the billing/window fail-fast (fix(run): -Q quality loop retries after an "Out of credits" exec instead of failing fast (billing cascades into "unparseable verdict") #799 path) when the payload carries a waitable window (isWaitableWindow, Five-hour window exhaustion is misclassified as terminal billing, so --auto-wait is inert on subscription plans #860). Machine-readable;sequant statusshows "resumable at 07:00" instead of a bare failure.- Re-entry path —
sequant run --resume(or equivalent) that no-ops untilresumeAt, then re-runs the halted issues, leaning on fix(chain): --chain --ready-gate resume re-executes already-gated links (COMPLETED_STATUSES misses waiting_for_human_merge/blocked) #837's completed-issue skipping. - Lock hygiene — release the per-issue lock at halt; re-acquire on re-entry. Removes the Nested phase claude that hangs after its turn is killed at ~106s, taking down the parent sequant run #856-adjacent stale-lock exposure for waits entirely.
- Re-entry bound — a counter mirroring
AUTO_WAIT_MAX_WAITSso a window that never reopens cannot ping-pong a scheduler. - Scheduler recipe — ~20 documented lines of
launchd/cron invoking the re-entry command; no daemon inside sequant.
Relationship to --auto-wait
Not a replacement initially. --auto-wait stays for the attended/overnight-laptop case (context preserved in memory, zero infrastructure). This issue serves the unattended case where reboot survival and lock release matter. If it proves strictly better in practice, deprecating the in-process wait is a later, separate decision.
Acceptance criteria
- AC-1: A run halting on a waitable window (per Five-hour window exhaustion is misclassified as terminal billing, so --auto-wait is inert on subscription plans #860 classification) with halt-and-resume enabled writes a machine-readable
resumeAtto issue state and releases the per-issue lock before exiting. - AC-2: The re-entry command is a no-op (clear message, exit 0) before
resumeAt, and afterresumeAtcontinues the halted issue without re-running issues already completed (fix(chain): --chain --ready-gate resume re-executes already-gated links (COMPLETED_STATUSES misses waiting_for_human_merge/blocked) #837 behavior). - AC-3: Re-entries are bounded per issue; exceeding the bound halts with today's labeled terminal message.
- AC-4: A reboot between halt and re-entry loses nothing: state carries
resumeAt, no lock is held, and re-entry proceeds normally. - AC-5: Docs ship a copy-pasteable
launchd/cron recipe for the re-entry command.
References
- Decision record:
docs/investigations/auto-wait-vs-halt-resume-860.md - Five-hour window exhaustion is misclassified as terminal billing, so --auto-wait is inert on subscription plans #860 (classification fix + AC-7 decision), feat(run): --auto-wait — continue a rate-limited run when the window resets instead of halting #804 (
--auto-wait), fix(chain): --chain --ready-gate resume re-executes already-gated links (COMPLETED_STATUSES misses waiting_for_human_merge/blocked) #837 (resume skips completed issues), Nested phase claude that hangs after its turn is killed at ~106s, taking down the parent sequant run #856 (stale-lock/PID-recycling hazard), fix(run): -Q quality loop retries after an "Out of credits" exec instead of failing fast (billing cascades into "unparseable verdict") #799 (billing fail-fast)
Activity
fix(#860): close the residual gaps — status guard, drift telemetry, M…
fix(#860): classify live five-hour windows as waitable, not terminal …
admarble commentedon Aug 4, 2026
Plan (spec)
Complexity: Standard (5 ACs, ~4 directories) · Scope:⚠️ SCOPE_WARNING (Non-Goals section missing; all metrics green) → quality loop enabled.
AC Checklist
resumeAtto issue state + releases the per-issue lock before exit — Unit + IntegrationresumeAt; after it, continues halted issues, skipping completed ones (fix(chain): --chain --ready-gate resume re-executes already-gated links (COMPLETED_STATUSES misses waiting_for_human_merge/blocked) #837) — Unit + Integration (injected clock)resumeAt, no lock held) — Integrationlaunchd/cron recipe — Docs gate test (scoped + mutation-verified)Implementation Plan
Phase A — halt side
src/lib/workflow/state-schema.ts: optionalwindowHalt: { resumeAt, phase, reentries }onIssueState(mirrorsautoWait; counter co-located for atomic clearing).src/lib/workflow/state-manager.ts:updateWindowHalt()/clearWindowHalt()— never-throw on untracked issues, likeupdateAutoWait.src/lib/workflow/batch-executor.ts: at the halt sites, whenisWindowHalt(result)(not billing — credits aren't waitable), writeresumeAt = resetsAtToMs(resetsAt) + AUTO_WAIT_BUFFER_MS. Clear on fresh issue start / completion.releaseAll()on shutdown +process.on("exit"); verified by an integration test asserting no lock file remains after a halt.Phase B — re-entry
5. New
sequant resumecommand: no-arg scan of state forwindowHaltissues; pre-resumeAt→ no-op exit 0; post → bound check (MAX_RESUME_REENTRIES = 2, mirroringAUTO_WAIT_MAX_WAITS), increment counter, delegate to the existing run entry with resume semantics (phase markers + #837 skipping). Locks re-acquired via the normal run path.6.
sequant status(+ MCP status): render⏸ Halted — resumable at <time> (re-entries N/2).Phase C — docs
7. Recipe in
docs/reference/(cron line + launchd plist invokingnpx sequant resume), cross-linked fromdocs/investigations/auto-wait-vs-halt-resume-860.md.Key decisions
resumeAtwrite — it is pure bookkeeping on an already-halting path; the re-entry command is the opt-in. Rejected: overloadingsequant run --resume(phase-marker semantics, requires issue numbers; cron wants a no-arg idempotent command).Open questions
reentriesreset point? Recommendation: cleared withwindowHalton fresh non-resume run or completion.Recommended phases: spec → exec → qa (quality loop on;
no-browser-test).admarble commentedon Aug 4, 2026
/qa Review — #892
AC Coverage — 5/5 MET
recordWindowHaltStateat both halt sites, gated onisWindowHalt(#860 classifier); billing/transient → null (unit-tested). Lock release via existingreleaseAll()exit handlers (lock-manager.integration.test.ts).resume 101→ "⏸ not yet resumable…" exit 0; at-boundary counts as due; completed-status exclusion tested for all #837 vocabulary; delegates withresume: true.MAX_RESUME_REENTRIES = 2(mirrors AUTO_WAIT_MAX_WAITS), consumed before run, preserved across repeated halts; live: "Rate limited — re-entry bound reached (2/2)…" exit 1.Quality
Adversarial re-read (Gaps Found — recommendation-grade)
sequant run <N> --resume).sequant status/MCP windowHalt display lines untested (mirrors autoWait precedent).resumeCommandshell live-verified but not unit-tested (pure helpers are).Verdict: AC_MET_BUT_NOT_A_PLUS
All ACs met; findings above are non-blocking improvements. Proceeding to PR.
admarble commentedon Aug 4, 2026
/fullsolve Complete
Issue: #892
Status: AC_MET_BUT_NOT_A_PLUS (all ACs met; recommendation-grade notes only)
PR: #895
Summary
sequant resumeexit-code paths exercised against a synthetic halted-state fileIterations
Non-blocking follow-up notes (from QA)
resumeCommandshell live-verified but not unit-tested.Ready for human review and merge.
fix(#892): close QA follow-up gaps — lock-aware re-entry, display + c…
admarble commentedon Aug 4, 2026
QA follow-up gaps closed (commit 601c878 on PR #895)
All three notes from the QA review are now fixed:
sequant resumeprobes the per-issue lock (read-onlyLockManager.check) before consuming a re-entry; a lock-held due issue is skipped with a clear message and retried on the next scheduler tick. Doc updated inhalt-and-resume.md.formatIssueStateexported@internal; newstatus-format.test.tspins the windowHalt line (phase, resumable-at time,sequant resumepointer, re-entry bound) plus the Five-hour window exhaustion is misclassified as terminal billing, so --auto-wait is inert on subscription plans #860 autoWait sibling and the no-record absence case. (MCP passthrough deliberately untested: it is a literal field copy of already-tested state, and testing it would require cwd manipulation in shared forked workers — reference_process_cwd_spy hazard.)resumeCommandvia injected deps against a realStateManageron a temp state file: arg validation, every exit-code path, persisted re-entry consumption, dry-run non-consumption, lock-skip without consumption, subset runs, requested-issue filtering.Build + lint clean; 25 tests in the two command test files, 157 in the targeted workflow suites; live CLI smoke re-verified.
docs: 2.10 release-notes section + coverage gaps found by release audit