Skip to content

fix(bin): stop re-waking main for inactive outcomes already presented as branch outcomes - #7306

Open
andersmoldin wants to merge 5 commits into
kunchenguid:mainfrom
andersmoldin:fm/fm-inactive-repeat
Open

andersmoldin wants to merge 5 commits into
kunchenguid:mainfrom
andersmoldin:fm/fm-inactive-repeat

Conversation

@andersmoldin

@andersmoldin andersmoldin commented Oct 14, 2026 •

Copy link
Copy Markdown

Intent

Firstmates retrospektiv 2026-10-14, punkt 4 som den lades fram: "Upprepade aviseringar om PR:er som redan var presenterade. Vad hände: "Inactive terminal outcome awaiting captain presentation" kom för PR 141, 144, 148, 151 och fler, trots att jag redan hade visat dem för dig. Varje avisering kostade en tur och ett meddelande till dig. Rättning: när huvudsessionen har presenterat ett utfall bör det markeras som presenterat, till exempel med fm-branch-outcome.sh mark-presented <id>, så att aviseringen inte kommer igen."

Molle om punkt 4: "Jag vet inte om det finns några inställningar för firstmate, men det är ganska babbligt just nu. Om jag har missat ett par meddelanden är det väldigt mycket att läsa ikapp." Efter att /quiet visat sig inte behövas (övervakningssessionen håller redan rutinhändelser borta) och firstmate rekommenderat att rätta upprepningen: "Vi testar retro 4."

Exempel ur dagens kö (väckningsrader som main fick): check inactive-outcome:<hash> inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151, som kom efter att supervision-host redan levererat ett BRANCH OUTCOME för samma PR (seq 348) som main hade presenterat och markerat med bin/fm-branch-outcome.sh mark-processed --through 348. Samma sak för aslan-coach-mcpfel PR 141 och aslan-b09-tavla PR 144.

What Changed

  • Added a read-only, lock-free bin/fm-branch-outcome.sh processed-covers --task <id> --state done|failed [--pr <url>] query. It exits 0 and prints the seq when the newest processed captain outcome for the task still covers its terminal outcome. "Covers" means three things: the status file identity is unchanged, the latest event and the event at the recorded endpoint both have the same terminal state, and the PR URL appears there as a whole word. Legacy rows without provenance, and a store, cursor or marker that is unreadable or out of order, count as not covered.
  • bin/fm-inactive-reconcile.sh scan now runs processed-covers before queueing an "inactive terminal outcome awaiting captain presentation" wake. The query runs within the scan's remaining timeout and only when a branch outcome store exists. If it reports covered, the scan moves the pending receipt to .presented and queues no wake. If the query times out, the scan tries again next time. A new presented <fingerprint> query reports whether an outcome is already presented, either through its receipt or through a covering processed branch outcome.
  • bin/fm-wake-drain.sh now removes inactive-outcome rows from the printed output when presented reports them as already presented. These rows stay inside the acknowledged range, so --ack-through still consumes them. docs/supervision-host.md describes both behaviors.

Risk Assessment

⚠️ Medium: The change edits the main wake-drain delivery path, adds lock-free coverage reads, and has been through three fix rounds. Every uncertain read (unreadable or partial store, out-of-order markers, identity mismatch, timeout) fails safe toward still notifying, and the user-prescribed orderings are covered. The one remaining gap is that no test proves the drain still prints rows that are not covered.

Testing

Jag körde den riktade testfilen tests/fm-inactive-reconcile.test.sh, och alla tester gick igenom, även de tre nya. Sedan körde jag fem live-scenarier med de riktiga skripten mot ett eget labbhem (fm-lab-home.sh). Labbet hade en privat tmux-socket med ett riktigt fönster för barnet, och den riktiga busy-state-skrivaren (fm-busy-event.sh). Därför rapporterade den riktiga fm-crew-state.sh "state: done" för PR 151. Barnet hette aslan-ikon-beskuren, med samma PR-URL som i intentet. - Vanliga ordningen: när PR:en var kvitterad före skanningen köade skanningen ingen väckning, och utfallet markerades som presenterat. - Skanning före kvittens: när väckningen redan låg i kön hölls den undan vid tömningen. Det gällde både vid tömning direkt efter mark-processed och efter en omskanning. Den vanliga --ack-through förbrukade ändå raden, och en andra tömning visade ingenting. - Adversariella fall: ett utfall som bara var läst, och ett nytt failed: efter ett kvitterat done:, gav fortfarande avisering. - Baslinje: samma sekvens mot bascommiten 0397cb2b gav aviseringen för den redan presenterade PR 151 i båda ordningarna. Det finns inget grafiskt gränssnitt, så evidensen är CLI-transkript. Labbhem, tmux-servrar och temporära filer togs bort efteråt, och worktree:n är ren.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Main har presenterat och kvitterat ett BRANCH OUTCOME för PR 151 (mark-processed) före nästa inaktiv-skanning; skanningen köar ingen avisering, kvittot blir .presented och tömningen visar ingen inacti… ✅ pass live live-processed-first.txt (baslinje baseline-0397cb2b-processed-first.txt visar att den gamla koden köade och visade aviseringen)
Skanningen köar aviseringen medan utfallet bara är läst; main kör mark-processed och tömmer direkt utan omskanning; tömningen visar ingen 'awaiting captain presentation'-rad, --ack-through förbrukar r… ✅ pass live live-scan-first-drain-now.txt (baslinje baseline-0397cb2b-scan-first-drain-now.txt visar upprepningen före rättningen)
Skanningen köar aviseringen, main kör mark-processed och en omskanning flyttar kvittot till .presented; tömningen håller undan den köade raden och ack förbrukar den ✅ pass live live-scan-first-rescan.txt
Adversariellt: utfallet är läst men inte kvitterat (mark-processed saknas); main ska fortfarande aviseras om det inaktiva utfallet ✅ pass live live-read-only.txt
Adversariellt: barnet skriver ett nytt failed:-utfall efter det kvitterade done:-utfallet; det nya utfallet ska aviseras och inte döljas av den gamla kvittensen ✅ pass live live-failed-after.txt
Evidence: Live: kvitterad PR före skanning ger ingen väckning

