You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(bin): treat a live no-mistakes run as current after rebase - #4973
Finish the crew-state rebase fix. The implementation is already committed as a8887dd1 (live no-mistakes run is current after rebase). Run the firstmate no-mistakes pipeline and land it. Captain said finish everything.
What Changed
bin/fm-crew-state.sh now binds an EXECUTING no-mistakes run (pending, running, fixing, ci) on the crew's own branch regardless of head, via the new fm_nm_run_is_executing predicate in bin/fm-nm-run-lib.sh, so a pipeline that rebased the branch or committed a fix round in its own checkout no longer reads as an older failed run at the local head. Every other run — parked or terminal — keeps the strict head-equality/ancestry rule, and the ledger fallback still refuses branch-name-only acceptance.
The head-free live bind is paired with an explicit daemon status probe: nm_daemon_probe caches one bounded call per crew read with three distinguishable answers (up, unanswered, down), nm_daemon_answered_down withdraws the bind only on an answered-down daemon (a slow/unanswered probe no longer flaps the crew between working and failed), and an id-addressed anchored continuation whose daemon answered down reports unknown with the record named as unverified. Runs parked at a gate keep their gate and findings, and an open needs-decision/blocked event from the crew's own log still answers with the unverified record given as the reason.
Gate-marker regexes are hoisted into single-owner constants in bin/fm-nm-run-lib.sh (FM_NM_GATE_LINE_RE, FM_NM_AWAITING_AGENT_RE, FM_NM_GATE_SCALAR_RE, FM_NM_GATE_ROW_RE) consumed by both fm_nm_run_is_parked and the crew-state gate readers; tests/fm-crew-state.test.sh adds ~35 cases covering rebased live binds, diverged/unprovable heads, parked-gate exemption, and each daemon-probe answer, with AGENTS.md and docs/architecture.md updated to match.
Risk Assessment
⚠️ Medium: The intent's required behavior (a live run reads as current after a pipeline rebase) is correctly implemented and well covered on both the selected-run and legacy routes with no reachable wrong-label path found, but this is a broad 1200-line change to a supervision-critical attribution classifier that has converged over 18 fix rounds, and the three surviving findings are comment/test-hygiene items safe to address as follow-ups.
Testing
I stood up real crew worktrees (real git repos with genuinely diverged 'pipeline rebased' heads, real append-only status logs, real state dirs) and ran the actual bin/fm-crew-state.sh, bin/fm-fleet-snapshot.sh and bin/fm-fleet-view.sh against them; only the external no-mistakes CLI is stubbed, since its daemon-down, rebased-run and ledger states cannot be manufactured on this host. The reported regression reproduces on the base commit (the crew reads failed / status-log from a stale event while its run is live) and is fixed on this change (working / run-step · validating (running) · run: 01LIVE), visible all the way up in the human Fleet View table an operator reads. Every adversarial guard held: a parked run at a rebased head is still refused, an answered-down daemon suppresses the head-free live bind, an unanswered probe does not drop a working crew back to a stale log, an open decision stays parked and names the unreachable daemon, and the coarse ledger route keeps exactly the pre-existing readings the last two review rounds asked for. The targeted crew-state suite and the fleet-snapshot-view suite pass in full. The only failure I saw anywhere, herdr-preflight-missing-adapter in the teardown suite, fails identically from a clean base-commit tree and is therefore pre-existing. No screenshot/GIF applies: every surface this change touches is a text CLI line and a markdown fleet-view table, both captured verbatim as artifacts.
Live validation: ✅ go - 10 of 10 scenarios driven live against the product
Scenario
Result
Live
Evidence
A crew whose no-mistakes run was rebased reads working, not the stale failed event
✅ pass
live
bin/fm-crew-state.sh s1 over a real worktree whose live run head diverged -> state: working · source: run-step · validating (running) · run: 01LIVE (crew-state-scenarios.txt, S1)
The same fixture on the base commit reproduces the reported misreport
✅ pass
live
Identical fixture against the base-commit helper (git archive 2bcb88c bin) -> state: failed · source: status-log · earlier stage run (crew-state-scenarios.txt, S1 'before')
Every executing status word (pending, running, fixing, ci) binds at a rebased head
✅ pass
live
Four drives of bin/fm-crew-state.sh, each reading state: working · source: run-step with the matching detail (run active (pending), validating (running), validating (fixing), ci running) (…
Adversarial: a run PARKED at a gate on a diverged head must not be attributed
✅ pass
live
Parked run record (gate + 2 findings) at a rebased head -> state: working · source: status-log · implementing; no source: run-step and no parked at review leak (crew-state-scenarios.txt, S3)
Adversarial: a record left saying running by a dead daemon stops answering once the worktree moved off the run head
✅ pass
live
Live record at a rebased head with the daemon probe answering down (exit 1) -> state: blocked · source: status-log · waiting on review; the run step does not answer (crew-state-scenarios.txt, S4)
Adversarial: a slow, unanswered daemon probe does not flap a working crew back to a stale log
✅ pass
live
Same fixture with the probe timing out (exit 124) -> state: working · source: run-step · validating (running) (crew-state-scenarios.txt, S5)
A dead daemon leaves an open decision open and names the dead instrument
✅ pass
live
Ledger-anchored continuation (run head object absent locally) + daemon down + needs-decision tip -> `state: parked · source: status-log · approve the schema change · no-mistakes daemon unreachable;…
A head-tied coarse ledger row keeps its working reading and the original supersede note (no coarse dead-daemon verdict)
✅ pass
live
Coarse route (axi names another crew), head-tied running row, daemon answered down -> state: working · source: run-step · validating (background run) · status-log superseded by active run; no `dae…
A coarse terminal failure with a dead daemon reads unknown/unverified, never parked
✅ pass
live
Coarse head-tied failed row + daemon down + open needs-decision tip -> `state: unknown · source: run-step · no-mistakes daemon unreachable; last ledger record failed - unverified · status-log supe…
The supervisor's Fleet View shows the rebased crew as working instead of failed
✅ pass
live
bin/fm-fleet-snapshot.sh --json + bin/fm-fleet-view.sh over a fixture FM_HOME: row goes from failed / status-log (base) to working / run-step (this change) while the status log's last event st…
fm-crew-state.sh driven end-to-end over real git crew worktrees, a real state/ dir,
and a fake `no-mistakes` CLI serving the run records / ledger / daemon probe.
'before' lines run the same fixture against the base-commit helper (2bcb88c).
== S1 live-run-after-rebase (the reported regression) ==
after : state: working · source: run-step · validating (running) · run: 01LIVE
PASS live rebased run reads working from the run step
before : state: failed · source: status-log · earlier stage run
PASS base commit misreports the same crew (regression reproduced)
== S2 executing-status-words (pending/running/fixing/ci) ==
pending -> state: working · source: run-step · run active (pending)
PASS executing word 'pending' at a rebased head reads working
running -> state: working · source: run-step · validating (running)
PASS executing word 'running' at a rebased head reads working
fixing -> state: working · source: run-step · validating (fixing)
PASS executing word 'fixing' at a rebased head reads working
ci -> state: working · source: run-step · ci running
PASS executing word 'ci' at a rebased head reads working
== S3 parked-run-at-rebased-head-must-not-bind (adversarial) ==
state: working · source: status-log · implementing
PASS a parked run at a diverged head is not attributed
== S4 dead-daemon-suppresses-head-free-live-bind (adversarial) ==
state: blocked · source: status-log · waiting on review
PASS a record left saying running by a dead daemon stops answering
== S5 unanswered-probe-does-not-flap-a-live-crew (adversarial) ==
state: working · source: run-step · validating (running)
PASS a slow (unanswered) probe leaves the live run bound
== S6 dead-daemon-leaves-the-open-decision-open ==
state: parked · source: status-log · approve the schema change · no-mistakes daemon unreachable; last run record running - unverified · run: 01LIVE
PASS the open decision stays parked and names the dead instrument
== S7 coarse-head-tied-row-keeps-working-and-the-original-supersede-note ==
state: working · source: run-step · validating (background run) · status-log superseded by active run
PASS a head-tied coarse live row keeps its working reading
== S8 coarse-failed-row-with-dead-daemon-reads-unknown-not-parked ==
state: unknown · source: run-step · no-mistakes daemon unreachable; last ledger record failed - unverified · status-log superseded (run unknown)
PASS a terminal coarse failure with a dead daemon reads unknown, never parked
---- 12 passed, 0 failed ----
Evidence: Fleet View (operator surface) before vs after, same fixture
ok - daemon/timeout blocked claim over a live fixing run reads as run alive
ok - genuine daemon-down blocked line still reports blocked
ok - scalar gate parked run is not flagged superseded
ok - gate block parked run is not flagged superseded
ok - socket refusal over a coarse active run reports blocked
ok - failed ledger record reads unknown only when the daemon is provably down
ok - coarse run does not probe another branch's ci log
ok - coarse scan anchors the unresolvable active row instead of falling to an older one
ok - coarse scan with a mismatched anchor stays unknown and lets the pane answer
ok - coarse terminal row at a foreign head is not attributed
ok - an executing run binds regardless of branch_sync state
ok - run_parked_scalar_gate_running keeps the strict head rule despite its live status word
ok - run_parked_in_gate_block keeps the strict head rule despite its live status word
ok - unanchored unverifiable active row is attributed because it is live
ok - complete inventory preserves the replacement gate without writes
ok - R5 complete inventory without Python keeps the replacement gate
ok - superseded cancelled run preserves the replacement review gate
ok - a live rebased run beats an older failed run at the local head
ok - pending run with a rebased head reads working
ok - running run with a rebased head reads working
ok - legacy live rebased run is authoritative over an older failed row
ok - legacy surface binds a fixing run at a rebased head
ok - legacy surface binds a ci run at a rebased head
ok - an unproven record with a dead daemon never overrides a busy pane
ok - an ordinary blocked tip over a coarse live row keeps the superseded reading
ok - a socket-refused blocker survives the dead-daemon verdict
ok - an ordinary blocked tip survives the dead-daemon verdict
ok - a parked gate survives a dead daemon with its findings intact
ok - a live record at a diverged head binds while the daemon answers
ok - the anchored continuation binds while the daemon answers
ok - a head-tied coarse record keeps its working reading and its original note
ok - a coarse failed record with a dead daemon reads unknown
ok - the selected-run anchored continuation reports the dead daemon, not an identity failure
ok - the selected-run anchored continuation binds while the daemon answers
ok - the selected route keeps an anchored parked run's gate with a dead daemon
ok - an open decision survives the dead-daemon verdict on the selected route
ok - a coarse pending ledger word reads unknown
ok - an unanswered probe never turns a failed coarse record into a gate
ok - the selected-route dead-daemon verdict names the run once
ok - a head-tied coarse row is exempt even when the record head diverged
ok - an unanswered daemon probe leaves a live rebased run bound
ok - a head-tied coarse live row is exempt from the dead-daemon verdict
ok - a coarse live row over an open decision keeps the original supersede note
ok - a coarse live row at a rebased head is not attributed
all fm-crew-state tests passed
Evidence: Fleet View row flip (the one-line operator-visible result)
⚠️bin/fm-crew-state.sh:71 - The rewritten header states at :70-72 that "A record whose daemon has ANSWERED down reads unknown and names the dead instrument - but only once identity is already proven, by head equality/ancestry or by the ledger anchor." The head-equality half of that is not implemented, and the same header contradicts it 20 lines earlier at :52 ("must not answer once the worktree has moved off the run head").
Concrete trace: pipeline run on fm/feat-x, run head == worktree HEAD (no rebase yet), run record running, daemon dead. bin/fm-crew-state.sh:796 nm_run_head_matches_worktree is true, so HAVE_RUN=1 on the first arm and RUN_DEAD_DAEMON is never set (it is only set in the :798 unresolvable-head elif and in the :870-876 coarse block). The full TOON parse at :959 reads running and the crew emits state: working | source: run-step | validating (running) - indefinitely, for a run that is not progressing. Rebase the same branch once and the same dead daemon now yields state: unknown | no-mistakes daemon unreachable; last ledger record running - unverified (:870-876). Same failure, two opposite verdicts to the supervisor, and the header claims the second one for both.
This is not a regression - the head-match route behaved this way at the base commit - but the change introduces the dead-instrument verdict on every neighbouring route and writes the broad rule into the contract header, so the gap is now a live inconsistency rather than an absent feature.
Remedy is a product decision, hence ask-user: either narrow :70-72 to say the verdict applies only to the ledger-anchor and moved-off-head routes (comment-only, no behavior change), or extend the verdict to the head-match arm (changes the emitted state for every head-matching live run whenever the daemon is down - a user-visible fleet-wide change that also needs the parked exemption applied there). Note the second option extends the change beyond its stated intent, so it needs authorization either way.
⚠️tests/fm-crew-state.test.sh:3656 - Four tests added by the fix rounds are named and commented as proving how the dead-daemon VERDICT behaves, but after commit 5fea3d3 dropped the two unproven-record binds their scenarios no longer set RUN_DEAD_DAEMON at all - they exercise the plain no-run status-log fallback and would still pass if the reconciliation emit at bin/fm-crew-state.sh:1033-1035 were deleted outright.
Traced for test_needs_decision_survives_the_dead_daemon_verdict (:3656): FM_FAKE_AXI_HOME is unset so the fake axi with no args echoes the run TOON, fm_nm_select_run answers unavailable and the case at bin/fm-crew-state.sh:772 falls through -> legacy route at :827: run_branch matches, head is the rebased (resolvable but diverged) sha so nm_run_head_matches_worktree fails, branch_sync is synced so the custody exemption fails, and fm_nm_run_is_executing && ! nm_daemon_answered_down fails because the daemon answered down -> else branch at :850 with FM_FAKE_RUNS_LIST="" -> COARSE_STATUS empty -> HAVE_RUN stays 0. The whole HAVE_RUN block, including RUN_DEAD_DAEMON, is skipped; state: parked comes from the status-log fallback. assert_not_contains "$out" "superseded" can never fail on that path.
Same for test_socket_refused_log_survives_the_dead_daemon_verdict (:3631) and test_selected_run_dead_daemon_leaves_the_open_decision_open (:3917, selected route -> neither arm at :796/:798 fires -> HAVE_RUN=0 with SELECTED_RUN_ID set, so the coarse fallback at :816 is skipped too). test_selected_run_diverged_head_reports_the_dead_daemon (:3604) is named "reports the dead daemon" while asserting the record does NOT bind and the status log answers.
Consequence beyond the misleading names: the RUN_DEAD_DAEMON reconciliation emit is now covered only by the two coarse needs-decision tests (:3792, :3950); no test reaches it with a blocked log tip, which the header at :107-115 says must stay blocked with the unverified record named.
Remedy (mechanical, no behavior change): retarget these to a shape that actually binds - an anchored ledger row like test_anchored_continuation_still_needs_a_live_daemon (:3820) uses - or rename them to what they now prove, and add one anchored dead-daemon case with a blocked: tip.
ℹ️ bin/fm-crew-state.sh:1037 - The guard && ! { [ "$RUN_SOURCE" = coarse ] && [ "$RUN_STATE" = unknown ]; } at bin/fm-crew-state.sh:1037 is left over from the round-10 shape and is now almost entirely unreachable: every coarse-unknown case it was written for now sets RUN_DEAD_DAEMON and exits through the emit at :1034 (the coarse failed + probe-down case was routed through RUN_DEAD_DAEMON at :913, and the :870-876 coarse live case sets it directly).
The one surviving reachable case is the *) default arm at :920, where fm_nm_runs_status_for_worktree returns a word outside completed|failed|cancelled|running - pending is real (tests/fm-crew-state.test.sh:3897 asserts it), and the function prints any lowercase ledger word it decides on (bin/fm-nm-run-lib.sh:437/458). Concretely: foreign axi status answer, ledger row pending fm/feat-x <local head>, daemon up, log tip needs-decision: approve X -> RUN_STATE=unknown, RUN_DETAIL="runs list status: pending", guard suppresses the append, so the crew emits state: unknown | source: run-step | runs list status: pending where the base emitted the same state plus status-log superseded (run unknown). The emitted STATE is unchanged either way, so this is cosmetic, not a wrong verdict - but it is a component the intent does not require and the round-11 finding already noted it becomes unnecessary once the dead-daemon cases route through RUN_DEAD_DAEMON.
Recommended remedy: delete the guard (restores the base detail note for the unrecognised-word case; no other path changes). ask-user because it alters emitted detail text.
⚠️bin/fm-crew-state.sh:918 - The coarse failed arm sets RUN_DEAD_DAEMON from nm_daemon_probe_down (line 917), which is fail-closed: fm_nm_run_checked ... || return 0 returns true for ANY non-zero rc, including 124 (the bounded call's did-not-answer code). Since commit f18d135 routed this arm through RUN_DEAD_DAEMON, that variable no longer only degrades the record to unknown - it also drives the state override at line 1039, which hands the verdict back to the status-log tip.
Concrete failing sequence: crew on fm/feat-x; axi status answers another branch's run (the shared daemon serves the whole repo), so attribution falls to the coarse ledger; the branch's newest row is failed <local head>; the run genuinely failed after its review gate was approved, but status_current_line keeps open decisions alive across unrelated events, so the log tip is still needs-decision: approve the schema change. The daemon status probe merely runs slow under fleet load and is killed at the timeout -> rc 124 -> nm_daemon_probe_down returns 0 -> RUN_DEAD_DAEMON set -> line 1034 case matches needs-decision -> LOG_TIP_STATE=parked -> emit parked status-log "approve the schema change · no-mistakes daemon unreachable; last ledger record failed - unverified". The supervisor is told a human decision is pending on a run that actually failed and needs a rerun. Before this change the same input emitted unknown - ambiguous, but not falsely actionable.
This contradicts the change's own contract in two places: the header at :116-117 scopes the reading to "when the run record itself is UNVERIFIED (its daemon answered down)", and nm_daemon_answered_down's comment at :633-641 states the fail-closed probe "is safe when it degrades a terminal record to unknown, but on a live record it would drop a working crew back to a possibly-stale status log every time the probe merely ran slow". test_unanswered_daemon_probe_does_not_suppress_live_run (tests/fm-crew-state.test.sh:4102) enshrines exactly that principle for the live route; nothing guards it here, because test_unverified_coarse_failed_record_makes_no_supersede_claim (:4073) and test_coarse_failed_ledger_with_daemon_down_reports_unknown (:1413) both use FM_FAKE_DAEMON_DOWN=1 (an ANSWERED rc 1), never FM_FAKE_DAEMON_TIMEOUT=1.
Smallest honest remedy: keep nm_daemon_probe_down for the unknown degrade at :919-920, but gate the RUN_DEAD_DAEMON assignment on nm_daemon_answered_down so probe latency falls back to the pre-change unknown … status-log superseded (run unknown) reading instead of asserting a parked gate.
⚠️bin/fm-crew-state.sh:1049 - Simplification/scope: the change introduces a coarse-row-vs-open-gate special case that the User intent does not require. The intent is "live no-mistakes run is current after rebase" (implementation already committed as a8887dd1/0619120). This branch changes a pre-existing path that has nothing to do with rebase or with a dead daemon.
The component: when RUN_SOURCE=coarse, RUN_STATE=working and LOG_VERB=needs-decision, line 1049 now emits parked from the status log instead of the previous working · status-log superseded by active run. Concrete input: crew fm/feat-cg; axi status answers fm/other-crew; ledger newest row running fm/feat-cg <local head>; daemon HEALTHY (FM_FAKE_DAEMON_DOWN=0); log tip needs-decision: review gate has an ask-user finding that the crew already resolved. Reachability is identical at the base commit (branch mismatch -> else at :852 -> RUN_SOURCE=coarse), so nothing in this change makes the path newly reachable; only the verdict changed. A crew whose run is visible only coarsely and is genuinely validating now reports parked (awaiting a human) until the run terminates - which is the stale-decision-hides-a-working-crew failure the supersede machinery exists to prevent.
Note the escalation history: commit 3c59616 first added this as a DETAIL-only note (status-log not superseded: a coarse run record cannot tell working from parked), leaving the state at working; a later fix round promoted it to a full state override via emit "$LOG_TIP_STATE". The detail-only form is the strictly narrower version of the same concern.
Recommended remedy: remove the state override (revert to the detail-only note, or drop the special case entirely) unless you want the fleet-wide reading change. The reciprocal negative control test_coarse_live_row_over_ordinary_blocked_keeps_superseded_reading (tests/fm-crew-state.test.sh:3748) and test_coarse_live_row_does_not_claim_gate_superseded (:4158) would need updating with it. Flagging rather than fixing because which reading is correct is the author's product call.
ℹ️ bin/fm-crew-state.sh:1039 - On the selected-run route the dead-daemon message built at :812 carries no run id, and the reconciliation emit at :1039 exits before :1065 appends · run: $SELECTED_RUN_ID. The coarse route deliberately appends ; run id: … at :881 for the same verdict, so the two routes disagree about whether the supervisor gets an id to go look at.
Concrete: the shape test_selected_run_dead_daemon_leaves_the_open_decision_open builds (tests/fm-crew-state.test.sh:3957) - selected run 01RUN at an unfetched pipeline head, ledger-anchored, daemon answered down, log tip needs-decision: - emits state: parked · source: status-log · approve the schema change · no-mistakes daemon unreachable; last run record running - unverified with no run: 01RUN. Remove the needs-decision tip from the same fixture and the final emit at :1067 does include it. Exactly the case where a human is being asked to look at a dead run is the case that omits the id.
Remedy: append ; run id: $selected_id when building RUN_DEAD_DAEMON at :812, matching :881.
⚠️bin/fm-crew-state.sh:925 - The coarse failed arm runs the bounded no-mistakes daemon status probe TWICE whenever the daemon is not up. nm_daemon_probe_down (:629-633) short-circuits only on a cached down and never writes NM_DAEMON_ANSWER itself, so after it returns 0 the cache is still empty and nm_daemon_answered_down (:645-656) re-probes from scratch.
Concrete sequence (the shape test_unverified_coarse_failed_record_makes_no_supersede_claim builds): crew fm/feat-cfs; axi status answers fm/other-crew; ledger newest row failed fm/feat-cfs <local head>; daemon down. Line 918 -> probe #1 -> rc 1 -> return 0 -> RUN_STATE=unknown; line 925 -> NM_DAEMON_ANSWER still "" -> probe #2 -> rc 1 -> NM_DAEMON_ANSWER=down. Two no-mistakes daemon status subprocesses for one question.
Cost: in the case this path exists for - a daemon that is dead or wedged rather than answering - each probe burns the full bounded wait, so the worst case is 2 x NM_TIMEOUT (20s by default, FM_CREW_STATE_NM_TIMEOUT at :175) per crew, in the supervisor's per-crew polling loop. Before this branch the same input cost one probe. The two probes can also disagree (probe #1 rc 1, probe #2 killed at the timeout with rc 124 -> NM_DAEMON_ANSWER=other -> RUN_DEAD_DAEMON left unset), making the verdict depend on which of two identical questions was asked when.
Remedy (mechanical, no behavior change): make ONE cached probe with three answers instead of two - record up for rc 0, unanswered for rc 124, down otherwise; then nm_daemon_probe_down is [ "$NM_DAEMON_ANSWER" != up ] and nm_daemon_answered_down is [ "$NM_DAEMON_ANSWER" = down ], both reading the same single call. The current two-value cache (down/other) cannot express this because it collapses rc 0 and rc 124 into one bucket, which is exactly why the second probe is unavoidable today.
ℹ️ bin/fm-crew-state.sh:813 - Round 13 appended ; run id: $selected_id to the selected-route RUN_DEAD_DAEMON message (:813), but that route always reaches the unconditional [ -z "$SELECTED_RUN_ID" ] || RUN_DETAIL="$RUN_DETAIL${SEP}run: $SELECTED_RUN_ID" at :1065, so whenever the reconciliation emit at :1044 does NOT fire the id is printed twice.
Concrete: test_selected_run_anchored_continuation_needs_a_live_daemon (tests/fm-crew-state.test.sh:3897) - selected run 01RUN at an unfetched pipeline head, ledger-anchored, daemon answered down, status-log tip working: implementing (so LOG_VERB=working and the needs-decision|blocked case at :1032 is skipped). Output: state: unknown · source: run-step · no-mistakes daemon unreachable; last run record running - unverified; run id: 01RUN · run: 01RUN.
The test's assert_contains "$out" "run: 01RUN" is satisfied by the :1065 append alone, so it passes identically with or without the :813 suffix - it cannot detect the duplication it was retargeted alongside.
Remedy: drop the ; run id: $selected_id suffix at :813 and instead append ${SEP}run: $SELECTED_RUN_ID inside the RUN_DEAD_DAEMON emit at :1044 (which exits before :1065). That keeps the id on the gate-tip path the original finding cared about without duplicating it on the ordinary path. The coarse route at :881 needs no change - it runs only when SELECTED_RUN_ID is empty, so it never duplicates.
ℹ️ bin/fm-crew-state.sh:1044 - Scope note, acknowledged tradeoff - no action requested. The RUN_DEAD_DAEMON verdict plus the status-log reconciliation emit at :1042-1045 is the one component this branch introduced that reaches beyond "a live run is current after rebase": it changes the reading of the pre-existing coarse-failed path, which has nothing to do with a rebase. Same input before and after - crew on fm/feat-x, axi status answers another branch, ledger newest row failed <local head>, daemon answered down, log tip needs-decision: approve the schema change - used to emit state: unknown ... status-log superseded (run unknown) and now emits state: parked · source: status-log · approve the schema change · no-mistakes daemon unreachable; last ledger record failed - unverified.
I am recording this rather than reporting it as an unrequired component because it is already settled: the daemon-answered-down guard is what makes the intent's own head-free bind safe (without it a zombie running record permanently masks a crew's real state), and round 13's user instruction explicitly kept the answered-down handoff while reverting only the coarse working/parked override. test_unanswered_probe_does_not_turn_a_failed_coarse_record_into_a_gate (tests/fm-crew-state.test.sh:4033) is the reciprocal negative control and is correctly asserted - it would fail if the arm still keyed off the fail-closed probe.
⚠️bin/fm-crew-state.sh:886 - The dead-daemon verdict is applied to a coarse ledger row whose head TIES to the worktree, which the header at :70-76 says it must not be. That comment scopes the verdict to "the two routes that bind a run the worktree has MOVED OFF" and adds: "It is deliberately NOT extended to the head-matching arm - while the run head still equals or precedes the worktree HEAD the record keeps its original working reading." A head-tied coarse row is precisely a row whose head equals or precedes the worktree HEAD, so the two sentences name the same case on both sides of the rule, and line 886 implements the extension.
Concrete divergence, same crew and same run:
Crew fm/feat-x, local HEAD H. Ledger newest row for the branch: running fm/feat-x <H>. Daemon answered down.
Case A - bare axi status answers THIS crew's run (branch fm/feat-x, head H). Line 842 nm_run_head_matches_worktree is true, so the probe is never reached: HAVE_RUN=1, RUN_SOURCE=full, status running -> state: working · source: run-step · validating (running).
Case B - bare axi status answers ANOTHER crew's run (the else branch at :862). COARSE_STATUS=running from the same ledger row at H; :886 sees class live, the parked guard is skipped because run_branch != CREW_BRANCH, nm_daemon_answered_down is true -> state: unknown · source: run-step · no-mistakes daemon unreachable; last ledger record running - unverified.
Nothing about the run, its head, or the daemon differs between A and B - only which run the shared daemon's bare axi status happened to name, which the module's own comment at :722-726 calls "routine once several crews validate the same underlying repo concurrently". test_coarse_live_row_with_daemon_down_is_unverified (its ledger row is at ${local_short}, the worktree's own head) locks in the B side; the head-matching arm locks in A.
The defect lives inside the coarse-live extension the fix rounds added at :886-893, which is not required by the intent (the intent's fix is the head-free executing bind, not a new reading of head-tied coarse rows). The smallest honest remedy is to remove that extension, or to restrict it to coarse answers the worktree has genuinely moved off. Note that the narrower form is not currently expressible: fm_nm_runs_status_for_worktree returns the same status word for its head-matching path and its anchored-continuation path, so distinguishing them requires changing that shared helper's contract - the remedy, not the defect, is what needs authorization.
⚠️bin/fm-crew-state.sh:812 - The daemon-down guard the fix rounds added does not cover the sibling head-free route, so the zombie-record failure it exists for is still reachable.
At :811-812 (and identically at :842-843) the condition is nm_run_head_matches_worktree || fm_nm_run_is_pipeline_owned_active "$RUN_OUT" || { fm_nm_run_is_executing "$RUN_OUT" && ! nm_daemon_answered_down; }. fm_nm_run_is_pipeline_owned_active (bin/fm-nm-run-lib.sh:311-314) is branch_sync.state=pipeline_owned && fm_nm_run_is_active - it binds ANY active run head-free, executing or parked - and it short-circuits the probe clause that follows it.
Concrete sequence: crew fm/feat-x; axi status answers its own run with status: running, no gate markers, branch_sync:\n state: pipeline_owned, and head: at the pipeline's rebased/unfetched head; the daemon has died and no-mistakes daemon status exits non-zero. Line 811 -> head does not match -> fm_nm_run_is_pipeline_owned_active true -> HAVE_RUN=1 with no probe and RUN_DEAD_DAEMON unset -> RUN_SOURCE=full -> state: working · source: run-step · validating (running). The identical record with state: synced instead takes the executing clause, gets the probe, and reads unknown (test_anchored_continuation_still_needs_a_live_daemon) or leaves HAVE_RUN=0 (test_live_record_at_diverged_head_does_not_bind_an_unproven_record). branch_sync.state is daemon-written state that goes stale in exactly the same way the running word does, so it is not independent liveness evidence.
The change also re-documented this predicate as parked-only without changing it: the header at :59-61 now says custody "binds an ACTIVE parked run without head equality" and bin/fm-nm-run-lib.sh:308-309 now says "a parked run whose pipeline currently owns the branch binds without head equality". Both previously said "ACTIVE run" / "a live run". The predicate still returns 0 for an executing run, so the comments assert a narrowing the code does not implement, which makes the gap invisible to a reader auditing the guard.
Remedy is a scope decision the author owns: either extend the guard (fm_nm_run_is_pipeline_owned_active "$RUN_OUT" && ! nm_daemon_answered_down at both :812 and :843, which changes the reading of a pre-existing route the intent does not touch), or revert the two comments to say the custody exemption binds any active run and is deliberately outside the daemon rule. Do not leave the comments claiming parked-only while the code binds executing runs.
ℹ️ bin/fm-nm-run-lib.sh:352 - fm_nm_run_is_executing's contract comment justifies its accepted-word list with a claim the same change disproves: "The overview table fm_nm_select_run validates carries only pending|running|completed|failed|cancelled (:196), so on the modern selected-run route only pending and running ever reach here." The mirrored claim is in bin/fm-crew-state.sh:40-42 ("pending or running through the overview-backed route; also fixing or ci on the legacy bare-status surface").
On the selected route, RUN_OUT is reassigned at bin/fm-crew-state.sh:797 to the id-addressed DETAIL (axi status --run <id>), not the overview row, and that detail's vocabulary is validated at :803-806 as pending|running|fixing|ci|awaiting_approval|fix_review|completed|failed|cancelled. A run whose overview column reads running while its detail reads fixing passes the class agreement check at :807-809 (both live) and reaches fm_nm_run_is_executing with status fixing. So fixing and ci reach the predicate on the modern route too.
No behavior is wrong today - the predicate accepts those words either way. The risk is that the comment is the stated rationale for the word list: acting on it by narrowing the modern route to pending|running would stop binding a fix round at a rebased head on the overview-backed surface, which is the exact misreport this change exists to prevent. Correct both comments to say the detail object carries fixing and ci on either surface.
🚨 bin/fm-crew-state.sh:894 - The round-16 fix gates the coarse dead-daemon verdict on run_branch = CREW_BRANCH, justified at :887-889 as "Reaching this branch at all proves the head rule rejected the record, so a SAME-branch answer is necessarily moved-off". That proof applies to the axi status RECORD's head, but COARSE_STATUS
Intent
Finish the crew-state rebase fix. The implementation is already committed as a8887dd1 (live no-mistakes run is current after rebase). Run the firstmate no-mistakes pipeline and land it. Captain said finish everything.
What Changed
bin/fm-crew-state.shnow binds an EXECUTING no-mistakes run (pending,running,fixing,ci) on the crew's own branch regardless of head, via the newfm_nm_run_is_executingpredicate inbin/fm-nm-run-lib.sh, so a pipeline that rebased the branch or committed a fix round in its own checkout no longer reads as an older failed run at the local head. Every other run — parked or terminal — keeps the strict head-equality/ancestry rule, and the ledger fallback still refuses branch-name-only acceptance.daemon statusprobe:nm_daemon_probecaches one bounded call per crew read with three distinguishable answers (up,unanswered,down),nm_daemon_answered_downwithdraws the bind only on an answered-down daemon (a slow/unanswered probe no longer flaps the crew between working and failed), and an id-addressed anchored continuation whose daemon answered down reportsunknownwith the record named as unverified. Runs parked at a gate keep their gate and findings, and an openneeds-decision/blockedevent from the crew's own log still answers with the unverified record given as the reason.bin/fm-nm-run-lib.sh(FM_NM_GATE_LINE_RE,FM_NM_AWAITING_AGENT_RE,FM_NM_GATE_SCALAR_RE,FM_NM_GATE_ROW_RE) consumed by bothfm_nm_run_is_parkedand the crew-state gate readers;tests/fm-crew-state.test.shadds ~35 cases covering rebased live binds, diverged/unprovable heads, parked-gate exemption, and each daemon-probe answer, withAGENTS.mdanddocs/architecture.mdupdated to match.Risk Assessment
Testing
I stood up real crew worktrees (real git repos with genuinely diverged 'pipeline rebased' heads, real append-only status logs, real state dirs) and ran the actual bin/fm-crew-state.sh, bin/fm-fleet-snapshot.sh and bin/fm-fleet-view.sh against them; only the external
no-mistakesCLI is stubbed, since its daemon-down, rebased-run and ledger states cannot be manufactured on this host. The reported regression reproduces on the base commit (the crew readsfailed / status-logfrom a stale event while its run is live) and is fixed on this change (working / run-step · validating (running) · run: 01LIVE), visible all the way up in the human Fleet View table an operator reads. Every adversarial guard held: a parked run at a rebased head is still refused, an answered-down daemon suppresses the head-free live bind, an unanswered probe does not drop a working crew back to a stale log, an open decision stays parked and names the unreachable daemon, and the coarse ledger route keeps exactly the pre-existing readings the last two review rounds asked for. The targeted crew-state suite and the fleet-snapshot-view suite pass in full. The only failure I saw anywhere,herdr-preflight-missing-adapterin the teardown suite, fails identically from a clean base-commit tree and is therefore pre-existing. No screenshot/GIF applies: every surface this change touches is a text CLI line and a markdown fleet-view table, both captured verbatim as artifacts.bin/fm-crew-state.sh s1over a real worktree whose live run head diverged ->state: working · source: run-step · validating (running) · run: 01LIVE(crew-state-scenarios.txt, S1)git archive 2bcb88c bin) ->state: failed · source: status-log · earlier stage run(crew-state-scenarios.txt, S1 'before')bin/fm-crew-state.sh, each readingstate: working · source: run-stepwith the matching detail (run active (pending),validating (running),validating (fixing),ci running) (…state: working · source: status-log · implementing; nosource: run-stepand noparked at reviewleak (crew-state-scenarios.txt, S3)state: blocked · source: status-log · waiting on review; the run step does not answer (crew-state-scenarios.txt, S4)state: working · source: run-step · validating (running)(crew-state-scenarios.txt, S5)needs-decisiontip -> `state: parked · source: status-log · approve the schema change · no-mistakes daemon unreachable;…runningrow, daemon answered down ->state: working · source: run-step · validating (background run) · status-log superseded by active run; no `dae…failedrow + daemon down + openneeds-decisiontip -> `state: unknown · source: run-step · no-mistakes daemon unreachable; last ledger record failed - unverified · status-log supe…bin/fm-fleet-snapshot.sh --json+bin/fm-fleet-view.shover a fixture FM_HOME: row goes fromfailed / status-log(base) toworking / run-step(this change) while the status log's last event st…Evidence: Crew-state scenario transcript (8 scenarios, incl. base-commit before/after)
Source: Crew-state scenario transcript (8 scenarios, incl. base-commit before/after)
Evidence: Fleet View (operator surface) before vs after, same fixture
Source: Fleet View (operator surface) before vs after, same fixture
Evidence: Targeted suite output for the rebase / daemon / coarse cases
Source: Targeted suite output for the rebase / daemon / coarse cases
Evidence: Fleet View row flip (the one-line operator-visible result)
Pipeline
Updates from git push no-mistakes
... (86 earlier update rounds omitted to keep the PR body within GitHub's 65536-char limit; full history is in the run log.)
🔧 Fix applied.
3 issues (2 warnings, 1 info) still open:
bin/fm-crew-state.sh:71- The rewritten header states at :70-72 that "A record whose daemon has ANSWERED down reads unknown and names the dead instrument - but only once identity is already proven, by head equality/ancestry or by the ledger anchor." The head-equality half of that is not implemented, and the same header contradicts it 20 lines earlier at :52 ("must not answer once the worktree has moved off the run head").Concrete trace: pipeline run on fm/feat-x, run head == worktree HEAD (no rebase yet), run record
running, daemon dead. bin/fm-crew-state.sh:796nm_run_head_matches_worktreeis true, so HAVE_RUN=1 on the first arm and RUN_DEAD_DAEMON is never set (it is only set in the :798 unresolvable-head elif and in the :870-876 coarse block). The full TOON parse at :959 readsrunningand the crew emitsstate: working | source: run-step | validating (running)- indefinitely, for a run that is not progressing. Rebase the same branch once and the same dead daemon now yieldsstate: unknown | no-mistakes daemon unreachable; last ledger record running - unverified(:870-876). Same failure, two opposite verdicts to the supervisor, and the header claims the second one for both.This is not a regression - the head-match route behaved this way at the base commit - but the change introduces the dead-instrument verdict on every neighbouring route and writes the broad rule into the contract header, so the gap is now a live inconsistency rather than an absent feature.
Remedy is a product decision, hence ask-user: either narrow :70-72 to say the verdict applies only to the ledger-anchor and moved-off-head routes (comment-only, no behavior change), or extend the verdict to the head-match arm (changes the emitted state for every head-matching live run whenever the daemon is down - a user-visible fleet-wide change that also needs the parked exemption applied there). Note the second option extends the change beyond its stated intent, so it needs authorization either way.
tests/fm-crew-state.test.sh:3656- Four tests added by the fix rounds are named and commented as proving how the dead-daemon VERDICT behaves, but after commit 5fea3d3 dropped the two unproven-record binds their scenarios no longer set RUN_DEAD_DAEMON at all - they exercise the plain no-run status-log fallback and would still pass if the reconciliation emit at bin/fm-crew-state.sh:1033-1035 were deleted outright.Traced for test_needs_decision_survives_the_dead_daemon_verdict (:3656): FM_FAKE_AXI_HOME is unset so the fake
axiwith no args echoes the run TOON, fm_nm_select_run answersunavailableand the case at bin/fm-crew-state.sh:772 falls through -> legacy route at :827: run_branch matches, head is the rebased (resolvable but diverged) sha so nm_run_head_matches_worktree fails, branch_sync issyncedso the custody exemption fails, andfm_nm_run_is_executing && ! nm_daemon_answered_downfails because the daemon answered down -> else branch at :850 with FM_FAKE_RUNS_LIST="" -> COARSE_STATUS empty -> HAVE_RUN stays 0. The whole HAVE_RUN block, including RUN_DEAD_DAEMON, is skipped;state: parkedcomes from the status-log fallback.assert_not_contains "$out" "superseded"can never fail on that path.Same for test_socket_refused_log_survives_the_dead_daemon_verdict (:3631) and test_selected_run_dead_daemon_leaves_the_open_decision_open (:3917, selected route -> neither arm at :796/:798 fires -> HAVE_RUN=0 with SELECTED_RUN_ID set, so the coarse fallback at :816 is skipped too). test_selected_run_diverged_head_reports_the_dead_daemon (:3604) is named "reports the dead daemon" while asserting the record does NOT bind and the status log answers.
Consequence beyond the misleading names: the RUN_DEAD_DAEMON reconciliation emit is now covered only by the two coarse needs-decision tests (:3792, :3950); no test reaches it with a
blockedlog tip, which the header at :107-115 says must stay blocked with the unverified record named.Remedy (mechanical, no behavior change): retarget these to a shape that actually binds - an anchored ledger row like test_anchored_continuation_still_needs_a_live_daemon (:3820) uses - or rename them to what they now prove, and add one anchored dead-daemon case with a
blocked:tip.bin/fm-crew-state.sh:1037- The guard&& ! { [ "$RUN_SOURCE" = coarse ] && [ "$RUN_STATE" = unknown ]; }at bin/fm-crew-state.sh:1037 is left over from the round-10 shape and is now almost entirely unreachable: every coarse-unknown case it was written for now sets RUN_DEAD_DAEMON and exits through the emit at :1034 (the coarsefailed+ probe-down case was routed through RUN_DEAD_DAEMON at :913, and the :870-876 coarse live case sets it directly).The one surviving reachable case is the
*)default arm at :920, where fm_nm_runs_status_for_worktree returns a word outside completed|failed|cancelled|running -pendingis real (tests/fm-crew-state.test.sh:3897 asserts it), and the function prints any lowercase ledger word it decides on (bin/fm-nm-run-lib.sh:437/458). Concretely: foreignaxi statusanswer, ledger rowpending fm/feat-x <local head>, daemon up, log tipneeds-decision: approve X-> RUN_STATE=unknown, RUN_DETAIL="runs list status: pending", guard suppresses the append, so the crew emitsstate: unknown | source: run-step | runs list status: pendingwhere the base emitted the same state plusstatus-log superseded (run unknown). The emitted STATE is unchanged either way, so this is cosmetic, not a wrong verdict - but it is a component the intent does not require and the round-11 finding already noted it becomes unnecessary once the dead-daemon cases route through RUN_DEAD_DAEMON.Recommended remedy: delete the guard (restores the base detail note for the unrecognised-word case; no other path changes). ask-user because it alters emitted detail text.
🔧 Fix applied.
3 issues (2 warnings, 1 info) still open:
bin/fm-crew-state.sh:918- The coarsefailedarm sets RUN_DEAD_DAEMON fromnm_daemon_probe_down(line 917), which is fail-closed:fm_nm_run_checked ... || return 0returns true for ANY non-zero rc, including 124 (the bounded call's did-not-answer code). Since commit f18d135 routed this arm through RUN_DEAD_DAEMON, that variable no longer only degrades the record tounknown- it also drives the state override at line 1039, which hands the verdict back to the status-log tip.Concrete failing sequence: crew on fm/feat-x;
axi statusanswers another branch's run (the shared daemon serves the whole repo), so attribution falls to the coarse ledger; the branch's newest row isfailed <local head>; the run genuinely failed after its review gate was approved, butstatus_current_linekeeps open decisions alive across unrelated events, so the log tip is stillneeds-decision: approve the schema change. Thedaemon statusprobe merely runs slow under fleet load and is killed at the timeout -> rc 124 ->nm_daemon_probe_downreturns 0 -> RUN_DEAD_DAEMON set -> line 1034 case matchesneeds-decision-> LOG_TIP_STATE=parked ->emit parked status-log "approve the schema change · no-mistakes daemon unreachable; last ledger record failed - unverified". The supervisor is told a human decision is pending on a run that actually failed and needs a rerun. Before this change the same input emittedunknown- ambiguous, but not falsely actionable.This contradicts the change's own contract in two places: the header at :116-117 scopes the reading to "when the run record itself is UNVERIFIED (its daemon answered down)", and
nm_daemon_answered_down's comment at :633-641 states the fail-closed probe "is safe when it degrades a terminal record to unknown, but on a live record it would drop a working crew back to a possibly-stale status log every time the probe merely ran slow".test_unanswered_daemon_probe_does_not_suppress_live_run(tests/fm-crew-state.test.sh:4102) enshrines exactly that principle for the live route; nothing guards it here, becausetest_unverified_coarse_failed_record_makes_no_supersede_claim(:4073) andtest_coarse_failed_ledger_with_daemon_down_reports_unknown(:1413) both use FM_FAKE_DAEMON_DOWN=1 (an ANSWERED rc 1), never FM_FAKE_DAEMON_TIMEOUT=1.Smallest honest remedy: keep
nm_daemon_probe_downfor theunknowndegrade at :919-920, but gate the RUN_DEAD_DAEMON assignment onnm_daemon_answered_downso probe latency falls back to the pre-changeunknown … status-log superseded (run unknown)reading instead of asserting a parked gate.bin/fm-crew-state.sh:1049- Simplification/scope: the change introduces a coarse-row-vs-open-gate special case that the User intent does not require. The intent is "live no-mistakes run is current after rebase" (implementation already committed as a8887dd1/0619120). This branch changes a pre-existing path that has nothing to do with rebase or with a dead daemon.The component: when RUN_SOURCE=coarse, RUN_STATE=working and LOG_VERB=needs-decision, line 1049 now emits
parkedfrom the status log instead of the previousworking · status-log superseded by active run. Concrete input: crew fm/feat-cg;axi statusanswers fm/other-crew; ledger newest rowrunning fm/feat-cg <local head>; daemon HEALTHY (FM_FAKE_DAEMON_DOWN=0); log tipneeds-decision: review gate has an ask-user findingthat the crew already resolved. Reachability is identical at the base commit (branch mismatch -> else at :852 -> RUN_SOURCE=coarse), so nothing in this change makes the path newly reachable; only the verdict changed. A crew whose run is visible only coarsely and is genuinely validating now reportsparked(awaiting a human) until the run terminates - which is the stale-decision-hides-a-working-crew failure the supersede machinery exists to prevent.Note the escalation history: commit 3c59616 first added this as a DETAIL-only note (
status-log not superseded: a coarse run record cannot tell working from parked), leaving the state atworking; a later fix round promoted it to a full state override viaemit "$LOG_TIP_STATE". The detail-only form is the strictly narrower version of the same concern.Recommended remedy: remove the state override (revert to the detail-only note, or drop the special case entirely) unless you want the fleet-wide reading change. The reciprocal negative control
test_coarse_live_row_over_ordinary_blocked_keeps_superseded_reading(tests/fm-crew-state.test.sh:3748) andtest_coarse_live_row_does_not_claim_gate_superseded(:4158) would need updating with it. Flagging rather than fixing because which reading is correct is the author's product call.bin/fm-crew-state.sh:1039- On the selected-run route the dead-daemon message built at :812 carries no run id, and the reconciliationemitat :1039 exits before :1065 appends· run: $SELECTED_RUN_ID. The coarse route deliberately appends; run id: …at :881 for the same verdict, so the two routes disagree about whether the supervisor gets an id to go look at.Concrete: the shape
test_selected_run_dead_daemon_leaves_the_open_decision_openbuilds (tests/fm-crew-state.test.sh:3957) - selected run 01RUN at an unfetched pipeline head, ledger-anchored, daemon answered down, log tipneeds-decision:- emitsstate: parked · source: status-log · approve the schema change · no-mistakes daemon unreachable; last run record running - unverifiedwith norun: 01RUN. Remove the needs-decision tip from the same fixture and the final emit at :1067 does include it. Exactly the case where a human is being asked to look at a dead run is the case that omits the id.Remedy: append
; run id: $selected_idwhen building RUN_DEAD_DAEMON at :812, matching :881.🔧 Fix applied.
3 issues (1 warning, 2 infos) still open:
bin/fm-crew-state.sh:925- The coarsefailedarm runs the boundedno-mistakes daemon statusprobe TWICE whenever the daemon is not up.nm_daemon_probe_down(:629-633) short-circuits only on a cacheddownand never writesNM_DAEMON_ANSWERitself, so after it returns 0 the cache is still empty andnm_daemon_answered_down(:645-656) re-probes from scratch.Concrete sequence (the shape
test_unverified_coarse_failed_record_makes_no_supersede_claimbuilds): crew fm/feat-cfs;axi statusanswers fm/other-crew; ledger newest rowfailed fm/feat-cfs <local head>; daemon down. Line 918 -> probe #1 -> rc 1 -> return 0 -> RUN_STATE=unknown; line 925 -> NM_DAEMON_ANSWER still "" -> probe #2 -> rc 1 -> NM_DAEMON_ANSWER=down. Twono-mistakes daemon statussubprocesses for one question.Cost: in the case this path exists for - a daemon that is dead or wedged rather than answering - each probe burns the full bounded wait, so the worst case is 2 x NM_TIMEOUT (20s by default, FM_CREW_STATE_NM_TIMEOUT at :175) per crew, in the supervisor's per-crew polling loop. Before this branch the same input cost one probe. The two probes can also disagree (probe #1 rc 1, probe #2 killed at the timeout with rc 124 -> NM_DAEMON_ANSWER=other -> RUN_DEAD_DAEMON left unset), making the verdict depend on which of two identical questions was asked when.
Remedy (mechanical, no behavior change): make ONE cached probe with three answers instead of two - record
upfor rc 0,unansweredfor rc 124,downotherwise; thennm_daemon_probe_downis[ "$NM_DAEMON_ANSWER" != up ]andnm_daemon_answered_downis[ "$NM_DAEMON_ANSWER" = down ], both reading the same single call. The current two-value cache (down/other) cannot express this because it collapses rc 0 and rc 124 into one bucket, which is exactly why the second probe is unavoidable today.bin/fm-crew-state.sh:813- Round 13 appended; run id: $selected_idto the selected-route RUN_DEAD_DAEMON message (:813), but that route always reaches the unconditional[ -z "$SELECTED_RUN_ID" ] || RUN_DETAIL="$RUN_DETAIL${SEP}run: $SELECTED_RUN_ID"at :1065, so whenever the reconciliation emit at :1044 does NOT fire the id is printed twice.Concrete:
test_selected_run_anchored_continuation_needs_a_live_daemon(tests/fm-crew-state.test.sh:3897) - selected run 01RUN at an unfetched pipeline head, ledger-anchored, daemon answered down, status-log tipworking: implementing(so LOG_VERB=working and the needs-decision|blocked case at :1032 is skipped). Output:state: unknown · source: run-step · no-mistakes daemon unreachable; last run record running - unverified; run id: 01RUN · run: 01RUN.The test's
assert_contains "$out" "run: 01RUN"is satisfied by the :1065 append alone, so it passes identically with or without the :813 suffix - it cannot detect the duplication it was retargeted alongside.Remedy: drop the
; run id: $selected_idsuffix at :813 and instead append${SEP}run: $SELECTED_RUN_IDinside the RUN_DEAD_DAEMON emit at :1044 (which exits before :1065). That keeps the id on the gate-tip path the original finding cared about without duplicating it on the ordinary path. The coarse route at :881 needs no change - it runs only when SELECTED_RUN_ID is empty, so it never duplicates.bin/fm-crew-state.sh:1044- Scope note, acknowledged tradeoff - no action requested. TheRUN_DEAD_DAEMONverdict plus the status-log reconciliation emit at :1042-1045 is the one component this branch introduced that reaches beyond "a live run is current after rebase": it changes the reading of the pre-existing coarse-failed path, which has nothing to do with a rebase. Same input before and after - crew on fm/feat-x,axi statusanswers another branch, ledger newest rowfailed <local head>, daemon answered down, log tipneeds-decision: approve the schema change- used to emitstate: unknown ... status-log superseded (run unknown)and now emitsstate: parked · source: status-log · approve the schema change · no-mistakes daemon unreachable; last ledger record failed - unverified.I am recording this rather than reporting it as an unrequired component because it is already settled: the daemon-answered-down guard is what makes the intent's own head-free bind safe (without it a zombie
runningrecord permanently masks a crew's real state), and round 13's user instruction explicitly kept the answered-down handoff while reverting only the coarse working/parked override.test_unanswered_probe_does_not_turn_a_failed_coarse_record_into_a_gate(tests/fm-crew-state.test.sh:4033) is the reciprocal negative control and is correctly asserted - it would fail if the arm still keyed off the fail-closed probe.🔧 Fix applied.
3 issues (2 warnings, 1 info) still open:
bin/fm-crew-state.sh:886- The dead-daemon verdict is applied to a coarse ledger row whose head TIES to the worktree, which the header at :70-76 says it must not be. That comment scopes the verdict to "the two routes that bind a run the worktree has MOVED OFF" and adds: "It is deliberately NOT extended to the head-matching arm - while the run head still equals or precedes the worktree HEAD the record keeps its original working reading." A head-tied coarse row is precisely a row whose head equals or precedes the worktree HEAD, so the two sentences name the same case on both sides of the rule, and line 886 implements the extension.Concrete divergence, same crew and same run:
running fm/feat-x <H>. Daemon answered down.axi statusanswers THIS crew's run (branch fm/feat-x, head H). Line 842nm_run_head_matches_worktreeis true, so the probe is never reached: HAVE_RUN=1, RUN_SOURCE=full, status running ->state: working · source: run-step · validating (running).axi statusanswers ANOTHER crew's run (the else branch at :862). COARSE_STATUS=running from the same ledger row at H; :886 sees class live, the parked guard is skipped because run_branch != CREW_BRANCH,nm_daemon_answered_downis true ->state: unknown · source: run-step · no-mistakes daemon unreachable; last ledger record running - unverified.Nothing about the run, its head, or the daemon differs between A and B - only which run the shared daemon's bare
axi statushappened to name, which the module's own comment at :722-726 calls "routine once several crews validate the same underlying repo concurrently".test_coarse_live_row_with_daemon_down_is_unverified(its ledger row is at${local_short}, the worktree's own head) locks in the B side; the head-matching arm locks in A.The defect lives inside the coarse-live extension the fix rounds added at :886-893, which is not required by the intent (the intent's fix is the head-free executing bind, not a new reading of head-tied coarse rows). The smallest honest remedy is to remove that extension, or to restrict it to coarse answers the worktree has genuinely moved off. Note that the narrower form is not currently expressible:
fm_nm_runs_status_for_worktreereturns the same status word for its head-matching path and its anchored-continuation path, so distinguishing them requires changing that shared helper's contract - the remedy, not the defect, is what needs authorization.bin/fm-crew-state.sh:812- The daemon-down guard the fix rounds added does not cover the sibling head-free route, so the zombie-record failure it exists for is still reachable.At :811-812 (and identically at :842-843) the condition is
nm_run_head_matches_worktree || fm_nm_run_is_pipeline_owned_active "$RUN_OUT" || { fm_nm_run_is_executing "$RUN_OUT" && ! nm_daemon_answered_down; }.fm_nm_run_is_pipeline_owned_active(bin/fm-nm-run-lib.sh:311-314) isbranch_sync.state=pipeline_owned && fm_nm_run_is_active- it binds ANY active run head-free, executing or parked - and it short-circuits the probe clause that follows it.Concrete sequence: crew fm/feat-x;
axi statusanswers its own run withstatus: running, no gate markers,branch_sync:\n state: pipeline_owned, andhead:at the pipeline's rebased/unfetched head; the daemon has died andno-mistakes daemon statusexits non-zero. Line 811 -> head does not match ->fm_nm_run_is_pipeline_owned_activetrue -> HAVE_RUN=1 with no probe and RUN_DEAD_DAEMON unset -> RUN_SOURCE=full ->state: working · source: run-step · validating (running). The identical record withstate: syncedinstead takes the executing clause, gets the probe, and readsunknown(test_anchored_continuation_still_needs_a_live_daemon) or leaves HAVE_RUN=0 (test_live_record_at_diverged_head_does_not_bind_an_unproven_record).branch_sync.stateis daemon-written state that goes stale in exactly the same way therunningword does, so it is not independent liveness evidence.The change also re-documented this predicate as parked-only without changing it: the header at :59-61 now says custody "binds an ACTIVE parked run without head equality" and bin/fm-nm-run-lib.sh:308-309 now says "a parked run whose pipeline currently owns the branch binds without head equality". Both previously said "ACTIVE run" / "a live run". The predicate still returns 0 for an executing run, so the comments assert a narrowing the code does not implement, which makes the gap invisible to a reader auditing the guard.
Remedy is a scope decision the author owns: either extend the guard (
fm_nm_run_is_pipeline_owned_active "$RUN_OUT" && ! nm_daemon_answered_downat both :812 and :843, which changes the reading of a pre-existing route the intent does not touch), or revert the two comments to say the custody exemption binds any active run and is deliberately outside the daemon rule. Do not leave the comments claiming parked-only while the code binds executing runs.bin/fm-nm-run-lib.sh:352-fm_nm_run_is_executing's contract comment justifies its accepted-word list with a claim the same change disproves: "The overview table fm_nm_select_run validates carries only pending|running|completed|failed|cancelled (:196), so on the modern selected-run route only pending and running ever reach here." The mirrored claim is in bin/fm-crew-state.sh:40-42 ("pending or running through the overview-backed route; also fixing or ci on the legacy bare-status surface").On the selected route,
RUN_OUTis reassigned at bin/fm-crew-state.sh:797 to the id-addressed DETAIL (axi status --run <id>), not the overview row, and that detail's vocabulary is validated at :803-806 aspending|running|fixing|ci|awaiting_approval|fix_review|completed|failed|cancelled. A run whose overview column readsrunningwhile its detail readsfixingpasses the class agreement check at :807-809 (both live) and reachesfm_nm_run_is_executingwith statusfixing. Sofixingandcireach the predicate on the modern route too.No behavior is wrong today - the predicate accepts those words either way. The risk is that the comment is the stated rationale for the word list: acting on it by narrowing the modern route to
pending|runningwould stop binding a fix round at a rebased head on the overview-backed surface, which is the exact misreport this change exists to prevent. Correct both comments to say the detail object carriesfixingandcion either surface.🔧 Fix applied.
4 issues (1 error, 1 warning, 2 infos) still open:
bin/fm-crew-state.sh:894- The round-16 fix gates the coarse dead-daemon verdict onrun_branch = CREW_BRANCH, justified at :887-889 as "Reaching this branch at all proves the head rule rejected the record, so a SAME-branch answer is necessarily moved-off". That proof applies to theaxi statusRECORD's head, butCOARSE_STATUS