Skip to content

fix(bin): treat a live no-mistakes run as current after rebase - #4973

Merged
kunchenguid merged 19 commits into
kunchenguid:mainfrom
rovermike:fm/fm-crew-state-rebase-finish
Sep 20, 2026
Merged

kunchenguid merged 19 commits into
kunchenguid:mainfrom
rovermike:fm/fm-crew-state-rebase-finish

Conversation

@rovermike

Copy link
Copy Markdown
Contributor

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.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…
Evidence: Crew-state scenario transcript (8 scenarios, incl. base-commit before/after)

Source: Crew-state scenario transcript (8 scenarios, incl. base-commit before/after)

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

Source: Fleet View (operator surface) before vs after, same fixture

# Fleet view of a crew whose pipeline run was rebased

One in-flight ship crew. Its status log's last event is `failed: earlier stage run`;
the no-mistakes run on its branch is live (`running`) at a rebased head, and an older
failed run still sits at the local head. Same fixture, base helper vs this change.

`` `
before ->
{
  "id": "feat-billing",
  "status_log_last_event": "failed",
  "current_state": {
    "state": "failed",
    "source": "status-log",
    "detail": "earlier stage run",
    "raw": "state: failed · source: status-log · earlier stage run",
    "observed_at": "2026-09-14T12:05:00Z",
    "freshness": "fresh"
  }
}

--- fm-fleet-view.sh (human render, before) ---
# Fleet View

Schema: fm-fleet-snapshot.v1
Home: /tmp/fmdrive/cases/snap-before/home

## Under Way
| ID | Current | Kind | Repo/Project | Backend | Endpoint | Artifact | Path | Watch / return channel |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| feat-billing | failed / status-log | ship | firstmate | tmux | present | - | /tmp/fmdrive/cases/snap-before/wt | bin/fm-peek.sh fm-feat-billing |

## Queued
No queued backlog records found.

## Done
No done backlog records found.

## Secondmates
For kind=secondmate, bearings selects validated structured state from that registered home; parent events and bounded terminal evidence are fallback-only supplements and never current-state authority.
`` `

`` `
after ->
{
  "id": "feat-billing",
  "status_log_last_event": "failed",
  "current_state": {
    "state": "working",
    "source": "run-step",
    "detail": "validating (running) · run: 01LIVE",
    "raw": "state: working · source: run-step · validating (running) · run: 01LIVE",
    "observed_at": "2026-09-14T12:05:00Z",
    "freshness": "fresh"
  }
}

--- fm-fleet-view.sh (human render, after) ---
# Fleet View

Schema: fm-fleet-snapshot.v1
Home: /tmp/fmdrive/cases/snap-after/home

## Under Way
| ID | Current | Kind | Repo/Project | Backend | Endpoint | Artifact | Path | Watch / return channel |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| feat-billing | working / run-step | ship | firstmate | tmux | present | - | /tmp/fmdrive/cases/snap-after/wt | bin/fm-peek.sh fm-feat-billing |

## Queued
No queued backlog records found.

## Done
No done backlog records found.

## Secondmates
For kind=secondmate, bearings selects validated structured state from that registered home; parent events and bounded terminal evidence are fallback-only supplements and never current-state authority.
`` `
Evidence: Targeted suite output for the rebase / daemon / coarse cases

Source: Targeted suite output for the rebase / daemon / coarse cases

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)
before: | feat-billing | failed / status-log | ship | firstmate | tmux | present |
after : | feat-billing | working / run-step | ship | firstmate | tmux | present |
- Outcome: ⚠️ 1 info across 1 run (10m30s)

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.)

⚠️ **Review** - 3 infos

🔧 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: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.

🔧 Fix applied.
3 issues (2 warnings, 1 info) still open:

  • ⚠️ 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.

🔧 Fix applied.
3 issues (1 warning, 2 infos) still open:

  • ⚠️ 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.

🔧 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:

  • 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.

🔧 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 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 at :880 comes from the LEDGER (fm_nm_runs_status_for_worktree with no expected-head), whose head-matching path (bin/fm-nm-run-lib.sh:452-457) returns the newest same-branch row's status word when THAT row's sha resolves and equals/precedes the worktree HEAD. The two heads are independent, so a same-branch answer is not necessarily moved-off and the verdict still lands on a head-tied row — exactly what the header at :70-76 says it must not do ("deliberately NOT extended to a head-tied record") and what the author's round-15 instruction forbade.