Source: Live: kvitterad PR före skanning ger ingen väckning

lab tmux: firstmate:fm-aslan-ikon-beskuren
== scenario: processed-first  (FM_HOME=lab home, real fm-crew-state.sh, real branch-outcome store)

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-crew-state.sh aslan-ikon-beskuren
state: done · source: status-log · PR https://github.com/andersmoldin/aslan-private/pull/151 checks green
[exit 0]

$ supervision-host records the captain BRANCH OUTCOME for PR 151
seq=1

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-branch-outcome.sh mark-read --through 1
[exit 0]

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-branch-outcome.sh mark-processed --through 1
[exit 0]

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-inactive-reconcile.sh scan --startup
[exit 0]

$ wake queue before drain
(empty)

$ terminal-outcome receipts
87e396f4274a61b0fc1f19d9c18fab9f.presented

$ fm-wake-drain.sh (what main sees)
[exit 0]
--- stdout
--- stderr
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

$ second drain (repeat check)
(no inactive-outcome rows)
Evidence: Live: köad väckning hålls undan vid omedelbar tömning och förbrukas av ack

Source: Live: köad väckning hålls undan vid omedelbar tömning och förbrukas av ack

lab tmux: firstmate:fm-aslan-ikon-beskuren
== scenario: scan-first-drain-now  (FM_HOME=lab home, real fm-crew-state.sh, real branch-outcome store)

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-crew-state.sh aslan-ikon-beskuren
state: done · source: status-log · PR https://github.com/andersmoldin/aslan-private/pull/151 checks green
[exit 0]

$ supervision-host records the captain BRANCH OUTCOME for PR 151
seq=1

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-branch-outcome.sh mark-read --through 1
[exit 0]

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-inactive-reconcile.sh scan --startup
actionable: inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151
[exit 0]

$ wake queue after scan
1792007597	1	check	inactive-outcome:87e396f4274a61b0fc1f19d9c18fab9f	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-branch-outcome.sh mark-processed --through 1
[exit 0]

$ wake queue before drain
1792007597	1	check	inactive-outcome:87e396f4274a61b0fc1f19d9c18fab9f	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151

$ terminal-outcome receipts
87e396f4274a61b0fc1f19d9c18fab9f.pending

$ fm-wake-drain.sh (what main sees)
[exit 0]
--- stdout
--- stderr
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 93096.1792007597.iD4WMo
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  After draining queued wakes, watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.

$ wake queue after acknowledgement

$ receipts after acknowledgement
87e396f4274a61b0fc1f19d9c18fab9f.presented

$ second drain (repeat check)
(no inactive-outcome rows)
Evidence: Live: köad väckning hålls undan efter omskanning

Source: Live: köad väckning hålls undan efter omskanning

lab tmux: firstmate:fm-aslan-ikon-beskuren
== scenario: scan-first-rescan  (FM_HOME=lab home, real fm-crew-state.sh, real branch-outcome store)

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-crew-state.sh aslan-ikon-beskuren
state: done · source: status-log · PR https://github.com/andersmoldin/aslan-private/pull/151 checks green
[exit 0]

$ supervision-host records the captain BRANCH OUTCOME for PR 151
seq=1

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-branch-outcome.sh mark-read --through 1
[exit 0]

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-inactive-reconcile.sh scan --startup
actionable: inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151
[exit 0]

$ wake queue after scan
1792007602	1	check	inactive-outcome:87e396f4274a61b0fc1f19d9c18fab9f	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-branch-outcome.sh mark-processed --through 1
[exit 0]

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-inactive-reconcile.sh scan
[exit 0]

$ wake queue before drain
1792007602	1	check	inactive-outcome:87e396f4274a61b0fc1f19d9c18fab9f	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151

$ terminal-outcome receipts
87e396f4274a61b0fc1f19d9c18fab9f.presented

$ fm-wake-drain.sh (what main sees)
[exit 0]
--- stdout
--- stderr
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 98034.1792007602.NW8NIa
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  After draining queued wakes, watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.

$ wake queue after acknowledgement

$ receipts after acknowledgement
87e396f4274a61b0fc1f19d9c18fab9f.presented

$ second drain (repeat check)
(no inactive-outcome rows)
Evidence: Live adversariellt: läst men inte kvitterat utfall avviseras fortfarande

Source: Live adversariellt: läst men inte kvitterat utfall avviseras fortfarande

lab tmux: firstmate:fm-aslan-ikon-beskuren
== scenario: read-only  (FM_HOME=lab home, real fm-crew-state.sh, real branch-outcome store)

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-crew-state.sh aslan-ikon-beskuren
state: done · source: status-log · PR https://github.com/andersmoldin/aslan-private/pull/151 checks green
[exit 0]

