You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Verified by read-only audit (seal/gpt-5.6-sol subagent, verdict: PARTIAL — race real, severity overstated in original report).
Mechanism
Session shutdown aborts/waits on controller settlement and run completion (index.ts:637-654), then after 8s calls forceSettle(...) (index.ts:655-658, from index.ts:1007-1012).
Meanwhile the run task awaits async reclaimWorktree() (index.ts:1962-1971; handoff prepared first at index.ts:1938-1961).
If force-settlement lands during that await, the if (!runSettled) guard at index.ts:1984-1989 skips worktreeCleanup, branch correction/deletion, worktreePath, and the checkpoint; normal terminal persistence is also bypassed once settled (index.ts:2025-2042).
Impact (corrected)
Cleanup itself still executes — no direct worktree leak.
The skipped fields are consumed only for persisted display/provenance (prompt.ts:119-141, dashboard.ts:366-376); no automated recovery/GC reads them.
Net effect: stale record may retain a deleted branch name or omit a preserved checkout path — inaccurate provenance and degraded manual recovery discovery.
Late result delivery (index.ts:2064-2081) can re-persist worktreeHandoffArtifact (assigned outside the guard, index.ts:1974-1976) but not the skipped cleanup/path fields.
Suggested fix
Persist worktree finalization independently of runSettled (or make it a settlement barrier), and perform a final checkpoint after the finally block so cleanup results are recorded even after forced settlement.
Test coverage gap
No integrated test covers forced settlement during worktree reclamation; controller.test.ts:101-138 only verifies forceSettle invocation.
Found by automated workflow audit (run wf_56028a5b018b).
Hi, I’d like to work on this issue.
My plan is to:
add a deterministic regression test that pauses worktree reclamation while forced settlement occurs;
persist the final worktree cleanup/provenance metadata even if the run has already been force-settled;
preserve the existing terminal-state and result-delivery semantics;
run the focused Workflow tests, bun run check, and bun run test.
I’ll keep the change scoped to the provenance-loss race described here. Please let me know if anyone is already working on it.
Activity
onychen commentedon Aug 28, 2026
Hi, I’d like to work on this issue.
My plan is to:
I’ll keep the change scoped to the provenance-loss race described here. Please let me know if anyone is already working on it.