Repository navigation
feat(subagent): enforce one recovery per failure via spawn_agent - #1392
Conversation
d4ad7ef to
3347ae6
Compare
TheGreatAxios
left a comment
There was a problem hiding this comment.
One-recovery enforcement verified — the recovers arg, replay-safety gate, idempotent claim, chain cap, and D7 fresh-spawn authority all confirmed (869/0 subagent suite at seed 424242). BLOCKER: the PR is CONFLICTING/DIRTY against its base — the stack diverged and requires a rebase (conflicts in ARCHITECTURE.md, tool-classification.ts, agent-fleet.ts, session-store.ts + four add/add in terminal-failure files). Should-fix: the recovery grant is consumed before the replacement launches — a failed launch leaves the lane already_recovered with a dead replacement id. Plus: stale AC3/AC8 citations in the body.
-
PR is CONFLICTING/DIRTY against its declared base (cl-10202-surface-…): merge-base c5113a2; the base tip carries its own typed-failure/doom-loop commits (b70f91c, 0f19586) distinct from head's (cd94e2c, 9a71c76).
git merge-treeconflicts:docs/ARCHITECTURE.md,src/agent/tool-classification.ts,src/subagent/agent-fleet.ts,src/subagent/session-store.ts+ add/add interminal-failure.ts/.test.ts,fleet-terminal-failure.test.ts,session-store-failure-record.test.ts(prompts.ts and fleet-dry-drive.ts merge cleanly). Rebase onto the current base tip.
Plain: this can't merge — the branch it's stacked on was rebased after it forked, so the same changes now exist in two different versions. Rebase and resolve. -
AC3 "no second" is covered at
fleet-recovery.test.ts:182-240(concurrent 182-208, exhausted 210-240), outside the cited 108-180; AC8 gate issession-store.ts:1694-1700, cited 1690-1702 over-includes the unrelated pushEntry. Fix the citations.
Plain: the description's test references point at the wrong line ranges.
ffe0494 to
d59be8e
Compare
7d1bdcf to
3dbdbc3
Compare
d59be8e to
4789cdd
Compare
|
Rebased and updated; head is now 4789cdd (2 commits: replay safety, enforce one recovery).
|
3dbdbc3 to
694fbd2
Compare
A worker that wrote files or ran a shell command before its provider gave out was still marked continuable, so a successor with the same brief could repeat those side effects. Recovery is now available only when every tool the run requested or started is a read, search, or web read; anything else, including MCP and unknown tools, fails closed to side_effects_completed and normal director-led continuation.
The single-successor hint for a transient worker failure was advisory: nothing tied a successor to the failed run, counted it, or stopped a second one. spawn_agent now takes recovers, the failed agent id. The claim is recorded synchronously before the handler awaits, so duplicate or concurrent calls get the same replacement back and spawn nothing; an ineligible request is refused with its typed reason and never falls back to a plain spawn. A replacement is attempt 2, so its own failure is recovery_exhausted, and it is an ordinary spawn that inherits no grants, approvals, or pending asks. Reverting this restores the advisory guidance.
4789cdd to
782894e
Compare
PR 2 of 2: enforced recovery (stacked on PR 1)
This is PR 2 of the two-PR CL-10202 delivery. It is stacked on PR 1 (classification and record, branch
cl-10202-surface-terminal-subagent-provider-failures-with-actionable) and must not merge first. Reverting this PR restores today's advisory guidance and keeps PR 1.Summary
spawn_agenttakes arecoversargument and grants at most one recovery per failure.continuablefromrecovery.available, now including replay safety.run()(worktree failure, cancel/interrupt before launch, cancel while queued); oncerun()begins it stays spent.Verification
After the rebase onto main and the review fixes, CI passes on 4789cdd. Gates below were last run on the pre-rebase tip ffe0494 (exit code 0 everywhere):
AC to code and test mapping
Deferred / Notes
side_effects_completedand is not auto-recovery-eligible. This is the brief's closed allowlist, decided, not a defect.Refs CL-10202