PYR0D-353: Count only live workers against the away spend cap, and show headroom at entry #41
Loading…
Reference in a new issue
No description provided.
Delete branch "fm/fm-away-spend-cap-live"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Story: PYR0D-353 - Away mode: count only live workers against the away spend cap, and show headroom at entry
What was wrong
On 2026-10-01 away mode did no work for 4h21m. The away spend cap in
bin/fm-spawn.shcounted every task record that wasn't a secondmate, including workers that had already exited and were only parked on a PR waiting for a merge. At entry, 7 records counted against the default cap of 4 while one worker was running. The captain's words held merges, so the parked records could never drain, and every spawn was refused all night. This is upstream bug kunchenguid/firstmate#6139, carried here until a sync brings upstream's fix. The diagnosis is in firstmate's scout reportfm-afk-idle-diagnosis.The return brief made it worse: it reported "the away session took no action" and "0 outcome(s)". On the daemon path nothing writes the outcome store it reads, so it could not know.
What changed
bin/fm-away-spend-lib.shholds one shared count of live spenders: records whose worker agent is still running. Liveness is read first: an exited worker parked on a PR, a stopped worker and a record whose endpoint is gone do not count; live workers count, including ones paused on their own job or waiting at a gate. The spawn cap, the return brief's "tasks live" count and the entry read-back all use it. If the count cannot be read, the cap refuses rather than letting work through.Tests
Colocated tests cover each change and were proven red against the old code:
The no-mistakes pipeline passed review, test, document and lint at
daa7a831.What stays open
This fixes the first of the two causes. The second is that nothing gives firstmate a turn when the fleet goes idle, and the captain's away words are never re-read on the Claude daemon path. That belongs to the supervision-host adoption (D148 A,
fm-adopt-away-host), starting with the Node module-type fix.Decisions made in review
Review
Two adversarial reviews by other models (Claude Opus at
daa7a831, Codex gpt-6-luna atbf7e1ecd), with every blocking item fixed. A third Codex check of the B1 rework at878752c8approved. CI is green at878752c8.