$ supervision-host records the captain BRANCH OUTCOME for PR 151
seq=1

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-branch-outcome.sh mark-read --through 1
[exit 0]

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-inactive-reconcile.sh scan --startup
actionable: inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151
[exit 0]

$ wake queue before drain
1792007609	1	check	inactive-outcome:87e396f4274a61b0fc1f19d9c18fab9f	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151

$ terminal-outcome receipts
87e396f4274a61b0fc1f19d9c18fab9f.pending

$ fm-wake-drain.sh (what main sees)
[exit 0]
--- stdout
1792007609	1	check	inactive-outcome:87e396f4274a61b0fc1f19d9c18fab9f	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151
BRANCH OUTCOMES (captain outcomes the supervision session recorded for you, one line per task, oldest first; each says what was true when it was recorded, so check the task's current state first, including its still-open decisions listed above under OPEN DECISIONS, and sort them into still open and already settled, such as a decision since answered, a PR since merged, or a task since finished - process the still-open ones as firstmate: tell the captain, land or merge what is ready, answer or escalate a decision, or act on a blocker; your reply to the captain covers only those, as if the settled ones had never been listed, and a settled one needs only the acknowledgement):
[seq 1, recorded 0m ago] aslan-ikon-beskuren: aslan-ikon-beskuren is ready for review: https://github.com/andersmoldin/aslan-private/pull/151
BRANCH OUTCOMES: after processing them run bin/fm-branch-outcome.sh mark-processed --through 1; until then every drain presents them again
--- stderr
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 1579.1792007609.WgtZw6
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  After draining queued wakes, watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.

$ wake queue after acknowledgement

$ receipts after acknowledgement
87e396f4274a61b0fc1f19d9c18fab9f.presented

$ second drain (repeat check)
(no inactive-outcome rows)
Evidence: Live adversariellt: nytt failed:-utfall efter kvitterat done: avviseras

Source: Live adversariellt: nytt failed:-utfall efter kvitterat done: avviseras

lab tmux: firstmate:fm-aslan-ikon-beskuren
== scenario: failed-after  (FM_HOME=lab home, real fm-crew-state.sh, real branch-outcome store)

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-crew-state.sh aslan-ikon-beskuren
state: done · source: status-log · PR https://github.com/andersmoldin/aslan-private/pull/151 checks green
[exit 0]

$ supervision-host records the captain BRANCH OUTCOME for PR 151
seq=1

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-branch-outcome.sh mark-read --through 1
[exit 0]

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-branch-outcome.sh mark-processed --through 1
[exit 0]

$ ~/.no-mistakes/worktrees/f161056694a7/01M4XPCB40FYFDXW1XMRRWJQVQ/bin/fm-inactive-reconcile.sh scan --startup
actionable: inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=failed pr=https://github.com/andersmoldin/aslan-private/pull/151
[exit 0]

$ wake queue before drain
1792007615	1	check	inactive-outcome:083affdaa4e6952030693033fe094484	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=failed pr=https://github.com/andersmoldin/aslan-private/pull/151

$ terminal-outcome receipts
083affdaa4e6952030693033fe094484.pending

$ fm-wake-drain.sh (what main sees)
[exit 0]
--- stdout
1792007615	1	check	inactive-outcome:083affdaa4e6952030693033fe094484	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=failed pr=https://github.com/andersmoldin/aslan-private/pull/151
STATUS OUTCOME BACKSTOP (newest captain-facing task event has no covering branch outcome):
aslan-ikon-beskuren failed: the PR was closed after review
--- stderr
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 4502.1792007615.t4ZqQW
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  After draining queued wakes, watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.

$ wake queue after acknowledgement

$ receipts after acknowledgement
083affdaa4e6952030693033fe094484.presented

$ second drain (repeat check)
(no inactive-outcome rows)
Evidence: Baslinje 0397cb2: felet återskapat (kvittens före skanning)

Source: Baslinje 0397cb2b: felet återskapat (kvittens före skanning)

lab tmux: firstmate:fm-aslan-ikon-beskuren
== scenario: processed-first  (FM_HOME=lab home, real fm-crew-state.sh, real branch-outcome store)

$ /var/folders/7j/0y2hj3v547q6nx4my7w1t5x40000gn/T//fmlive-drv/base/bin/fm-crew-state.sh aslan-ikon-beskuren
state: done · source: status-log · PR https://github.com/andersmoldin/aslan-private/pull/151 checks green
[exit 0]

$ supervision-host records the captain BRANCH OUTCOME for PR 151
seq=1

$ /var/folders/7j/0y2hj3v547q6nx4my7w1t5x40000gn/T//fmlive-drv/base/bin/fm-branch-outcome.sh mark-read --through 1
[exit 0]

$ /var/folders/7j/0y2hj3v547q6nx4my7w1t5x40000gn/T//fmlive-drv/base/bin/fm-branch-outcome.sh mark-processed --through 1
[exit 0]

$ /var/folders/7j/0y2hj3v547q6nx4my7w1t5x40000gn/T//fmlive-drv/base/bin/fm-inactive-reconcile.sh scan --startup
actionable: inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151
[exit 0]

$ wake queue before drain
1792007622	1	check	inactive-outcome:87e396f4274a61b0fc1f19d9c18fab9f	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151

$ terminal-outcome receipts
87e396f4274a61b0fc1f19d9c18fab9f.pending

$ fm-wake-drain.sh (what main sees)
[exit 0]
--- stdout
1792007622	1	check	inactive-outcome:87e396f4274a61b0fc1f19d9c18fab9f	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151
--- stderr
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 11628.1792007622.Yj3Ftl
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  After draining queued wakes, watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.

$ wake queue after acknowledgement

$ receipts after acknowledgement
87e396f4274a61b0fc1f19d9c18fab9f.presented

$ second drain (repeat check)
(no inactive-outcome rows)
Evidence: Baslinje 0397cb2: felet återskapat (skanning före kvittens, omedelbar tömning)

Source: Baslinje 0397cb2b: felet återskapat (skanning före kvittens, omedelbar tömning)

lab tmux: firstmate:fm-aslan-ikon-beskuren
== scenario: scan-first-drain-now  (FM_HOME=lab home, real fm-crew-state.sh, real branch-outcome store)

$ /var/folders/7j/0y2hj3v547q6nx4my7w1t5x40000gn/T//fmlive-drv/base/bin/fm-crew-state.sh aslan-ikon-beskuren
state: done · source: status-log · PR https://github.com/andersmoldin/aslan-private/pull/151 checks green
[exit 0]

$ supervision-host records the captain BRANCH OUTCOME for PR 151
seq=1

$ /var/folders/7j/0y2hj3v547q6nx4my7w1t5x40000gn/T//fmlive-drv/base/bin/fm-branch-outcome.sh mark-read --through 1
[exit 0]

$ /var/folders/7j/0y2hj3v547q6nx4my7w1t5x40000gn/T//fmlive-drv/base/bin/fm-inactive-reconcile.sh scan --startup
actionable: inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151
[exit 0]

$ wake queue after scan
1792007628	1	check	inactive-outcome:87e396f4274a61b0fc1f19d9c18fab9f	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151

$ /var/folders/7j/0y2hj3v547q6nx4my7w1t5x40000gn/T//fmlive-drv/base/bin/fm-branch-outcome.sh mark-processed --through 1
[exit 0]

$ wake queue before drain
1792007628	1	check	inactive-outcome:87e396f4274a61b0fc1f19d9c18fab9f	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151

$ terminal-outcome receipts
87e396f4274a61b0fc1f19d9c18fab9f.pending

$ fm-wake-drain.sh (what main sees)
[exit 0]
--- stdout
1792007628	1	check	inactive-outcome:87e396f4274a61b0fc1f19d9c18fab9f	inactive terminal outcome awaiting captain presentation: child=aslan-ikon-beskuren state=done pr=https://github.com/andersmoldin/aslan-private/pull/151
--- stderr
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 15307.1792007629.L4t46B
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  After draining queued wakes, watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.

$ wake queue after acknowledgement

$ receipts after acknowledgement
87e396f4274a61b0fc1f19d9c18fab9f.presented

$ second drain (repeat check)
(no inactive-outcome rows)
Evidence: Labbdrivare som användes för alla live-scenarier

Source: Labbdrivare som användes för alla live-scenarier

#!/usr/bin/env bash
# Live driver: real firstmate scripts against a disposable lab home.
# usage: drive.sh <repo-root> <scenario>
set -u
ROOT=$1 SCEN=$2
BIN="$ROOT/bin"
LAB=$(mktemp -d "${TMPDIR:-/tmp}/fm-lab.XXXXXX")
rmdir "$LAB"; "$BIN/fm-lab-home.sh" create "$LAB" >/dev/null || exit 1
TD=$("$BIN/fm-lab-home.sh" tmux-dir "$LAB") || exit 1
cleanup() { TMUX_TMPDIR="$TD" tmux -L fm-lab kill-server 2>/dev/null; "$BIN/fm-lab-home.sh" teardown "$LAB"; rm -rf "$LAB"; }
trap cleanup EXIT
export FM_HOME="$LAB"
unset FM_ROOT_OVERRIDE FM_STATE_OVERRIDE FM_DATA_OVERRIDE FM_CONFIG_OVERRIDE FM_PROJECTS_OVERRIDE NO_MISTAKES_GATE FM_GATE_REFUSE_BYPASS TMUX
export TMUX_TMPDIR="$TD"
export FM_INACTIVE_RECONCILE_SECS=60
S="$LAB/state"
PR=https://github.com/andersmoldin/aslan-private/pull/151
ID=aslan-ikon-beskuren
old() { local t; t=$(date -r $(( $(date +%s) - 300 )) +%Y%m%d%H%M.%S); touch -t "$t" "$@"; }
say() { printf '\n$ %s\n' "$*"; }
run() { say "$*"; "$@"; rc=$?; printf '[exit %s]\n' "$rc"; return $rc; }

# A finished ship child whose PR is recorded and whose head is reachable on origin.
mkdir -p "$LAB/projects/$ID"
git -C "$LAB/projects/$ID" init -q
git -C "$LAB/projects/$ID" -c user.name=lab -c user.email=lab@example.invalid commit -q --allow-empty -m init
SHA=$(git -C "$LAB/projects/$ID" rev-parse HEAD)
git -C "$LAB/projects/$ID" update-ref refs/remotes/origin/main "$SHA"
cat > "$S/$ID.meta" <<EOF
window=firstmate:fm-$ID
worktree=$LAB/projects/$ID
project=$LAB/projects/$ID
harness=claude
kind=ship
mode=no-mistakes
yolo=off
spawn_gen=lab.1
pr=$PR
pr_head=$SHA
EOF
printf 'done: PR %s checks green\n' "$PR" > "$S/$ID.status"
: > "$S/$ID.turn-ended"
# The child's Claude Stop hook recorded its turn as finished (the real busy-state writer).
"$BIN/fm-busy-event.sh" arm "$S" "$ID" --state idle --source claude-hook --event stop >/dev/null || exit 1
old "$S/$ID.meta" "$S/$ID.status" "$S/$ID.turn-ended" "$S/$ID.busy-state" "$S/$ID.busy-gen"

# The child's real tmux window on the lab's private socket, idle at a prompt.
tmux -L fm-lab new-session -d -s firstmate -n "fm-$ID" -x 120 -y 30 "sh -c 'printf \"> \"; exec cat'"
export TMUX="$TD/tmux-$(id -u)/fm-lab,0,0"
sleep 1
echo "lab tmux: $(tmux list-windows -a -F '#{session_name}:#{window_name}')"
echo "== scenario: $SCEN  (FM_HOME=lab home, real fm-crew-state.sh, real branch-outcome store)"
run "$BIN/fm-crew-state.sh" "$ID"
say "supervision-host records the captain BRANCH OUTCOME for PR 151"
SEQ=$("$BIN/fm-branch-outcome.sh" append --task "$ID" --verdict captain --summary "$ID is ready for review: $PR"); echo "seq=$SEQ"
run "$BIN/fm-branch-outcome.sh" mark-read --through "$SEQ"
case "$SCEN" in
  processed-first)
    run "$BIN/fm-branch-outcome.sh" mark-processed --through "$SEQ"
    run "$BIN/fm-inactive-reconcile.sh" scan --startup ;;
  scan-first-drain-now|scan-first-rescan)
    run "$BIN/fm-inactive-reconcile.sh" scan --startup
    say "wake queue after scan"; cat "$S/.wake-queue" 2>/dev/null || echo '(empty)'
    run "$BIN/fm-branch-outcome.sh" mark-processed --through "$SEQ"
    if [ "$SCEN" = scan-first-rescan ]; then old "$S/.inactive-outcome-reconcile"; run "$BIN/fm-inactive-reconcile.sh" scan; fi ;;
  read-only)
    run "$BIN/fm-inactive-reconcile.sh" scan --startup ;;
  failed-after)
    run "$BIN/fm-branch-outcome.sh" mark-processed --through "$SEQ"
    printf 'failed: the PR was closed after review\n' >> "$S/$ID.status"; old "$S/$ID.status"
    run "$BIN/fm-inactive-reconcile.sh" scan --startup ;;
  other-pr)
    sed -i '' 's#pull/151#pull/15#' "$S/$ID.meta"
    printf 'done: PR %s checks green\n' "${PR%151}15" > "$S/$ID.status"; old "$S/$ID.status" "$S/$ID.meta"
    # store still names pull/151 in the summary, but provenance captured the earlier status; rebuild: append fresh outcome for pull/151 is n/a
    run "$BIN/fm-branch-outcome.sh" mark-processed --through "$SEQ"
    run "$BIN/fm-inactive-reconcile.sh" scan --startup ;;
