Skip to content

fix(bin): count only live worker seats for the away cap and lanes - #299

Merged
sKeLe100 merged 6 commits into
mainfrom
fm/seat-count-liveness
Nov 21, 2026
Merged

sKeLe100 merged 6 commits into
mainfrom
fm/seat-count-liveness

Conversation

@sKeLe100

@sKeLe100 sKeLe100 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Intent

Code fix C1 from the overnight review, captain-approved 2026-11-20 ("Ship all five"): worker seats count only live work. The away worker cap and lane count counted dead, done and captain-held task records, so the cap read 8 of 8 all night while no seat worked and nothing new could start. Context: the 2026-11-19/20 away window (9h20m) did no work because dead, done, and captain-held records held every worker seat.

What Changed

  • bin/fm-afk-contract.sh: live-workers (shared by the away-entry default and the fm-spawn.sh cap refusal) now counts a non-secondmate record only while it is live. Done or failed records, records whose backend reports the endpoint missing or the agent dead (once past a 180s launch window), and records whose backlog row is held for the captain no longer take a seat. Reads that cannot answer, such as an unreadable backlog or an unknown state, still hold the seat.
  • bin/fm-capacity.sh: the lane count now comes from the same live-workers count, so the away cap and lane count cannot diverge. It falls back to counting every non-secondmate record if that count is unreadable.
  • Docs (docs/configuration.md, docs/pi-supervision-branch.md) describe the live-seat rule. Tests in tests/fm-afk-contract.test.sh, tests/fm-capacity.test.sh and tests/fm-branch-supervision.test.sh are extended for the new counting.

Risk Assessment

✅ Low: The shared live-worker count correctly frees dead, done, missing and captain-held seats; the fail-closed fallbacks, launch window and skip notices reflect earlier review decisions, and I found no new defect.

Testing

The configured baseline passed first. I then ran the afk-contract, capacity and branch-supervision test scripts, which drive the real fm-afk-contract.sh and fm-capacity.sh against fixture state directories, and all three exited 0. They cover dead, released, done and captain-held records holding no seat, and a backend that cannot answer never freeing a seat. They also cover a dead agent in a surviving pane freeing its seat, and a record inside the launch window keeping its seat. tasks-axi was on PATH, so the captain-held case ran rather than being skipped. I drove no real Herdr or tmux session. No UI is involved, so there are no screenshots.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Dead, done, released and captain-held records hold no seat in the live-worker count (real scripts, fixture state dir) ✅ pass live run.log: 'ok - live-workers counts only live work: dead, released, done, and captain-held records hold no seat'
Adversarial: a backend that cannot answer does not free a seat, and a dead agent in a surviving pane frees its seat ✅ pass live run.log: 'a backend that cannot answer never frees a seat'; 'a dead agent in a surviving pane holds no seat despite a working status line'
Launch-window grace and lane count: a freshly spawned record keeps its seat, and fm-capacity reports lanes from live workers only ✅ pass live run.log: 'a record inside the launch window keeps its seat while its pane reads dead'; 'done, dead, and captain-held records hold no lane'
Evidence: test run log

Source: test run log