Concrete trace, taken from this change's OWN new test (tests/fm-crew-state.test.sh:4109, the self iteration):

  • Crew branch fm/feat-htied at local HEAD H. axi status (legacy bare surface — the fake overview is not a runs table, so fm_nm_select_run returns unavailable and SELECTED_RUN_ID stays empty) answers this branch's run 01RUN with status: running, head: abc1234 (not an object here), branch_sync.state: synced.
  • Ledger newest same-branch row: running fm/feat-htied <short(H)>. Daemon answered down (exit 1).
  • :846-848 → head does not match; pipeline_owned_active false (synced); is_executing true but ! nm_daemon_answered_down false ⇒ whole condition false ⇒ else branch at :878.
  • :880 ledger → row resolves, fm_nm_head_matches_worktree true ⇒ COARSE_STATUS=running. HAVE_RUN=1; :886 leaves RUN_SOURCE=full.
  • :894-897: run_branch = CREW_BRANCH ✓, class(running)=live ✓, RUN_OUT has no gate markers ✓, answered_down ✓ ⇒ RUN_DEAD_DAEMON set.
  • :915-921 ⇒ state: unknown · source: run-step · no-mistakes daemon unreachable; last ledger record running - unverified; run id: 01RUN.

The test asserts state: working and assert_not_contains "state: unknown", so the code and the test shipped in the same commit disagree; the other iteration (foreign-branch, no verdict) does read working, so the head-tied row still reads differently depending on which run the shared daemon's bare axi status names — the very divergence round 15 asked to remove. The same wrong label also reaches a pending ledger word, which only the head-matching path can ever produce.

The defect lives entirely inside the coarse dead-daemon extension the fix rounds added (:887-899), which the User intent does not require — the intent's fix is the head-free executing bind at :846-848, not a new reading of coarse ledger rows. The smallest honest remedy is to DELETE :887-899 (the author's round-15 instruction already authorized "or drop the extension"); restricting it properly is not expressible today because fm_nm_runs_status_for_worktree returns the same word for its head-matching and anchored-continuation paths, so a narrower gate would require changing that shared helper's contract — the remedy, not the defect, is what needs authorization. Dropping it also lets tests/fm-crew-state.test.sh:4109 pass as written.

  • ⚠️ bin/fm-crew-state.sh:1065 - Simplification: the [ "$RUN_SOURCE" = coarse ] && [ "$LOG_VERB" = needs-decision ] arm (added by fix round 3c59616) replaces the pre-existing user-visible detail "status-log superseded by active run" with "status-log not superseded: a coarse run record cannot tell working from parked" for every coarse live row over an open decision. The User intent is only "treat a live no-mistakes run as current after rebase"; it requires nothing about the coarse runs-ledger fallback, which the intent's fix (the head-free executing bind at :846-848) does not touch. No intent requirement needs this arm, and it changes what operators read for a pre-existing route. Recommend removing it and letting the coarse route keep its original supersede note; if the ambiguity note is wanted, that is a separate product decision.
  • ℹ️ bin/fm-nm-run-lib.sh:11 - The file header says both callers reach fm_nm_runs_status_for_worktree as "crew-state for an ACTIVE parked run". On the selected route that elif (bin/fm-crew-state.sh:817-833) is reached by any active run the three head-free binds rejected, which now includes an EXECUTING run whose daemon answered down — the code inside it says so explicitly at :826 (! fm_nm_run_is_parked "$RUN_OUT" && nm_daemon_answered_down), and test_selected_run_anchored_continuation_needs_a_live_daemon exercises exactly that. A reader auditing the daemon guard from this header would conclude the executing case never reaches the ledger rule. Correct it to "an ACTIVE run — parked, or executing with the daemon answered down".
  • ℹ️ bin/fm-crew-state.sh:41 - The header justifies the pending|running|fixing|ci word list with "every route reads the id-addressed detail object". The legacy bare-status route (:846-848) does not: it passes the bare axi status output captured at :778, never re-read with --run <id>. The corresponding comment in bin/fm-nm-run-lib.sh:346-351 states this correctly ("the legacy bare-status route passes the same detail SHAPE"). Align the header with it so the rationale is not read as a claim about how the record was fetched.