esac
say "wake queue before drain"; cat "$S/.wake-queue" 2>/dev/null || echo '(empty)'
say "terminal-outcome receipts"; ls "$S/terminal-outcomes" 2>/dev/null
say "fm-wake-drain.sh (what main sees)"
"$BIN/fm-wake-drain.sh" > "$LAB/drain.out" 2> "$LAB/drain.err"; echo "[exit $?]"
echo "--- stdout"; cat "$LAB/drain.out"; echo "--- stderr"; cat "$LAB/drain.err"
ACK=$(sed -n 's/^WAKE_ACK_REQUIRED: *\(.*\)$/\1/p' "$LAB/drain.err" | head -1)
SEQA=$(sed -n 's/^WAKE_ACK_REQUIRED:.*--ack-through \([0-9][0-9]*\) --recovery-generation .*/\1/p' "$LAB/drain.err")
GEN=$(sed -n 's/^WAKE_ACK_REQUIRED:.*--recovery-generation \([A-Za-z0-9._-][A-Za-z0-9._-]*\)$/\1/p' "$LAB/drain.err")
if [ -n "$SEQA" ]; then
  run "$BIN/fm-wake-drain.sh" --ack-through "$SEQA" --recovery-generation "$GEN" >/dev/null
  say "wake queue after acknowledgement"; cat "$S/.wake-queue" 2>/dev/null || echo '(empty)'
  say "receipts after acknowledgement"; ls "$S/terminal-outcomes"
