Repository navigation
fix(bin): let relaunch replace the worker of a held in-flight task - #124
Merged
Merged
Conversation
fm-control.sh relaunch could not replace a dead worker whose backlog item was held in flight: fm-spawn's dispatchability gate refused the row after the old agent had already been stopped, leaving the task with no agent. A relaunch now admits a held In-flight row (fm_backlog_row_relaunchable), reuses the recorded local copy, and leaves the hold untouched at both the preflight and the commit point. Fresh dispatch of a held item still refuses. fm-control.sh checks the same admission before it stops the old agent, so a row that cannot take a replacement refuses with the running agent untouched.
Pibomeister
marked this pull request as ready for review
November 3, 2026 03:22
cursor Bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
Bring in #122, #124, #123, and #121. No textual conflicts; keep the published-head resync owner on main's driving-block signature, freshen_spawn_worktree_base, and t3code skip. Co-authored-by: Eduardo Picazo <[email protected]>
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.
Intent
bin/fm-control.sh relaunch cannot replace a dead worker whose backlog item is held for the captain. Evidence: agent-kit-mate data/ak-gate-evidence-hash-domain/driver-recovery-20261103.md under ~/orca/workspaces/firstmate/. The relaunch stopped the endpoint, then failed with: this home's backlog item ak-gate-evidence-hash-domain is not dispatchable in state in_flight yes no; refusing before creating its endpoint or local copy. No agent now runs for that task. The hold exists for publication and merge authority and must stay in force.
What Changed
bin/fm-backlog-transition-lib.shaddsfm_backlog_row_relaunchable. It admits a held In-flight row (in_flight yes no) for a relaunch and keeps the hold as it is. A held Queued row and any blocked row still refuse. The lib also addsfm_backlog_relaunch_admission, andfm_backlog_dispatch_transitiongets arelaunchmode that leaves a held In-flight row where it is.bin/fm-control.sh relaunchnow runs the admission check before it stops the old agent. If the backlog row cannot take a replacement worker, the command refuses and the running agent is not touched. Before this change, the old agent was stopped first and the task was left with no worker.bin/fm-spawn.shuses the relaunch rule on relaunch spawns, both in the pre-endpoint check and in the atomic backlog transition. It also reports a held In-flight row as preserved. A fresh dispatch of a held item still refuses.docs/configuration.mddocuments the rule, andtests/fm-control-relaunch.test.shadds coverage for it.Risk Assessment
✅ Low: The change is narrow. It admits only the
in_flight yes norow, and only on the relaunch path (the fm-spawn preflight, the commit-time transition and the preservation readback). Fresh dispatch still refuses held rows. It never issues an unhold or start against a held row, so the captain hold stays in force as the intent requires. The new pre-stop admission in fm-control reuses the same config, data dir and kind that fm-spawn uses, so a refusal now happens before the running agent is touched.Testing
I ran the change's targeted relaunch tests at the target commit, where they pass, and at the base commit, where the held relaunch test reproduces the exact reported failure: "not dispatchable in state in_flight yes no", then "no agent is running". I then built a disposable live lab with
bin/fm-live-lab.sh: a real Claude primary and a real Claude worker on a private tmux server. In that lab I held the worker's In-flight item for the captain. Then I relaunched it twice throughbin/fm-control.sh, once with the worker running and once after killing its Claude process. Both relaunches started a fresh worker in the same worktree, with a new spawn generation, and the captain hold stayed unchanged. Two adversarial checks also passed. A held and dependency-blocked item refused before the stop, with the worker process and task record untouched. A fresh dispatch of a held Queued item refused before it created any endpoint or record. I tore the lab down cleanly and removed all temporary files. This is a CLI change, so the evidence is transcripts, not screenshots.Evidence: Live held-relaunch transcript (hold, live relaunch, dead-worker relaunch, adversarial refusals)
Source: Live held-relaunch transcript (hold, live relaunch, dead-worker relaunch, adversarial refusals)
Evidence: Live lab readiness (real Claude primary and worker)
Source: Live lab readiness (real Claude primary and worker)
Evidence: Live lab teardown
Source: Live lab teardown
Evidence: Targeted tests at target commit
Source: Targeted tests at target commit
Evidence: Targeted tests at base commit (reproduces reported failure)
Source: Targeted tests at base commit (reproduces reported failure)
Evidence: Key live result
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
tests/fm-control-relaunch.test.shfiltered to the new held-relaunch tests plus the existing re-verify test: run at the target commit (all ok)The same filtered tests run at base a7b84ef8 (extracted, one local commit added for history): the held In-flight relaunch reproduces the reported error and leaves no agent runningbin/fm-live-lab.sh up --harness claude --worker --supervision-host none /tmp/fmlab.heldrl: real Claude primary and real gated Claude worker on a private tmux server, all readiness checks okbin/fm-captain-hold.sh hold <worker> --reason 'captain owns publication and merge'in the lab, giving item state in_flight yes nobin/fm-control.sh <worker> relaunch --note ...against the running held workerkillof the worker's Claude process (dead worker), thenbin/fm-control.sh <worker> relaunch --note ...Adversarial:tasks-axi block <worker> --by lab-dep-x, then relaunch; checked that the worker PID and task record were unchangedAdversarial: new held Queued item with a scaffolded brief, then a freshbin/fm-spawn.sh <id> projects/notes --mode local-only --yolo on --harness claudebin/fm-live-lab.sh down /tmp/fmlab.heldrlteardown✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.