🔧 Fix applied.
5 issues (1 warning, 4 infos) still open:

  • ⚠️ bin/fm-crew-state.sh:924 - The round-16 instruction was to "DELETE the coarse dead-daemon extension entirely: the block that sets RUN_DEAD_DAEMON from a coarse ledger row". Commit 9b4bfc4 deleted only the LIVE-row block (:887-899); the coarse TERMINAL failed case at :920-926 still sets RUN_DEAD_DAEMON=$RUN_DETAIL from a coarse ledger row, and that value is what the new status-log hand-off at :1044-1046 consumes.

Concrete trace, taken verbatim from this change's own new test tests/fm-crew-state.test.sh:3960 (test_answered_down_failed_coarse_record_leaves_the_decision_open):

  • Crew branch fm/feat-cfad at local HEAD H. Status log tip: needs-decision: approve the schema change.
  • axi status names another crew's run (fm/other-crew) -> run_branch != CREW_BRANCH -> else branch at :873 -> coarse ledger read.
  • Ledger newest same-branch row: failed fm/feat-cfad <short(H)>. Its sha resolves and equals HEAD, so fm_nm_head_matches_worktree is true and fm_nm_runs_status_for_worktree returns failed. HAVE_RUN=1, RUN_SOURCE=coarse.
  • Daemon probe answers down (exit 1, not 124) -> :917 nm_daemon_probe_down true -> RUN_STATE=unknown, RUN_DETAIL="no-mistakes daemon unreachable; last ledger record failed - unverified"; :924 nm_daemon_answered_down true -> RUN_DEAD_DAEMON set.
  • :1042 LOG_VERB=needs-decision -> :1045 emits state: parked · source: status-log · approve the schema change · no-mistakes daemon unreachable; last ledger record failed - unverified.

Before this change the same inputs produced state: unknown · source: run-step · ... · status-log superseded (run unknown). The new label is a confident claim the evidence does not support: the ledger row is head-tied, so its identity is PROVEN, and it records a run that progressed all the way to a terminal failure at this worktree's exact head - which is positive evidence the earlier gate was answered and the decision closed. A dead daemon afterwards does not unmake a recorded terminal outcome. Reporting parked tells the supervisor a human decision is pending on a crew whose run actually failed, routing it to the decision queue instead of surfacing the failure; unknown was the honest reading for that ambiguity and is what the unanswered-probe sibling (test_unanswered_probe_does_not_turn_a_failed_coarse_record_into_a_gate, :3936) still asserts.