fi
say "second drain (repeat check)"
"$BIN/fm-wake-drain.sh" 2>&1 | grep -E 'awaiting captain presentation|inactive-outcome' || echo '(no inactive-outcome rows)'
Evidence: Riktad testfil, logg

Source: Riktad testfil, logg

actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
ok - main direct terminal presentation has a durable receipt
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
ok - a branch-actor acknowledgement retires the inactive-outcome receipt and later scans stay quiet
ok - a processed branch outcome counts as the presentation of the same terminal outcome
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
ok - a wake queued before main processed the branch outcome is withheld and still acknowledged
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
actionable: inactive terminal outcome awaiting captain presentation: child=child state=failed pr=https://example.test/owner/repo/pull/1
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
ok - an outcome main did not process as a branch outcome is still presented
ok - unpushed CI-ready ship done: is not published upstream
ok - a delivered ship done: skips the git gate on later polls
ok - secondmate delivers a child's terminal ledger line once, on the next poll, from the ledger alone
ok - multiline terminal outcomes are reported once before or during a state read
ok - an unterminated continuation line does not withhold a proven child outcome
ok - later status prose does not change the inactive terminal receipt identity
ok - busy child locks do not starve later ledger outcomes
ok - ledger delivery carries the report pointer, the failed verb, and each new terminal line
ok - pr= requires the recorded PR or a ready-signal terminal line, whatever its stamp, and never a scout
ok - terminal lines arriving during state reads remain ledger-owned
ok - inactive and ledger paths reconcile one raced completion without hiding later events
ok - progress after an inactive fallback starts a distinct terminal event
ok - complete long ledger lines retain distinct receipt identities
ok - a ledger line still being appended waits for its newline
ok - the remote route carries a child's ledger line once
ok - report delivers a child's final line, owes nothing twice, and refuses only an unwritable channel
actionable: child outcome needs parent report: child=child state=done (missing or unreadable parent binding .fm-secondmate-parent)
ok - a pending ship done: is delivered by report after teardown removed the worktree
ok - report preserves teardown's metadata-before-scan lock order
actionable: child outcome needs parent report: child=child state=failed (missing or unreadable parent binding .fm-secondmate-parent)
ok - relative local parent homes fail closed
ok - invalid secondmate markers block routing and surface the obligation
ok - remote parent-replies mirror input is durable and idempotent
ok - reused task ids retain per-incarnation terminal receipts
ok - legacy metadata rewrites preserve terminal receipt identity
ok - relaunch cannot replace metadata during terminal snapshot
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
ok - terminal reconciliation ignores heartbeat backoff state
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
ok - scan marker replaces a symlink without overwriting its target
ok - nonterminal and captain-held workers remain outside inactive terminal reporting
ok - watcher hook wakes for terminal loss and preserves idle secondmate exemption
ok - the real watcher poll delivers a child's terminal ledger line to the parent channel
actionable: inactive terminal outcome awaiting captain presentation: child=b state=done pr=https://example.test/owner/repo/pull/1
ok - stalled state reads are bounded without starving later children
ok - aggregate scan budget includes durable wake operations
actionable: inactive terminal outcome needs parent report: child=child state=failed (missing or unreadable parent binding .fm-secondmate-parent)
ok - notice recovery remains idempotent across queue acknowledgement
ok - a secondmate home with no parent binding names the missing binding instead of failing quietly
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
ok - reconciliation makes zero forge or PR API calls
actionable: inactive terminal outcome awaiting captain presentation: child=child state=done pr=https://example.test/owner/repo/pull/1
ok - reconciliation state reads set no-forge mode
all inactive reconciliation tests passed

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ⚠️ bin/fm-branch-outcome.sh:315 - Simplification: status_provenance_covers accepts the PR in two places: names_pr &#34;$covered_event&#34; &#34;$pr&#34; || names_pr &#34;$summary&#34; &#34;$pr&#34;. The second path checks the branch's free-text summary, which an LLM writes, and is a separate way for an outcome to count as covered. The intent's examples (PR 141/144/151) are PR-ready ship outcomes, and their covered status event is the mode's done: PR &lt;url&gt; … line, which already names the PR. The narrower form is to accept only the covered event (names_pr &#34;$covered_event&#34; &#34;$pr&#34;). The summary path is needed only if real covered events can name the PR in another form, for example PR #151. If they can't, remove it so that suppressing a wake never depends on prose.
  • ⚠️ bin/fm-inactive-reconcile.sh:582 - Simplification: the new presented_via=branch-outcome:&lt;seq&gt; receipt field is extra audit metadata. The intent only requires the outcome to be marked presented so the wake doesn't repeat, and mark_presented alone does that. Nothing reads presented_via; only the new test asserts it. Recommended remedy: drop the field (and the matching header text at bin/fm-inactive-reconcile.sh:69-71,77, plus the test assertion) unless you want it kept as evidence.

🔧 Fix applied.
2 warnings still open:

  • ⚠️ bin/fm-inactive-reconcile.sh:582 - Simplification: the new presented_via=branch-outcome:&lt;seq&gt; receipt field is extra audit metadata. The intent only requires the outcome to be marked presented so the wake doesn't repeat, and mark_presented alone does that. Nothing reads presented_via; only the new test asserts it. Recommended remedy: drop the field (and the matching header text at bin/fm-inactive-reconcile.sh:69-71,77, plus the test assertion) unless you want it kept as evidence.
  • ⚠️ bin/fm-inactive-reconcile.sh:576 - A wake that was queued before main ran mark-processed still reaches main. Concrete sequence: (1) The child writes done: PR …/pull/151. (2) supervision-host appends captain seq 348. (3) Main is busy or the captain is away for more than FM_INACTIVE_RECONCILE_SECS (900 s), so 348 is still unprocessed when the scan runs. processed-covers exits 1, and the scan queues inactive-outcome:&lt;fp&gt; (bin/fm-inactive-reconcile.sh:584-587). (4) Main presents 348 and runs mark-processed --through 348. (5) On the next scan the pending record is found again (ensure_record returns the existing .pending), processed-covers now prints 348, and mark_presented renames the receipt (line 579). Nothing removes the row already in .wake-queue, and fm-wake-drain.sh does not filter inactive-outcome rows by receipt state (no terminal-outcomes/.presented check there). Main still gets 'inactive terminal outcome awaiting captain presentation' for a PR it already presented. Later acknowledge() then finds no .pending and returns 0 (line 676). The change fixes the sequence where the queue entry is written after processing. It does not fix the ordering where the scan runs first, which also fits the intent's wording that the wake 'kom efter' ('came after') the processed seq. Possible remedies: (a) when the covered path finds an existing presentation-phase record, also retire its queued inactive-outcome:&lt;fingerprint&gt; row, or (b) have the drain drop inactive-outcome rows whose receipt is already .presented. Either one adds a new wake-queue mutation path beyond the stated change, so the remedy needs authorization even though the defect is mechanical. Sibling site: bin/fm-wake-drain.sh:268-272 (acknowledge_inactive_outcomes), the only consumer that currently retires these rows.