== fm-afk-contract
ok - the read-back renders the words verbatim beside the expected return, spend cap, and reach line
ok - words preserve their final newline shape in storage and read-back
ok - one enter call writes a version 2 record, announces hold-for-return only, reads it back without asking for a go, and every read subcommand reflects it
ok - entry without --spend records the live worker count, never below the default floor, and an explicit --spend still wins
ok - live-workers counts only live work: dead, released, done, and captain-held records hold no seat
ok - a backend that cannot answer never frees a seat
ok - a dead agent in a surviving pane holds no seat despite a working status line
ok - a record inside the launch window keeps its seat while its pane reads dead
ok - the retired propose, confirm, and --proposal inputs are refused by name and write nothing
ok - enter removes a proposal an older version left behind and records only the new words
ok - a same-turn entry records never-set words verbatim, adds no authority field, and restates the never-set
ok - a plain entry records no mandate in one step, and a refresh leaves the standing record untouched
ok - new words archive the old words and keep the session start
ok - a failed replacement keeps the standing posture live
ok - a failed final replacement publication rolls back its superseded archive
ok - validation and archive refuse damaged words blocks
ok - a words line that lost its record prefix fails validate, read, read-back, and archive instead of truncating the mandate
ok - archive keys the record by its entry time, empties the posture, and is idempotent
ok - malformed inputs and foreign record versions are refused rather than guessed
ok - retired clause fields, --grant, and the clause and grant subcommands are refused by name
ok - a version 1 record validates, reads its words and scalars with the clause and grant sections ignored, refreshes untouched, and archives
ok - new words over a live version 1 record archive it and write version 2 with the same session start
ok - enter and archive refuse while the record is locked, and proceed once it clears
ok - a quiet record announces, refreshes, and reads back as a present captain holding nothing, while an away record keeps hold-for-return
ok - an away entry over quiet mode records away, and a quiet entry never masks a standing away record
exit 0
== fm-capacity
ok - absent config/lane-capacity reports counts and no target
ok - the Constrained line is printed only when config/lane-capacity exists
ok - a target yields open lanes, full, and never a negative count
ok - done, dead, and captain-held records hold no lane
ok - cpu, memory, and disk pressure close every lane and are named
ok - unavailable probes print unknown and do not constrain
ok - a malformed target is reported, not guessed
ok - real host probes produce a well-formed report
# all fm-capacity tests passed
exit 0
== fm-branch-supervision
ok - branch prompt is byte-stable across homes, cwd, timezone, and time, above the cache floor
ok - emitted branch prompt routes completed scouts through existing policies and leased cleanup, preserving unfinished work
ok - outcome store is append-only and refuses sequence reuse after a torn tail
ok - outcome append refreshes a bounded, verbatim display tail of the newest rows without moving the cursor
ok - the display tail keeps only whole newest rows within its 1 MiB budget, never shortening one
ok - outcome seed-tail writes an absent display tail from a valid store's newest rows without moving a marker, and leaves an existing one to append
ok - seed-tail validates and publishes only a bounded newest window, not old malformed history
ok - routine task and fleet no-change outcomes stay stored and silent captain outcomes are refused
ok - startup replay cannot advance the cursor across an unrendered captain outcome
ok - malformed and ahead-of-store cursor state fail closed before any outcome can be skipped
ok - cursor advancement refuses to legitimize an ahead processed marker
ok - middle sequence conflicts fail closed for every store read and append
ok - outcome lookup returns exact sequence rows and distinguishes missing receipts
ok - outcome stores require terminated single-line JSON records
ok - the processed marker is sequence-bound, never ahead of the read cursor, never backwards, and never adopts delivered history
ok - outcome store: present shows each routine row once and each captain row until it is acknowledged
ok - outcome store: present and unprocessed name each captain row's recorded age without writing it
ok - lease exclusivity, same-actor refresh, release, staleness, and sweep hold
ok - fm-control and fm-teardown refuse the other actor's live lease and pass through otherwise
ok - PR merge, local landing, and new-task spawn refuse the branch actor and spare main
ok - a home without a live branch lease takes no lock and clears leftover leases in any calling context
ok - an unmarked main honors a live branch lease across processes and ignores a previous session's
ok - a lease file makes an unmarked guard exclude a concurrent claim for the complete mutation
ok - a host home's unmarked main excludes the host's first claim for its whole mutation, and other homes take no lock
ok - lease liveness requires an exact valid session-lock pid
ok - a claim pinned before a re-anchor records the live lock holder; a dead pin stays stale
ok - concurrent stale-lease claims serialize so exactly one actor succeeds
ok - guard stale cleanup cannot race with or delete a newer lease claim
ok - lease guard excludes a concurrent actor for the complete mutation
ok - a claim naming the other actor fails loudly instead of silently impersonating it
ok - release commands authorize the caller and bulk release drops only that actor's leases
ok - the branch cannot force a teardown or bypass fm-control for a relaunch
ok - the away-posture record relocates the PR merge and a spawn under the spend cap to the branch, never local landing, and only while confirmed, valid, and away
ok - relocated branch spawn admits only already-queued dispatchable work, including on a manual-backend home
ok - the away spend cap is rechecked under the task-set lock so concurrent spawns cannot both publish
ok - a quiet-mode record never caps a present captain's spawn, while the away record's cap still binds
exit 0

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.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Dead, done, released and captain-held records hold no seat in the live-worker count (real scripts, fixture state dir) ✅ pass live run.log: 'ok - live-workers counts only live work: dead, released, done, and captain-held records hold no seat'
Adversarial: a backend that cannot answer does not free a seat, and a dead agent in a surviving pane frees its seat ✅ pass live run.log: 'a backend that cannot answer never frees a seat'; 'a dead agent in a surviving pane holds no seat despite a working status line'
Launch-window grace and lane count: a freshly spawned record keeps its seat, and fm-capacity reports lanes from live workers only ✅ pass live run.log: 'a record inside the launch window keeps its seat while its pane reads dead'; 'done, dead, and captain-held records hold no lane'
  • bin/fm-test-run.sh --changed --exclude-family real-herdr-gated --exclude-quarantined --pc02-if-idle
  • bash tests/fm-afk-contract.test.sh
  • bash tests/fm-capacity.test.sh
  • bash tests/fm-branch-supervision.test.sh
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@sKeLe100
sKeLe100 force-pushed the fm/seat-count-liveness branch from e859f7b to df01924 Compare November 20, 2026 23:26
@sKeLe100
sKeLe100 force-pushed the fm/seat-count-liveness branch from df01924 to b720cbc Compare November 21, 2026 09:40
@sKeLe100 sKeLe100 changed the title fix(bin): count only live work toward the away worker cap and lanes fix(bin): count only live worker seats for the away cap and lanes Nov 21, 2026
…he duration hint for tests/fm-capacity.test.sh in bin/fm-test-run.sh was stale. This PR expanded that test, so it now runs in about 3s, but the hint was 839ms. That is 3.67x over on two consecutive runs, which trips the refusal. I updated the hint to 3076ms, the value CI measured. The other 14 scripts the check flagged were single-run warnings only, so I left them alone. The background run of tests/fm-test-run.test.sh finished with exit code 0. I did not re-run the CI hint-drift check itself locally
@sKeLe100
sKeLe100 merged commit e3b2bbc into main Nov 21, 2026
25 checks passed
sKeLe100 added a commit that referenced this pull request Nov 23, 2026
…anes

Test-only. Fork #299 counts a lane only for a live record, and that count
probes tmux read-only. Upstream's lane-cap deferral case now makes its
lane-holding record live (working status plus a listed window), and its
nothing-created check allows read-only tmux probes (list-windows,
display-message, list-panes) while every mutating call stays forbidden.
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