The defect lives entirely inside machinery a prior fix round introduced (538aa6b) on a route the User intent does not touch - the intent's fix is the head-free executing bind at :818 and :847-849, not a new reading of coarse terminal ledger rows. The smallest honest remedy is to revert that round's coarse addition: DELETE :920-926 (the if nm_daemon_answered_down; then RUN_DEAD_DAEMON=$RUN_DETAIL; fi block and its comment), restoring the pre-existing unknown · run-step · ... · status-log superseded (run unknown) reading, and delete test_answered_down_failed_coarse_record_leaves_the_decision_open plus the now-unreachable half of test_coarse_failed_path_probes_the_daemon_once's rationale. Because the remedy removes behavior a fix round deliberately added, it needs your authorization rather than an automatic repair; the selected-route verdict at :825-830 (the one route the header at :74-76 names) is unaffected and stays.

  • ℹ️ bin/fm-crew-state.sh:882 - Commit 9b4bfc4 deleted one line too many from this comment, leaving the sentence cut off mid-clause: "(RUN_SOURCE stays full); only a foreign-branch answer leaves" with no object, immediately followed by the code line. Restore the trailing "coarse status-word detail." so the rule the next line implements is actually stated.
  • ℹ️ bin/fm-crew-state.sh:124 - The step-3 header at :124-129 still documents the coarse needs-decision detail arm that commit 9b4bfc4 removed: "A COARSE live row over an open DECISION ... It therefore records the ambiguity in the DETAIL and leaves the state working." The code no longer records any such ambiguity - the coarse route now falls through to the original status-log superseded by active run note, which is exactly what the change's own test_coarse_live_row_does_not_claim_gate_superseded (tests/fm-crew-state.test.sh:4279) asserts. Delete those six lines so the header stops describing a detail string no route can emit.
  • ℹ️ bin/fm-crew-state.sh:731 - The nm_runs_list header now claims the coarse fallback only ever sees "a run that is parked or terminal, since an executing same-branch run binds before this fallback is reached." That is false on the route this change added: at :847-849 an EXECUTING same-branch record whose head does not match, is not pipeline-owned, and whose daemon ANSWERED down fails the bind and falls straight into the else branch at :873, reaching this fallback. The change's own test_coarse_head_tied_row_is_exempt_even_when_the_record_head_diverged (tests/fm-crew-state.test.sh:4087) drives exactly that path. A reader auditing the daemon gate from this comment would conclude the executing case cannot reach the coarse route and miss that a head-tied ledger row re-binds it as working. Reword to "parked, terminal, or executing with the daemon answered down".
  • ℹ️ tests/fm-crew-state.test.sh:4251 - Commit 9b4bfc4 inverted two tests' assertions to match the deleted extension but left their names and doc comments stating the opposite. test_coarse_live_row_with_daemon_down_is_unverified (:4251) is prefaced "an answered-down daemon must unverify it the same way - and say so" yet now asserts state: working and assert_not_contains "daemon unreachable"; test_coarse_live_row_does_not_claim_gate_superseded (:4279) is prefaced "must never claim the crew's own needs-decision event was superseded" yet now asserts superseded by active run is present. Both names/comments describe behavior the code deliberately does not have, so a future reader will read them as a regression rather than the intended exemption. Rename to match what they now prove (e.g. ..._is_exempt_from_the_dead_daemon_verdict, ..._keeps_the_original_supersede_note) and rewrite the two comment blocks.

🔧 Fix applied.
3 infos still open:

  • ℹ️ bin/fm-crew-state.sh:840 - The comment added at :835-842 states an unconditional guarantee the adjacent code does not provide: "The head-free route additionally needs the daemon not provably down, so a record left saying running by a dead daemon stops answering once the worktree moves off the run head."

