Skip to content

fix: restore main-only watcher handoff before successor start - #39

Merged
twilwa merged 3 commits into
mainfrom
fm/fm-supervision-main-only-handoff
Oct 21, 2026
Merged

twilwa merged 3 commits into
mainfrom
fm/fm-supervision-main-only-handoff

Conversation

@twilwa

@twilwa twilwa commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Intent

Apply the reviewed supervisor continuity fix so that an attended main-only wake is actually delivered to the primary session. The standing direction for this period: the top priority is velocity on merging bbchat PRs, and pipeline or supervision changes are in scope when they keep that moving; everything else is second priority. Twice on 2026-10-21 the primary session stopped receiving wakes: a supervisor drain left the recovery marker in handling while a main-only task-budget wake waited; the host left a healthy successor; Stop could not commit rewake and silently returned 0. Deliver the reviewed fix through the normal PR path, tests green, nothing else changed. Keep bin/fm-supervision-host.sh byte-identical to SHA256 1dfd99f2f98666a18120f437e7449cf144d8efe301c8e39b7d7d30780b0e1e70. Existing PR #39 must receive attestation; do not open another PR or force-push. Approved deviation: two new test tab regexes use ANSI-C quoting for GNU grep portability. Out of scope: away policy, admission, ownership, watcher cycle, other hooks, live runtime edits or live restarts.

What Changed

  • bin/fm-supervision-host.sh: on an attended main-only pass-through, leave_successor_for_main now republishes downtime on the watcher's recovery marker (.watcher-down) before it starts the successor. This replaces a marker that an earlier engine drain left in handling. If that publication fails, the host logs pass-through downtime-unrestored and starts no successor. If either the publication or the successor start fails, the host still prints the close but exits 1 instead of always exiting 0. Before this change, the failure was swallowed with || true. The script also gains two ABOUTME header lines.
  • tests/fm-supervision-host.test.sh: adds assert_budget_close_after_supervisor_drain and two host+hook tests. The first checks that a queued main-only task-budget wake still rewakes main after an early or a delayed supervisor drain, with a deliverable downtime marker, the wake still queued and the successor running. The second forces the marker publication to fail. It checks that the downtime-unrestored log line appears, the Stop hook exits 2, outcome=failed is recorded and no successor watcher is left running. The tab regexes use ANSI-C quoting ($'\t...') so they work with GNU grep.
  • docs/supervision-host.md: describes the downtime republish on main-only pass-through, the downtime-unrestored and successor-unverified failure logs, and the nonzero exit.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: This is a small, bounded host change. Before a main-only hand-back starts a successor, it moves the recovery marker from handling to downtime, the same transition exit_to_main and the HANDLE_RC=2 path already make. The host's SHA256 matches the pinned 1dfd99f2…0e70. Both outcomes were traced through the Stop hook's actionable path: a successful write commits the rewake, and a refused write leaves no live watcher, so the lost-handback branch commits failed and exits 2.

Testing

I ran the focused supervision-host suite on the change (58 passed, 0 failed) and confirmed both new regression tests fail on the pre-fix host, as expected. I then stood up a disposable live Claude lab on this commit with a real primary, supervision host, headless engine, watcher and gated worker. In it I drove the incident's exact race: the real engine was paused right after the drain, so the main-only task-budget wake closed the successor while the marker was still in handling. With the fix, the host restored a deliverable downtime marker and the primary was rewoken. The same race against the pre-fix host left main silent, with the budget wake stranded in the queue. Four more live runs (early drain) also delivered to main. The refused-marker-write path was checked only through its automated test (fault injected through a fake mktemp), not live. The host SHA256 check is a source-level check, not a live scenario. The lab, its leftover treehouse pool, and the temp trees were torn down; the worktree is clean.

  • Live validation: ✅ go - 3 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Delayed drain: a task-budget wake arrives while the supervisor's drain holds the marker in handling, and the attended primary is still rewoken ✅ pass live live-race-trace-run5-delayed.log + live-primary-pane-run5-delayed.txt: marker pending:handling with task-budget wake queued -> host 'pass-through attended main-only' -> marker republished pending:down…