🔧 Fix applied.
1 warning still open:

  • ⚠️ bin/fm-wake-drain.sh:1075 - Round 2 added this drain-time withhold, as the user prescribed with remedy (b). It still misses the most common ordering of the scan-first case. fm-inactive-reconcile.sh presented exits 0 only after a later scan has moved the receipt from .pending to .presented (bin/fm-inactive-reconcile.sh:687-693). That move happens only at bin/fm-inactive-reconcile.sh:583-588, and the scan runs at most once per FM_INACTIVE_RECONCILE_SECS (900 s, gated at bin/fm-inactive-reconcile.sh:651). Concrete sequence: (1) The scan queues inactive-outcome:&lt;fp&gt; while captain seq 348 is read but not processed. fm-watch.sh:2778-2780 then wakes main immediately. (2) Main is mid-turn, presents 348 and runs mark-processed --through 348. (3) The turn ends and the watcher's wake makes main drain within seconds or minutes. No rescan has run yet, so the record is still .pending with phase=presentation. presented returns 1, and the drain prints 'inactive terminal outcome awaiting captain presentation … pr=…feat(spawn): per-task crewmate model selection (--model) #151' for a PR main just presented. That is exactly the repeat the intent describes. The fix helps only if main leaves the queued wake undrained for at least one full scan cadence after mark-processed, which the immediate watcher wake makes rare. The new regression test (tests/fm-inactive-reconcile.test.sh:210-240) ages the scan marker and rescans before draining, so it passes without covering this ordering. Possible remedy: have the read-only presented &lt;fingerprint&gt; query, which fm-inactive-reconcile.sh owns, also report a pending presentation-phase record as presented when fm-branch-outcome.sh processed-covers covers its task_id/state/pr. A second option is to trigger a coverage re-check at mark-processed time. Either one extends the drain/receipt contract that round 2 was asked to keep narrow, and the drain-time option would take the branch-outcome lock while the drain holds the wake-queue lock, so the remedy needs a decision. Sibling sites: bin/fm-wake-drain.sh:271-285 (withhold_presented_inactive_outcomes), bin/fm-inactive-reconcile.sh:687-693 (presented), bin/fm-inactive-reconcile.sh:569-588 (the only path that moves a covered record to presented).

🔧 Fix applied.
1 info still open:

  • ℹ️ tests/fm-inactive-reconcile.test.sh:256 - Rounds 2–3 added a drain-time withhold (bin/fm-wake-drain.sh:1075, withhold_presented_inactive_outcomes at :271-285, backed by fm-inactive-reconcile.sh presented at bin/fm-inactive-reconcile.sh:690-704). The tests only check one direction: that a covered row is NOT printed (tests/fm-inactive-reconcile.test.sh:212). No test drains an uncovered inactive-outcome row and asserts that the drain still prints it. test_unprocessed_or_different_branch_outcome_still_presents (:256-316) only counts rows in .wake-queue and never runs the drain. test_main_direct_terminal_presentation_receipt (:328) sends the drain's stdout to /dev/null. A regression that over-withholds would pass the whole suite while silently dropping a real captain notification, for example if presented returned 0 for any pending record with phase=presentation, or if the awk key match were broadened. Today's code is correct: a read-only outcome yields processed=0, an empty ROW, and exit 1, so the row is printed. Smallest fix: in test_main_direct_terminal_presentation_receipt, and in the 'branch-read-only' case at :257-263, capture the drain's stdout and assert it contains 'awaiting captain presentation' for pull/1.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Main har presenterat och kvitterat ett BRANCH OUTCOME för PR 151 (mark-processed) före nästa inaktiv-skanning; skanningen köar ingen avisering, kvittot blir .presented och tömningen visar ingen inacti… ✅ pass live live-processed-first.txt (baslinje baseline-0397cb2b-processed-first.txt visar att den gamla koden köade och visade aviseringen)
Skanningen köar aviseringen medan utfallet bara är läst; main kör mark-processed och tömmer direkt utan omskanning; tömningen visar ingen 'awaiting captain presentation'-rad, --ack-through förbrukar r… ✅ pass live live-scan-first-drain-now.txt (baslinje baseline-0397cb2b-scan-first-drain-now.txt visar upprepningen före rättningen)
Skanningen köar aviseringen, main kör mark-processed och en omskanning flyttar kvittot till .presented; tömningen håller undan den köade raden och ack förbrukar den ✅ pass live live-scan-first-rescan.txt
Adversariellt: utfallet är läst men inte kvitterat (mark-processed saknas); main ska fortfarande aviseras om det inaktiva utfallet ✅ pass live live-read-only.txt
Adversariellt: barnet skriver ett nytt failed:-utfall efter det kvitterade done:-utfallet; det nya utfallet ska aviseras och inte döljas av den gamla kvittensen ✅ pass live live-failed-after.txt
  • bash tests/fm-inactive-reconcile.test.sh (riktad testfil, inklusive de tre nya testerna: processed-branch-outcome, wake-queued-before-processing withheld, unprocessed/different outcome still presents)
  • Live: live-lab-driver.sh &lt;worktree&gt; processed-first: lab-FM_HOME via bin/fm-lab-home.sh create, barnfönster på privat tmux -L fm-lab, idle-tillstånd via bin/fm-busy-event.sh arm, riktiga fm-crew-state.sh → fm-branch-outcome.sh append/mark-read/mark-processed → fm-inactive-reconcile.sh scan --startup → fm-wake-drain.sh → --ack-through
  • Live: live-lab-driver.sh &lt;worktree&gt; scan-first-drain-now (skanna, mark-processed, töm direkt utan omskanning)
  • Live: live-lab-driver.sh &lt;worktree&gt; scan-first-rescan (skanna, mark-processed, omskanning, töm)
  • Live, adversariellt: live-lab-driver.sh &lt;worktree&gt; read-only (utfallet läst men inte kvitterat) och failed-after (nytt failed:-utfall efter kvitterat done:)
  • Baslinje: samma drivare mot git archive 0397cb2b för processed-first och scan-first-drain-now
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 1)
✅ **Push** - passed

✅ No issues found.

Summary

 fm-inactive-reconcile.sh scan            (main home, done/failed child idle > cadence)
   ensure_record <fp>.pending
+  fm-branch-outcome.sh processed-covers --task --state [--pr]   (lock-free read)
+    covered -> mark_presented, no wake
   queue check inactive-outcome:<fp>      (only when not covered)

 fm-wake-drain.sh
+  withhold_presented_inactive_outcomes
+    fm-inactive-reconcile.sh presented <fp>   (.presented, or .pending now covered)
+      withheld rows stay queued; the ordinary --ack-through still consumes them

processed-covers means: newest processed captain branch outcome for the task, status file identity unchanged, latest status event and latest event through the outcome's statusEndpoint both have the same terminal verb, and that covered event names the recorded PR as a whole word.

Evidence

  • Before: processed-first - done ship with done: PR …/pull/1 checks green, captain branch outcome appended, mark-read, mark-processed; inactive scan still queued inactive-outcome:<fp> "awaiting captain presentation" (red test_processed_branch_outcome_counts_as_presented).
    After: no wake, receipt .presented; also green when main drains before any rescan (scan first, mark-processed, drain at once: no "awaiting captain presentation" line, ack still consumes the row).
  • Safety net still wakes: outcome only read, later failed, PR-ready line after a processed pre-validation handoff, another task, /pull/10 vs /pull/1, an outcome that never named the PR, unreadable store.
  • tests/fm-inactive-reconcile.test.sh green; tests/fm-branch-supervision.test.sh and tests/fm-afk-return.test.sh green; ShellCheck 0.11.0 clean on every changed script.

Merge Danger

Door: two-way

Additive read-only query and a drain filter; reverting restores the previous repeat wakes.

Blast Radius: supervision-wakes

A wrongly covered outcome would hide one inactive-outcome wake for a PR main already acknowledged as a branch outcome; every unreadable or ambiguous read falls back to waking main.

…presentation

The inactive-outcome scan only honored its own presented receipts, so a done or failed ship whose PR main had already presented and acknowledged through the branch outcome store (mark-processed) still woke main with an inactive terminal outcome awaiting captain presentation.
fm-branch-outcome.sh gains a read-only processed-covers query, and a main home with a branch outcome store records such an outcome as presented instead of waking main.
A changed terminal state, an outcome recorded before the PR existed, an outcome main only read, another task or PR, and an unreadable store still wake main.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate (OSS triage, not the captain).

Welcome, and thank you @andersmoldin — repeated inactive-outcome wakes for an already-presented PR are exactly the kind of noise we want gone. I read tip 216ef5ba against main 24f3a6b8 (5 files, +336/-7). The no-mistakes attestation matches 216ef5ba, with live validation go at 5 of 5.

Contract-class: restore (my own check). The existing inactive-reconcile + branch-outcome path already marks outcomes presented and expects one captain presentation. processed-covers withholds a wake when a processed captain row still covers the same terminal state/PR; uncertain reads fail safe toward still notifying. No new wake class, observer, or default-on surface.

VISION.md, rule by rule

  • One captain, one interface: aligns. Fewer duplicate captain messages.
  • Authority is explicit: aligns. Coverage never invents a presentation.
  • Scripts own the mechanics: aligns. Lock-free coverage query in scripts.
  • A restart is a non-event: aligns. Receipts and processed markers stay durable.
  • Delegation with a spine: aligns. No contract change.
  • The fleet outlives any vendor: aligns. Local status/outcome stores only.
  • Scope: aligns. Field incident → regression coverage.

Security review before approving fork CI: no workflow, secret, or network changes. I approved CI 38627951734 and no-mistakes 38630342947, 38627951927.

Outcome: waiting-ci. This isn't waiting on you. If CI comes back green on this head and main tip CI is healthy, it can auto-merge as a restore.

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