Concrete reachable sequence on the legacy surface (no overview table, so fm_nm_select_run answers unavailable, SELECTED_RUN_ID stays empty and this block runs - the same surface this change's own test_legacy_live_rebased_run_is_authoritative at tests/fm-crew-state.test.sh:3520 exercises):

  • Crew branch fm/x at local HEAD H. Bare axi status record: branch fm/x, status running, head R (diverged, resolvable or not), branch_sync synced.
  • :843 nm_run_head_matches_worktree false; fm_nm_run_is_pipeline_owned_active false; fm_nm_run_is_executing true; nm_daemon_answered_down TRUE -> ! nm_daemon_answered_down false -> whole condition false -> else branch at :872.
  • :876 COARSE_STATUS=$(fm_nm_runs_status_for_worktree ...). The ledger's newest fm/x row sits at H, so fm_nm_head_matches_worktree succeeds and its status word is returned. HAVE_RUN=1.
  • :880 [ "$run_branch" = "$CREW_BRANCH" ] || RUN_SOURCE=coarse - run_branch IS CREW_BRANCH here, so RUN_SOURCE stays full.
  • :902 RUN_DEAD_DAEMON is empty and RUN_SOURCE != coarse, so the report is parsed from $RUN_OUT - the very record the gate just rejected - yielding state: working · source: run-step · validating (running).

So the record does not stop answering; it answers through the fallback with its own status word. The change's own negative test (tests/fm-crew-state.test.sh:3548 test_live_record_at_diverged_head_does_not_bind_an_unproven_record) passes only because it sets FM_FAKE_RUNS_LIST="", and its doc comment already concedes the real rule: "Once the daemon answers down AND no ledger row anchors the run".

This is a comment defect only - the else branch is untouched by this change and produced the identical reading before it, so no behavior regressed. Remedy: qualify the comment to match the code, e.g. "...stops answering once the worktree moves off the run head AND no ledger row ties this branch to the worktree's head; when such a row exists the fallback below re-binds the record with RUN_SOURCE=full."

  • ℹ️ tests/fm-crew-state.test.sh:3722 - Two test rationales left behind by commit 4086a61 still describe the coarse dead-daemon / gate-ambiguity arm that the same commit deleted:
  1. :3722 test_coarse_live_row_over_ordinary_blocked_keeps_superseded_reading is prefaced "Only a gate is ambiguous under a coarse live row." Nothing is ambiguous under a coarse live row any more - the coarse route carries no special open-decision reading at all, which is exactly what its neighbour test_coarse_live_row_keeps_the_original_supersede_note (:4219) now asserts. The comment tells a future reader a distinction exists that the code cannot make.

  2. :3934-3935 test_unanswered_probe_does_not_turn_a_failed_coarse_record_into_a_gate is prefaced "A probe that did not ANSWER proves nothing, so it must not hand the verdict to a stale open decision". The coarse failed arm at bin/fm-crew-state.sh:914 now calls only nm_daemon_probe_down, which maps both unanswered (124) and down to the same not-up bucket, so no probe answer can hand any verdict anywhere on this route. As a result this test is behaviorally identical to test_coarse_failed_record_with_dead_daemon_reads_unknown (:4144): same fixture shape, same three assertions, differing only in FM_FAKE_DAEMON_TIMEOUT vs FM_FAKE_DAEMON_DOWN, which the code no longer distinguishes here.

Remedy: rewrite the :3722 comment to say the coarse route simply keeps the pre-existing supersede reading, and either delete the now-redundant :3935 test or re-point its comment at what it still proves (that nm_daemon_probe_down is deliberately fail-closed, so an unanswered probe degrades the terminal record to unknown rather than reporting failed).

  • ℹ️ tests/fm-crew-state.test.sh:110 - FM_FAKE_DAEMON_PROBE_LOG was introduced by fix round 4b46afd purely to support test_coarse_failed_path_probes_the_daemon_once, and commit 4086a61 deleted that test. The plumbing survives in three places with no consumer: the fake daemon's append at :110, the reset at :306, and the export at :318. Nothing in the suite sets it, so it is dead scaffolding the change introduced and then orphaned.

The caching it was written to prove is still load-bearing (bin/fm-crew-state.sh:814 and :823 both call nm_daemon_answered_down on the selected executing + unresolvable-head + anchored-continuation path, so nm_daemon_probe saves one bounded 10s subprocess there). So the remedy is either to delete the three lines, or to re-point a probe-count assertion at that surviving double-call path - not to leave the hook unused.

⚠️ **Test** - 1 info
  • ℹ️ tests/fm-teardown.test.sh:2207 - tests/fm-teardown.test.sh fails on herdr-preflight-missing-adapter: teardown continued without its required preflight. I re-ran the same suite from a clean extract of the base commit (2bcb88c) and it fails identically there, so it is pre-existing and unrelated to this change (which only adds predicates/regex constants to bin/fm-nm-run-lib.sh that teardown does not call). Informational only - no action taken.
  • 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…
  • bash tests/fm-crew-state.test.sh (full targeted suite for the changed reader - all cases pass, including the 35 new rebase/daemon cases)
  • bash tests/fm-fleet-snapshot-view.test.sh (snapshot + fleet-view consumers of the changed reader)
  • Manual product drive: real git crew worktrees + real state/<id>.meta,.status + fake no-mistakes CLI, running bin/fm-crew-state.sh &lt;id&gt; for 8 scenarios / 12 assertions (script: /tmp/fmdrive/scenarios.sh)
  • A/B of the identical rebase fixture against the base-commit helper extracted with git archive 2bcb88c bin, reproducing the reported misreport
  • Operator surface: bin/fm-fleet-snapshot.sh --json and bin/fm-fleet-view.sh over a fixture FM_HOME with one in-flight ship crew, base vs change
  • bash tests/fm-teardown.test.sh (shared fm-nm-run-lib consumer) and the same suite from a base-commit tree extract, to classify its one failure as pre-existing
✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → no changes applied ✅
  • ⚠️ linter found issues (exit code 1)

🔧 No changes applied.
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

Loading
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.

2 participants