Regression proof: the same delayed-drain race on the pre-fix host leaves main un-woken (the 2026-10-21 incident) ✅ pass live live-race-trace-run6-PREFIX-host.log + live-primary-pane-run6-PREFIX-no-rewake.txt: the lab's host copy swapped to 79423d8; after pass-through main-only the marker stayed pending:handling, the ledger…
Early-drain control: the engine acks before the budget wake, and main is still rewoken with a successor kept ✅ pass live live-race-trace.log, live-race-trace-run2/3/4 logs, live-primary-pane-run1.txt: each run logged 'pass-through attended main-only check: task-budget' followed by autoarm outcome=rewake and a primary tu…
Adversarial: restoring the downtime marker fails during a main-only handoff, so the failure is logged explicitly, main is notified (Stop exit 2, outcome=failed), and no misleading successor is left ⏸️ untested no The prior payload did not establish a live result. Driving this live means making the real marker publish fail inside a running lab home. The only workspace-local way is a fault injection like the tes…
Host source stays byte-identical to the reviewed SHA256 ⏸️ untested no The prior payload did not establish a live result. This is a byte-level source constraint with no runtime behavior to drive live; it was checked directly with sha256sum bin/fm-supervision-host.sh =…
Evidence: Focused suite on fixed source (58 ok, rc=0)

Source: Focused suite on fixed source (58 ok, rc=0)

ok - supervision engine lookup ignores a shadowing shell function
ok - host+hook: a successor closed before exit_to_main does not suppress the branch-outcome rewake
ok - host+hook: a successor that closes during a held engine turn does not suppress the branch-outcome rewake
ok - host+hook: a refused hand-back becomes a delivered failure notice
ok - host+hook: a refused hand-back on an announced handling marker becomes a delivered failure notice
ok - host: parked child-exit sampling uses ordinary half-second sleeps
ok - report surface: only the branch actor's current turn may report, and only on the tasks its wake names
ok - report surface: visible late outcomes queue a relay, while silent outcomes remain stored without a wake or note
ok - dispatch entry: the host reads branch eligibility, the offer rule, and the wake prompt from the Pi branch's own owner
ok - drain: BRANCH OUTCOMES runs on a Claude home by default and on another primary with the file, never with off, and never on Pi
ok - drain: captain outcomes come first, and routine overflow collapses into a count one drain clears
ok - drain: repeated captain outcomes collapse per task, and the byte cap presents only the run its acknowledgement covers
ok - drain: a long away window costs one short drain, captain outcomes collapsed per task and routine overflow counted, and nothing from it is shown again
ok - drain: the BRANCH OUTCOMES budgets count bytes, cutting multibyte summaries by whole characters in any locale
ok - drain: branch outcomes stay unread when a projection of the store fails
ok - drain: branch outcomes stay unread and the drain fails when jq is missing
ok - drain: branch outcomes stay unread when the drain cannot print them
ok - drain: a legacy backlog is presented with each outcome's age and a check-first instruction, never adopted
ok - drain: a keyed decision survives acknowledgement through a newer outcome for its task
ok - drain: an outcome carried across a switch off Pi comes back with its age, never adopted
ok - drain: an outcome nothing has shown is presented until acknowledged, and a repeated acknowledgement changes nothing
ok - drain: an outcome the host drain presented but main never acknowledged stays unprocessed across a switch to Pi
ok - drain: an outcome the host drain presented but main never acknowledged survives an outcome index repair
ok - host: an attended wake the branch may take is handled on the engine, and its routine outcome never wakes main
ok - host: an attended captain outcome wakes main once and stays in its drain until main acknowledges it
ok - host: a captain outcome recorded after the captain left waits for the return, then reaches main's drain
ok - host: a quiet record without its daemon is a present captain, so outcomes and decisions reach main
ok - host: an attended decision close stays main's exactly as the plain arm delivers it
ok - host: an off written while the host is parked sends the next attended close to main, naming the opt-out
ok - host: a main-only pass-through leaves the successor watcher running and the close undelivered for main
ok - host: an attended close whose main session cannot be identified reaches main and runs no engine turn
ok - host: a decision close accepted away whose turn starts attended still reaches main unchanged
ok - host: an attended close whose task turns main-only before its turn still reaches main unchanged
ok - host+hook: an attended main-only pass-through rewakes main and keeps its successor watcher
ok - host+hook: an earlier supervisor drain cannot suppress a queued main-only budget handoff
ok - host+hook: failed budget handoff restoration notifies main without starting a successor
ok - host+hook: a captain outcome beside a quiet record rewakes the present captain with no away note
ok - host+hook: a Claude home without config/supervision-host runs the host at the default engine, and an off file restores the plain arm
ok - host+hook: a close that turns main-only at its turn rewakes main and keeps its successor watcher
ok - host+hook: failed at-turn downtime write notifies main despite a healthy successor
ok - host+hook: a successor close that lands during main's turn is delivered at the next turn end
ok - host+hook: the next park takes over the cycle a main-only pass-through left, so one arm owns it
ok - host+hook: a park stopped mid take-over leaves the take-over to the next park
ok - host+hook: a successor that cannot be recorded is stopped, and main's next turn end arms a fresh cycle
ok - host: a primary with no verified dialog mirror keeps every attended close on main, and its away posture still runs
ok - host: each wake carries the captain's dialog since the last wake, without operational input
ok - host: the dialog mirror, its feed, and the wake file are owner-only
ok - host: dialog a turn never completed with its report (a park boundary, a stopped turn, no report) reaches the next turn
ok - host: an attended wake whose mirror is missing, cannot be read (at the feed or at the prompt), or holds a malformed entry reaches main before any engine turn, and the cursor stays put
ok - host: an away wake is handled on the engine through the branch contract and never reaches main
ok - host: an engine turn that records no outcome hands its durable wake to main
ok - host: a captain return during an engine turn hands that turn's outcomes to main
ok - host: silent outcomes are excluded from both captain-return handoff paths
ok - host: an early visible outcome survives more than 1,000 same-turn receipts
ok - host: an outcome lookup failure forces a visible main handoff
ok - host: an outcome recorded after the return reaches main even when its host dies at the turn's end
ok - host: a killed predecessor's engine is reaped and the next host removes its turn files
ok - host: a turn that reports but leaves its granted rows queued hands the wake to main

real	17m24.446s
user	10m54.303s
sys	36m30.711s
rc=0
Evidence: New delayed-drain test fails on pre-fix host (Stop exit 0 instead of 2)

Source: New delayed-drain test fails on pre-fix host (Stop exit 0 instead of 2)

ok - supervision engine lookup ignores a shadowing shell function
not ok - budget handoff (delayed drain): the Stop hook must rewake main: firstmate watcher wake - one supervision event needs a handling turn now.
check: task-budget task=demo period=124483 age=1792555277s wall_budget=1s output_budget=1000000 tokens=unknown compactions=unknown restarts=unknown last_status_ago=10s
Run bin/fm-wake-drain.sh first, handle the wake, then run its exact WAKE_ACK_REQUIRED --ack-through command. Until that post-handling acknowledgement, interruption leaves the wake durable for idempotent re-handling. This Stop hook owns watcher continuity: when the handling turn ends, the next needed cycle arms automatically - do NOT run bin/fm-watch-arm.sh after an ordinary wake.
pending:handling:1572659.1792555270.HAb472: expected exit 2, got 0

real	0m22.588s
user	0m6.809s
sys	0m22.551s
rc=1
Evidence: New refusal test fails on pre-fix host (no downtime-unrestored)

Source: New refusal test fails on pre-fix host (no downtime-unrestored)

ok - supervision engine lookup ignores a shadowing shell function
not ok - a failed restoration must be explicit
--- /tmp/fm-supervision-host.8PGxl4/hook-budget-delayed-refuse/state/.supervision-host.log ---
1792555294	start	gen=host-1586984-1792555293	primary=claude
1792555309	handled	turn=host-1586984-1792555293.1	posture=attended	rc=0	reports=1	error=0 cost=0.25 conversation_cost=0.25 input=5 cache_read=100 cache_write=10 output=20 turns=3	signal: /tmp/fm-supervision-host.8PGxl4/hook-budget-delayed-refuse/state/demo.status
1792555309	pass-through	attended	main-only	check: task-budget task=demo period=124483 age=1792555304s wall_budget=1s output_budget=1000000 tokens=unknown compactions=unknown restarts=unknown last_status_ago=10s
rc=1
Evidence: Live lab up readiness transcript

Source: Live lab up readiness transcript

lab: /tmp/fmlab.0fiLqZ (tear down with: bin/fm-live-lab.sh down /tmp/fmlab.0fiLqZ)
tree: 2c66c2e34ecba765051ba9b176e41c678e619a70 from ~/.no-mistakes/worktrees/8be14fbb8fb5/01M5E9S4NFDN557RY769T81VTC
spawned lab2e585ec98219-worker harness=claude kind=ship mode=local-only yolo=on window=firstmate:fm-lab2e585ec98219-worker worktree=~/.treehouse-fm/f951c1f44250/.treehouse/notes-0eea61/1/notes
gate: /tmp/fmlab.0fiLqZ/home/data/lab2e585ec98219-worker/gate (touch, then message the worker to resume)
primary: claude --setting-sources project,local --model sonnet --effort medium --permission-mode auto
ok primary: claude pid 1627812 in /tmp/fmlab.0fiLqZ/home
ok probe: the primary answered LABREADY-2e585ec98219
ok trust: /tmp/fmlab.0fiLqZ/home is trusted in the Claude store
ok mirror: verified writer, check passed, captain=1 main=1
ok host: supervision host pid 1640436
ok watcher: live watcher with a fresh beacon
ok worker: lab2e585ec98219-worker parked on /tmp/fmlab.0fiLqZ/home/data/lab2e585ec98219-worker/gate
ok treehouse: ~/.treehouse unchanged
ready: /tmp/fmlab.0fiLqZ
rc=0
Evidence: Live run 5 (fixed host, delayed drain) marker/host trace

Source: Live run 5 (fixed host, delayed drain) marker/host trace

autoarm before: epoch=5 owner_pid=2330473 outcome=arming updated_at=1792555909
1792556123.370 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
APPENDED status wake
1792556123.404 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556123.490 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556123.574 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556123.654 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556123.731 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556123.815 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556123.894 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556123.973 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.051 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.135 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.214 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.299 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.381 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.464 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.545 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.627 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.715 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.800 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.885 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556124.973 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556125.068 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556125.157 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556125.250 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556125.341 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556125.421 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556125.499 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556125.590 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556125.691 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556125.776 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556125.891 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556126.075 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556126.179 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556126.271 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556126.367 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556126.464 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556126.555 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556126.641 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556126.743 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556126.833 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556126.921 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556127.001 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556127.095 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556127.191 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556127.289 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556127.405 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556127.510 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556127.605 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556127.710 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556127.805 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556127.900 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556127.983 marker=[acked:handling:2588001.1792556101.kGalHH ] lockpid=[2736564] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556128.069 marker=[acked:han

... [62947 bytes truncated] ...

led	turn=host-2332996-1792555910.2	posture=attended]
1792556180.013 marker=[pending:downtime:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556180.249 marker=[pending:downtime:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556180.482 marker=[pending:downtime:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556180.723 marker=[pending:downtime:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556180.954 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556181.183 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556181.412 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556181.642 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556181.874 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556182.112 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556182.352 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556182.603 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556182.842 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556183.080 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556183.330 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556183.571 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556183.810 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556184.043 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556184.271 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556184.511 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556184.756 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556185.000 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556185.254 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556185.505 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556185.773 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556186.016 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556186.253 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556186.489 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556186.724 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556186.979 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556187.234 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556187.515 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556187.776 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556188.039 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556188.339 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556188.589 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556188.839 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556189.069 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556189.294 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556189.519 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556189.748 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556189.996 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556190.263 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556190.522 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556190.774 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.2	posture=attended]
1792556191.010 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.3	posture=attended]
1792556191.248 marker=[pending:handling:2736564.1792556154.od5IZP ] lockpid=[] hostlog_tail=[handled	turn=host-2332996-1792555910.3	posture=attended]
1792556197.491 marker=[pending:downtime:2927031.1792556196.yTzg5V ] lockpid=[] hostlog_tail=[pass-through	attended	main-only]
autoarm after: epoch=5 owner_pid=2330473 outcome=rewake updated_at=1792556194 session_pid=1627812 recovery_generation=2736564.1792556154.od5IZP
host log tail:
1792556063	handled	turn=host-2332996-1792555910.1	posture=attended	rc=0	reports=1	error=0 cost=0.038223 conversation_cost=0.193454 input=12 cache_read=110446 cache_write=3556 output=1293 turns=5	stale
1792556121	handled	turn=host-2332996-1792555910.2	posture=attended	rc=0	reports=1	error=0 cost=0.016933 conversation_cost=0.210387 input=8 cache_read=73639 cache_write=1271 output=447 turns=3	signal: 
1792556190	handled	turn=host-2332996-1792555910.3	posture=attended	rc=0	reports=1	error=0 cost=0.017011 conversation_cost=0.227398 input=8 cache_read=76887 cache_write=954 output=549 turns=3	signal: /
1792556191	pass-through	attended	main-only	check: task-budget task=lab2e585ec98219-worker period=0 age=783s wall_budget=1s output_budget=1000000 tokens=unknown compactions=unknown restarts=unknown las
Evidence: Live run 5 primary pane showing Stop hook rewake after delayed-drain handoff

Source: Live run 5 primary pane showing Stop hook rewake after delayed-drain handoff

✻ Worked for 3s · done 6:03 AM
● Stop hook feedback
  Ran 3 shell commands 
● Captain, the worker passed its time budget but is still making progress, so I let it keep going. The budget is only 1 second, which looks like a lab setting. The worker's latest update says it wrote the outline for
  count_notes. Nothing is looping or stuck, and there was no open decision to resolve. I've acknowledged the notification.
✻ Sautéed for 14s · done 6:05 AM
● Stop hook feedback
  Ran 2 shell commands                                                                                                    
● Captain, the worker is still going and nothing needs your decision. It has drafted count_notes, and 2 of its 3 tests pass. It's investigating the third before it commits. The 1-second time budget keeps firing, but the
  worker isn't looping or stuck, so I left it alone. I've acknowledged the notification.
✻ Churned for 11s · done 6:07 AM
● Stop hook feedback
  Ran 2 shell commands                                                                  
● Captain, the worker is still making progress and nothing needs your decision. It fixed the third count_notes test and is now running the full test pass before it commits. The 1-second time budget fired again, but the
  worker isn't stuck or looping, so I left it alone. I've acknowledged the notification.
✻ Worked for 11s · done 6:09 AM
● Stop hook feedback
  Listed 1 directory, ran 4 shell commands                                              
● Captain, the worker's progress reports don't match what it has actually done. It says its tests are green and it is staging the count_notes commit. But its isolated copy of the project is clean, with no edits and no
  commits beyond the starting one. A monitoring check also found it sitting idle at the start of its task, waiting on a resume file that never appeared. I haven't steered or restarted it, and its work is untouched.
  The 1-second time budget keeps firing, so those notifications aren't informative on their own. I'll check the worker's copy again on the next notification. If it still has no code, I'll steer it to start work and
  report back.                             
✻ Cogitated for 28s · done 6:11 AM
● Stop hook feedback                                                                                                                                                                                                     
  Ran 2 shell commands 
● Captain, the worker has written no code. Its copy of the project is still clean, with only the starting commit. It is paused on purpose, waiting for a resume file that hasn't appeared, and nothing has been committed.
  The "tests green" and "commit staged" status lines are false. The worker says they aren't its own, and I found no sign of that work.
  The supervision session already told the worker to stay paused. I've left it alone, since the pause is expected and nothing is broken. The 1-second time budget keeps firing, so those notifications tell us nothing.
  I can't tell who is writing the false status lines. If you want the worker to start, I'll need the missing resume file or your go-ahead.
✻ Cogitated for 16s · done 6:16 AM                                                                                                    
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯                                                                                                                                                                          
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ auto mode on (shift+tab to cycle)                   
Evidence: Live run 1 primary pane

Source: Live run 1 primary pane

 ▐▛███▛█   Claude Code v2.1.305
▝▜██████▀  Sonnet 5.5 with medium effort · Claude Max
 ▝▝   ▝▝   /tmp/fmlab.0fiLqZ/home
❯ Lab readiness probe from bin/fm-live-lab.sh. Run no tool or command for this message. Reply with only the word LABREADY, a hyphen, and then 2e585ec98219, with no spaces.                                                 
● LABREADY-2e585ec98219
✻ Worked for 3s · done 6:03 AM
● Stop hook feedback
● Reconcile current state of the worker
  ⎿  $ bin/fm-wake-drain.sh --ack-through 3 --recovery-generation 1660195.1792555491.4pMw3p
* Spinning… (12s · ↓ 527 tokens · thought for 1s)                                             
  ⎿  Tip: Working on a plan or design doc? Ask Claude to publish it as an artifact — a polished web page you can open in your browser.
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯                                                                                                                                                                          
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ auto mode on (shift+tab to cycle) · esc to interrupt
Evidence: Live lab teardown

Source: Live lab teardown

stopped: lab tmux server and lab processes
removed: task temp /tmp/fm-lab2e585ec98219-worker+206d2a0427663f7c3ed49143c8409bf94b25643cebfaf8b0db6ba67cf0728243
removed: task temp /tmp/fm-lab2e585ec98219-worker
removed: 2 Claude project entries under /tmp/fmlab.0fiLqZ
removed: /tmp/fmlab.0fiLqZ
rc=0
Evidence: Live A/B summary
fixed host (run 5): marker pending:handling + queued task-budget wake -> pass-through main-only -> marker republished pending:downtime -> .claude-autoarm-epoch outcome=rewake -> primary pane 'Stop hook feedback' + handled turn
pre-fix host (run 6): same race -> pass-through main-only -> marker stays pending:handling -> ledger stays outcome=arming, budget wake 21 stays queued, no Stop hook alive, primary silent

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Delayed drain: a task-budget wake arrives while the supervisor's drain holds the marker in handling, and the attended primary is still rewoken ✅ pass live live-race-trace-run5-delayed.log + live-primary-pane-run5-delayed.txt: marker pending:handling with task-budget wake queued -> host 'pass-through attended main-only' -> marker republished pending:down…
Regression proof: the same delayed-drain race on the pre-fix host leaves main un-woken (the 2026-10-21 incident) ✅ pass live live-race-trace-run6-PREFIX-host.log + live-primary-pane-run6-PREFIX-no-rewake.txt: the lab's host copy swapped to 79423d8; after pass-through main-only the marker stayed pending:handling, the ledger…
Early-drain control: the engine acks before the budget wake, and main is still rewoken with a successor kept ✅ pass live live-race-trace.log, live-race-trace-run2/3/4 logs, live-primary-pane-run1.txt: each run logged 'pass-through attended main-only check: task-budget' followed by autoarm outcome=rewake and a primary tu…
Adversarial: restoring the downtime marker fails during a main-only handoff, so the failure is logged explicitly, main is notified (Stop exit 2, outcome=failed), and no misleading successor is left ⏸️ untested no The prior payload did not establish a live result. Driving this live means making the real marker publish fail inside a running lab home. The only workspace-local way is a fault injection like the tes…
Host source stays byte-identical to the reviewed SHA256 ⏸️ untested no The prior payload did not establish a live result. This is a byte-level source constraint with no runtime behavior to drive live; it was checked directly with sha256sum bin/fm-supervision-host.sh =…
  • bash tests/fm-supervision-host.test.sh on 2c66c2e: 58 ok, 0 not ok, rc=0, including the two new budget-handoff tests (focused-fixed.log)
  • The two new tests (delayed/early drain and refused marker write) run against the pre-fix host 79423d8 in a disposable git archive tree: delayed drain fails with Stop expected exit 2, got 0 while the marker is pending:handling; refusal fails because nothing logs downtime-unrestored
  • sha256sum bin/fm-supervision-host.sh = 1dfd99f2f98666a18120f437e7449cf144d8efe301c8e39b7d7d30780b0e1e70
  • bin/fm-live-lab.sh up --harness claude --worker (lab at /tmp/fmlab.0fiLqZ, tree 2c66c2e): every readiness check ok (primary, probe, trust, mirror, host, watcher, worker)
  • Live runs 1–4: a routine worker status wake handled by the real engine, then a task-budget wake made due through the worker meta; each time the host passed it through attended main-only and the primary was rewoken (outcome=rewake, Stop hook feedback in the pane). These covered the early-drain ordering
  • Live run 5 (fixed host): SIGSTOP the real claude -p engine after the host announced handling, until the successor watcher closed on the budget wake, then SIGCONT. The marker went to pending:handling with the budget wake queued; the host passed it through main-only and republished pending:downtime; the ledger recorded outcome=rewake; the primary pane shows Stop hook feedback and a handled turn
  • Live run 6 (A/B): swapped the lab home's own bin/fm-supervision-host.sh (a copy inside the lab) to pre-fix 79423d8 and repeated run 5 exactly. Pass-through main-only was logged, but the marker stayed pending:handling, the ledger stayed arming, the budget wake stayed queued, no Stop hook was alive, and the primary pane showed no new turn
  • bin/fm-live-lab.sh down /tmp/fmlab.0fiLqZ plus removal of the lab worker's leftover ~/.treehouse-fm/f951c1f44250 pool and the temp pre-fix tree
⚠️ **Document** - 1 info
  • ℹ️ bin/fm-supervision-host.sh:706 - The doc comment on leave_successor_for_main only mentions a failed successor start returning 1. It doesn't mention that a failed downtime publication also returns 1, or that the caller now exits nonzero. The comment is incomplete, not wrong. I left it alone because the intent requires this file to stay byte-identical (SHA256 1dfd99f2…). docs/supervision-host.md#attended now owns this behavior.
✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@sourcery-ai

sourcery-ai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Fixes a race where a supervisor drain left the recovery marker in handling and suppressed a queued main-only task-budget wake by publishing downtime before successor handoff, propagating restoration failures, and adding focused real-host regression tests. Validation covers red/green behavior, ShellCheck, syntax, and diff hygiene; the full suite and live runtime validation remain CI-owned.

Sequence diagram for main-only watcher handoff restoration

sequenceDiagram
    participant Host as SupervisionHost
    participant Marker as RecoveryMarker
    participant Successor as Successor
    participant Main as Main

    Host->>Marker: fm_recovery_marker_publish downtime
    alt publication succeeds
        Host->>Successor: start_successor or detach_successor
        Host-->>Main: exit 0, queued wake can be handled
    else publication fails
        Host-->>Host: log_line downtime-unrestored
        Host-->>Main: emit, exit 1
    end
Loading

File-Level Changes

Change Details Files
Restore the recovery marker before handing a main-only close back to the primary, and fail closed when restoration cannot be committed.
  • Publish downtime before starting or detaching the successor.
  • Log an explicit unrestored state and propagate failure to the host loop.
  • Emit the outcome and exit nonzero instead of silently succeeding when handoff restoration fails.
bin/fm-supervision-host.sh
Add real lifecycle regression coverage for supervisor-drain ordering, successful main handoff, and refused marker restoration.
  • Exercise delayed and early supervisor drains around a task-budget wake.
  • Verify main is rewoken, the downtime marker remains deliverable, the budget wake stays queued, and the successor remains healthy.
  • Verify restoration refusal produces an explicit log, committed failure notification, nonzero hook status, and no misleading successor.
tests/fm-supervision-host.test.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T03:54:35.771993Z 2c66c2e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="bin/fm-supervision-host.sh" line_range="708" />
<code_context>
 # downtime (autoarm_commit in bin/fm-claude-stop-autoarm.sh). A failed start
 # returns 1; the caller still prints the close unchanged.
 leave_successor_for_main() {
+  if ! fm_recovery_marker_publish "$STATE/.watcher-down" downtime >/dev/null 2>&1; then
+    log_line "pass-through	downtime-unrestored	$(printf '%s\n' "$REASON" | head -n 1)"
+    return 1
</code_context>
<issue_to_address>
**Main-only close is withheld**

When a live process stalls while holding the recovery-marker lock, `fm_recovery_marker_publish` waits indefinitely for the lock, so `leave_successor_for_main` never starts a successor or returns an error; the caller does not deliver the main-only wake, leaving main idle.

Bound the marker-lock wait so `leave_successor_for_main` can return and the caller can deliver the close.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

# downtime (autoarm_commit in bin/fm-claude-stop-autoarm.sh). A failed start
# returns 1; the caller still prints the close unchanged.
leave_successor_for_main() {
if ! fm_recovery_marker_publish "$STATE/.watcher-down" downtime >/dev/null 2>&1; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Main-only close is withheld

When a live process stalls while holding the recovery-marker lock, fm_recovery_marker_publish waits indefinitely for the lock, so leave_successor_for_main never starts a successor or returns an error; the caller does not deliver the main-only wake, leaving main idle.

Bound the marker-lock wait so leave_successor_for_main can return and the caller can deliver the close.

Prompt for AI agents
In `bin/fm-supervision-host.sh` at line 708:

**Main-only close is withheld**

When a live process stalls while holding the recovery-marker lock, `fm_recovery_marker_publish` waits indefinitely for the lock, so `leave_successor_for_main` never starts a successor or returns an error; the caller does not deliver the main-only wake, leaving main idle.

Bound the marker-lock wait so `leave_successor_for_main` can return and the caller can deliver the close.

@twilwa twilwa changed the title fix: restore main-only watcher handoff before successor start fix(bin): deliver main-only supervision pass-through wakes after a supervisor drain Oct 21, 2026
@twilwa twilwa changed the title fix(bin): deliver main-only supervision pass-through wakes after a supervisor drain fix: restore main-only watcher handoff before successor start Oct 21, 2026
@twilwa

twilwa commented Oct 21, 2026

Copy link
Copy Markdown
Owner Author

Review disposition for head 787420b:

  • Sourcery inline (bin/fm-supervision-host.sh:708, unbounded recovery-marker lock wait): rejected for this PR. The marker publisher and its lock semantics predate this change (main already calls it at two sites); this PR reuses it unchanged so the reviewed source stays byte-identical to the independent review. Bounding the marker-lock wait is tracked as a follow-up (fm-recovery-marker-lock-bound).
  • Sourcery review submission and reviewer's guide: same single finding, same disposition.
  • Codex review summary: informational receipt; Codex completed with no findings on 2c66c2e.

Final disposition: all review items addressed or rejected with evidence above; CI is green on all 22 checks including the no-mistakes attestation.

@twilwa
twilwa merged commit 3b2c073 into main Oct 21, 2026
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant