Skip to content

fix(fusion): handle a stopped or swapped worker like any other cut - #1139

Draft
sosidudku1 wants to merge 2 commits into
mainfrom
fix/fusion-worker-stop-and-swap
Draft

sosidudku1 wants to merge 2 commits into
mainfrom
fix/fusion-worker-stop-and-swap

Conversation

@sosidudku1

@sosidudku1 sosidudku1 commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Three small fixes to how Fusion treats a worker that ends early.

Stop and swap mark the local server (ATO-1317). The local-leg health mark was set only for a worker cut by its clock, its queue wait, its hand-back or the turn's own stop. A worker stopped with /worker stop, or swapped for the escalation model by escalationReplace, was cut just the same, but the next local worker then waited a whole queue budget before the mark was set. The cut is now read right after the local turn ends, before the re-run resets those flags, and includes both cases. The note says which one it was ("stopped by the person", "replaced by the escalation model").

Re-run side effects in the checkpoint (ATO-1316). The local worker's hook calls onWorkerTool on tool_call_parsed, so the checkpoint knows a side effect started before the task finishes. The re-run's hook did not. Now it does, so a hard crash during the re-run does not offer the task as safe to repeat.

Pool after a stop (ATO-1334). runWorkerTasks only asked shouldStart, which is wired only when a budget cap is set, so after a stop with no cap the remaining tasks were still started (each ending cancelled at once). The pool now checks the abort signal first and writes "not started: the turn was stopped".

Tests added: local-leg-health.test.ts (person's stop marks the leg), escalation.test.ts (re-run reports its tools), worker-runner.test.ts (stopped pool).

Merge notes.

Not yet checked on the second Mac.

- A local worker the person stopped, or one swapped for the escalation
  model, now marks the local leg as possibly wedged, so the next local
  worker asks the server first instead of waiting out a queue budget.
  The cut is read before the re-run resets its flags. (ATO-1317)
- The re-run on the escalation model reports its tool calls as they
  start, so a crash mid-re-run leaves its side effects in the checkpoint
  and the task is not offered as safe to repeat. (ATO-1316)
- The fan-out pool starts nothing more once the turn is stopped, also
  when no budget cap is set. (ATO-1334)
The cap aborts the same signal the pool now checks, so the next task
read "not started: the turn was stopped". Ask the cap first.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant