Skip to content

fix: resurface queued wakes from handling successors - #7466

Merged
kunchenguid merged 14 commits into
kunchenguid:mainfrom
calebl:fm/fm-session-stall-2026-10-16
Oct 23, 2026
Merged

kunchenguid merged 14 commits into
kunchenguid:mainfrom
calebl:fm/fm-session-stall-2026-10-16

Conversation

@calebl

@calebl calebl commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

  • Settle handling-successor recovery under queue and marker locks so rows queued during startup or while the host is parked reliably wake main.
  • Mark handed-back episodes as already announced and release held recovery locks during signal cleanup to prevent duplicate wakes and shutdown deadlocks.
  • Document the recovery contract and add regression coverage for startup-window delivery, lock cleanup, and concurrent lifecycle timing.

Risk Assessment

✅ Low: The concurrency fix is narrowly scoped, preserves the documented handoff invariants, and includes behavioral regression coverage for startup, parked-successor, handback, and termination paths.

Testing

The two authorized deterministic supervision-host cases passed, confirming inherited-handling restoration and restore-failure delivery after the tab-delimited logging correction. Per the recorded maintainer decision, no additional live primary-session validation was attempted, so the accepted live verdict remains inconclusive.

  • Live validation: ⚠️ inconclusive - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
A Basecamp-like inbox note queued while the host is parked on a handled wake's successor wakes main and remains available to drain ⏸️ untested no Live validation was not authorized in this rerun by the recorded maintainer decision. Driving it would require authorization to launch a disposable primary through the documented lab-home and private-…
A row appended after predecessor close but before successor startup inspection is resurfaced instead of silently becoming the baseline ⏸️ untested no Live validation was not authorized in this rerun. It would require a disposable logged-in primary lab plus controlled timing of the predecessor-close/successor-startup interval.
A handling successor avoids an unbounded synthetic recovery loop while continuing to supervise genuine later events ⏸️ untested no Live validation was not authorized in this rerun. It would require a disposable logged-in primary lab and authority to drive multiple real wake and handoff cycles.
When handled-turn settlement fails, the host parks on its successor and a later main-only pass-through restores inherited handling or delivers the restore failure ⏸️ untested no The authorized deterministic host-and-hook fixture passed both branches, but the recorded maintainer decision disallowed expanding this rerun into a live primary-session check. Live proof would requir…
Evidence: Focused supervision-host settlement regression transcript

Source: Focused supervision-host settlement regression transcript

ok - host+hook: a main-only close after a handled turn restores inherited handling and rewakes main
ok - host+hook: a refused inherited handling restore delivers a failure instead of silent success

exit_code=0
- Outcome: ⚠️ 1 warning across 4 runs (40m28s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found ✅
  • ⚠️ bin/fm-watch.sh:3347 - The post-arm confirmation still releases the queue lock at bin/fm-watch.sh:3159 before wake at bin/fm-watch.sh:3348. A concurrently active main turn can drain the detected row in that interval, after the arm check has marked the episode announced, producing an empty synthetic recovery turn without error. This contradicts the “only while that row is still queued” contract at docs/watcher-continuity.md:200; the regression at tests/fm-watch-recovery-loop.test.sh:301 keeps the row queued and does not exercise the concurrent drain. Make the final queue-presence decision and recovery-wake commitment atomic against drains, with cleanup safely releasing any held queue lock.

✅ No issues found.

⚠️ **Test** - 1 warning
  • ⚠️ live validation verdict: inconclusive (0 of 3 scenarios were driven live against the product); untested: A Basecamp-like inbox note queued while the host is parked on a handled wake's successor wakes main and remains available to drain, A row appended after predecessor close but before successor startup inspection is resurfaced instead of silently becoming the baseline, A handling successor avoids an unbounded synthetic recovery loop while continuing to supervise genuine later events
  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product
Scenario Result Live Evidence
A Basecamp-like inbox note queued while the host is parked on a handled wake's successor wakes main and remains available to drain ⏸️ untested no The focused regression uses the real scripts but a fake harness and engine, so it is not live product evidence. A normal-login Claude session plus Basecamp delivery would be required; the recorded use…
A row appended after predecessor close but before successor startup inspection is resurfaced instead of silently becoming the baseline ⏸️ untested no The timing window was driven through an isolated deterministic fixture rather than a real running primary session. Driving it live requires orchestrating a normal-login harness lifecycle, which the re…
A handling successor avoids an unbounded synthetic recovery loop while continuing to supervise genuine later events ⏸️ untested no The regression executes real watcher code but uses fixture integrations and therefore is not a live product run. A real harness session would be needed; the recorded user decision required only this d…
  • FM_TEST_EVIDENCE=1 timeout 130 tests/fm-watch-recovery-loop.test.sh

  • Focused execution of test_claude_stop_hook_rewakes_main_for_an_inbox_note_after_a_handled_wake from tests/fm-supervision-host.test.sh

  • ⚠️ live validation verdict: inconclusive (0 of 3 scenarios were driven live against the product); untested: A Basecamp-like inbox note queued while the host is parked on a handled wake's successor wakes main and remains available to drain, A row appended after predecessor close but before successor startup inspection is resurfaced instead of silently becoming the baseline, A handling successor avoids an unbounded synthetic recovery loop while continuing to supervise genuine later events

  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product

Scenario Result Live Evidence
A Basecamp-like inbox note queued while the host is parked on a handled wake's successor wakes main and remains available to drain ⏸️ untested no The executable regression drove the real host, watcher, wake queue, drain, and lifecycle scripts with an isolated fixture and stub engine, so it is not a live normal-login product session. A recorded…
A row appended after predecessor close but before successor startup inspection is resurfaced instead of silently becoming the baseline ⏸️ untested no The deterministic regression controlled the startup race against the executable watcher in an isolated fixture, but did not use a real harness session. The recorded rerun scope permits only determinis…
A handling successor avoids an unbounded synthetic recovery loop while continuing to supervise genuine later events ⏸️ untested no The regression executed the watcher and real Pi extension with isolated fixture dependencies rather than a live normal-login session. Live execution was not attempted because the binding recorded deci…
  • FM_TEST_EVIDENCE=1 timeout 130s bash tests/fm-watch-recovery-loop.test.sh
  • Focused execution of test_claude_stop_hook_rewakes_main_for_an_inbox_note_after_a_handled_wake from tests/fm-supervision-host.test.sh

🔧 Fix applied.
1 warning still open:

  • ⚠️ live validation verdict: inconclusive (0 of 4 scenarios were driven live against the product); untested: A Basecamp-like inbox note queued while the host is parked on a handled wake's successor wakes main and remains available to drain, A row appended after predecessor close but before successor startup inspection is resurfaced instead of silently becoming the baseline, A handling successor avoids an unbounded synthetic recovery loop while continuing to supervise genuine later events, When handled-turn settlement fails, the host parks on its successor and a later main-only pass-through owns restore or delivers the restore failure
  • Live validation: ⚠️ inconclusive - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
A Basecamp-like inbox note queued while the host is parked on a handled wake's successor wakes main and remains available to drain ⏸️ untested no The regression drives the real host, watcher, inbox, queue, and Stop hook against an isolated fixture, but substitutes a fake Claude harness and engine. The recorded maintainer decision explicitly acc…
A row appended after predecessor close but before successor startup inspection is resurfaced instead of silently becoming the baseline ⏸️ untested no The executable regression deterministically forces the startup race using the real watcher and durable queue, but it is a fixture rather than a live primary session. The recorded maintainer decision l…
A handling successor avoids an unbounded synthetic recovery loop while continuing to supervise genuine later events ⏸️ untested no These tests execute the real watcher and Pi extension but use fixture dependencies rather than a real logged-in primary. Live validation was not repeated because the recorded maintainer decision accep…
When handled-turn settlement fails, the host parks on its successor and a later main-only pass-through owns restore or delivers the restore failure ⏸️ untested no The full behavioral suite exercises the real host and queue state machine with a stubbed harness/engine, so it is not a live product session. A live reproduction would require inducing a recovery-mark…
  • bash tests/fm-supervision-host.test.sh
  • bash tests/fm-watch-recovery-loop.test.sh
  • bash tests/fm-claude-stop-autoarm.test.sh
  • bash tests/fm-wake-queue.test.sh
  • bash tests/fm-watch-arm.test.sh
  • Inspected the target diff and verified git status --short was clean after testing.

🔧 Fix applied.
1 warning still open:

  • ⚠️ live validation verdict: inconclusive (0 of 4 scenarios were driven live against the product); untested: A Basecamp-like inbox note queued while the host is parked on a handled wake's successor wakes main and remains available to drain, A row appended after predecessor close but before successor startup inspection is resurfaced instead of silently becoming the baseline, A handling successor avoids an unbounded synthetic recovery loop while continuing to supervise genuine later events, When handled-turn settlement fails, the host parks on its successor and a later main-only pass-through restores inherited handling or delivers the restore failure
  • Live validation: ⚠️ inconclusive - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
A Basecamp-like inbox note queued while the host is parked on a handled wake's successor wakes main and remains available to drain ⏸️ untested no Live validation was not authorized in this rerun by the recorded maintainer decision. Driving it would require authorization to launch a disposable primary through the documented lab-home and private-…
A row appended after predecessor close but before successor startup inspection is resurfaced instead of silently becoming the baseline ⏸️ untested no Live validation was not authorized in this rerun. It would require a disposable logged-in primary lab plus controlled timing of the predecessor-close/successor-startup interval.
A handling successor avoids an unbounded synthetic recovery loop while continuing to supervise genuine later events ⏸️ untested no Live validation was not authorized in this rerun. It would require a disposable logged-in primary lab and authority to drive multiple real wake and handoff cycles.
When handled-turn settlement fails, the host parks on its successor and a later main-only pass-through restores inherited handling or delivers the restore failure ⏸️ untested no The authorized deterministic host-and-hook fixture passed both branches, but the recorded maintainer decision disallowed expanding this rerun into a live primary-session check. Live proof would requir…
  • Generated and ran a focused copy of tests/fm-supervision-host.test.sh invoking test_main_only_close_after_handled_turn_restores_inherited_handling and test_main_only_close_after_handled_turn_delivers_restore_failure.
✅ **Document** - passed

✅ No issues found.

✅ No issues found.

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

  • ⚠️ linter found issues (exit code 1)

✅ **Push** - passed

✅ No issues found.

✅ No issues found.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @calebl — this is a careful fix for a real gap (main-only rows, like a captain inbox note, sitting in the durable queue while the supervision host is parked on a handled wake's successor).

I reviewed the diff (bin/fm-supervision-host.sh, bin/fm-wake-lib.sh, bin/fm-watch.sh, docs, tests; no workflow or CI-script changes) and approved the first-time-contributor CI and no-mistakes workflow runs for head 464030e7. My read is contract-class restore: the existing default promise is that rows queued for main reach main, and the handling-successor path was dropping that; the fix settles the handoff under the queue and recovery-marker locks and only resurfaces while a row is still queued.

Status: waiting on CI for this head. Nothing needed from you right now unless CI comes back red. Note that #7467 (supervision-host test fixtures) just landed on main and touches tests/fm-supervision-host.test.sh too, so if CI or mergeability flags a conflict, a rebase onto latest main would be the fix.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @calebl. CI on 464030e7 came back with Behavior portable serial 5 failing and serial 2 cancelled at the 30-minute ceiling (#7255). Your new head 20057444 only raises the watcher wait bound in tests/fm-remote-secondmate-lifecycle-e2e.test.sh from 1500 to 3000 polls (30s to 60s). I reviewed that change: test-only, no workflow or secret surface. I approved the fork CI and no-mistakes runs for this head (39106786420, 39106786470). The no-mistakes attestation matches 20057444.

My contract-class verdict is unchanged: restore. Rows queued for main reach main again, which is the default promise the handling-successor path was breaking.

Next step: we're waiting on CI only. Nothing is needed from you. If CI and no-mistakes come back green and the PR is still mergeable against latest main, I'll merge it.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate (triage pass) — re-check at head 34b6ff6a.

Thanks @calebl. CI on 20057444 (run 39106786420) came back with Behavior tests (Herdr) failing and serial 2 cancelled at the 30-minute ceiling (#7255). The Herdr failure was the concurrent primary/secondmate presentation-recovery step hitting the documented refuse-by-default could not acquire its session lock; refusing a concurrent resume in bin/fm-spawn.sh, a path this PR doesn't touch.

I reviewed what changed in 34b6ff6a. It's test-only (tests/fm-backend-herdr-presentation-e2e.test.sh): the test retries a recovery only when it was refused for exactly that documented session-lock contention, and only after both competitors finish, and cleanup adds a chmod -R u+w. There are no workflow or CI-script changes and nothing that touches secrets. I've approved the pending fork workflow runs (CI 39123213416, Require no-mistakes 39123213494). The no-mistakes attestation matches 34b6ff6a.

Contract-class: restore (unchanged): rows queued for main reach main again on the handling-successor path, which is the existing default promise.

Waiting on CI only. Nothing is needed from you. If CI and no-mistakes come back green and the PR is still cleanly mergeable against latest main, it gets merged.

@calebl
calebl force-pushed the fm/fm-session-stall-2026-10-16 branch from 34b6ff6 to 573b92b Compare October 21, 2026 06:22
@calebl calebl changed the title fix(bin): resurface queued wakes from handling successors fix: resurface queued main wakes after handled turns Oct 21, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @calebl for re-raising this through no-mistakes on current main.

What I checked (head 573b92bb vs main 8eb9be51): once a handled turn finishes, bin/fm-supervision-host.sh settles the successor handoff before parking (fm_recovery_marker_handling_settled runs under the queue and marker locks and turns an open handling episode into downtime only while a row is still queued). A handling successor in bin/fm-watch.sh then closes once with the existing check: rearm-resurface wake, and only while a row is still queued for main. The other changes are docs plus test-only stabilizations (the Herdr session-lock retry and a 60s remote-secondmate wait). There are no workflow, network, or secret changes. The attestation binds this head.

Fork CI approved for this head: CI 39554996138 and Require no-mistakes 39554996039 / 39555018358 / 39560965493.

Contract-class: restore (my own read, unchanged). Main's docs/supervision-host.md already promises that main-only rows sharing the queue stay queued for main and reach it. On the handling-successor path, a row appended during successor startup or while the host was parked never did. The fix reuses the existing recovery wake, so it adds no new wake class.

VISION.md: One captain aligns (a captain inbox note no longer sits silently) · Authority aligns · Scripts aligns (exact lock-guarded state transition) · Restart aligns (obligations are closed by the durable queue, which is the point of the fix) · Delegation aligns (regression fixtures) · Vendor aligns · Scope aligns.

One thing I'd ask of you, when you have a moment: live validation on this head is 0 of 3. All three rows are deterministic fixtures with a stubbed engine and fake tmux, which is good coverage but not the product running. Could you post a short trace from a real supervision host? Ideally it shows a main-only row (an inbox note works) appended while the host is parked on a handled wake's successor, and main waking to drain it. Re-raising through no-mistakes with live rows works just as well. Once that's in and CI is green, this can take the merge path.

@calebl

calebl commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Live trace from a real supervision host on head 573b92bb, as requested.

Setup: an isolated lab copy of this branch opted into the supervision host, a real interactive Claude Code 2.1.306 primary (haiku) sitting idle at its prompt with the tracked Stop hook, and the default Claude print-mode engine. The only inputs after the primary's setup prompt are the two appends below.

16:58:12Z  primary idle; host parked on watcher 3539737
16:58:12Z  routine status appended:  working: step one of the demo task
16:58:30Z  host log: 1792601910  handled  turn=host-3538830-1792601889.1  posture=attended
16:58:35Z  host parked on handling successor watcher 3553766; main not woken
           marker acked:handling:3539737.1792601893.t2C7pQ; queue rows: 0
16:58:35Z  fm-inbox.sh note "Basecamp: please look at the demo export when you can"
           queue: 1792601915  5  check  inbox:1792601915-eDMiFU  check: captain inbox note 1792601915-eDMiFU - Basecamp: please look at the demo export when you can
           marker: pending:downtime:3594953.1792601915.0AsGLc
16:58:36Z  successor 3553766 exits: reason=actionable-check (started 16:58:15Z)
16:58:36Z  host log: 1792601916  pass-through  attended  main-only
16:58:38Z  Stop hook rewake delivered to main:
           firstmate watcher wake - one supervision event needs a handling turn now.
           check: rearm-resurface
           main ran: bin/fm-wake-drain.sh
             -> 1792601915  5  check  inbox:1792601915-eDMiFU  check: captain inbox note ...
             -> WAKE_ACK_REQUIRED: ... --ack-through 5 --recovery-generation 3594953.1792601915.0AsGLc
           main ran: bin/fm-wake-drain.sh --ack-through 5 --recovery-generation 3594953.1792601915.0AsGLc
16:58:43Z  queue: 0 rows; marker acked:handling:3594953.1792601915.0AsGLc

So the main-only inbox row appended while the host was parked on the handled wake's successor closed that successor about a second later, passed through the host as main-only, and woke the idle primary, which drained and acknowledged it; about 3 seconds from the note to the rewake.
This live run was not repeated against the pre-PR base; the deterministic regression for the same sequence (test_claude_stop_hook_rewakes_main_for_an_inbox_note_after_a_handled_wake) fails there, with the row left queued and the marker at pending downtime.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @calebl. That live trace is exactly what I asked for. A main-only inbox row appended while the host was parked on the handled wake's successor closed that successor, passed through as main-only, and woke the idle primary, which drained and acknowledged it. I'm counting live validation as done.

One real blocker in CI, and it looks like it comes from this branch rather than a flake. Behavior portable serial 2 has been cancelled at the 30-minute cap on all three of this PR's CI runs (39106786420, 39123213416, 39554996138 at head 573b92bb). Each time it stops at the same place:

  • The last passing line is host+hook: a captain outcome beside a quiet record rewakes the present captain with no away note.
  • After that, nothing is printed for about 28 minutes until the cancel.
  • The next test in tests/fm-supervision-host.test.sh is test_claude_stop_hook_runs_the_host_without_the_file_and_off_opts_out (the default-on Claude host case).

On other branches that same test passes in about 10 seconds. For example, on #7607's run 39638974899 it took 16:56:20Z → 16:56:29Z, and serial 2 finished. So it looks like that test hangs with this change applied, probably around the new fm_recovery_marker_handling_settled step before parking or the successor's rearm-resurface close. A deterministic hang in the default-on host path matters more than the usual serial 2 slowness, so I haven't rerun it.

Waiting on you: could you run tests/fm-supervision-host.test.sh (or just that case) on this head, find what it's waiting on, and push a fix? Re-raising through git push no-mistakes is ideal. The branch is 5 behind main 83b70ef4 but merges cleanly.

Contract-class: restore (my own read, unchanged). Main's docs/supervision-host.md already promises that rows queued for main reach main. The fix reuses the existing recovery wake and adds no new wake class.
VISION: every rule aligns. Delegation with a spine now aligns too, with the live trace in. The only open item is the CI hang above.

Once serial 2 completes green on a head with a matching no-mistakes attestation, this can take the merge path.

@calebl
calebl force-pushed the fm/fm-session-stall-2026-10-16 branch from 573b92b to 50fe57f Compare October 22, 2026 00:31
@calebl calebl changed the title fix: resurface queued main wakes after handled turns fix: prevent supervision sessions from stalling queued wakes Oct 22, 2026
@calebl

calebl commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for pinning the "Behavior portable serial 2" hang to test_claude_stop_hook_runs_the_host_without_the_file_and_off_opts_out; it reproduced every time on 573b92bb, and it was this branch, not a flake.

Cause. After a handled engine turn the host now settles the successor handoff under the wake-queue and recovery-marker locks. That test stops the session the moment the host logs handled, so the TERM landed inside the settle: exit 143 ran the EXIT cleanup, and its fm-wake-grant.sh release waited forever for the wake-queue lock the dying host still owned. Outside the test the same TERM would have left the queue lock held and blocked every later append.

Second defect behind it. With the hang gone, test_successor_left_at_the_turn_survives_the_hook_process_group_teardown (next in the same shard) failed on this branch and passes on main: when an accepted close turns main-only at its turn, the host republished that episode as pending downtime, so the successor it leaves running re-announced the same close with check: rearm-resurface and exited.

Fix (50fe57f, rebased on current main).

  • cleanup in bin/fm-supervision-host.sh releases the recovery-marker and wake-queue locks if this process owns them, before the grant release (fm_lock_release leaves a foreign owner alone).
  • The at-turn main-only hand-back republishes the episode as announced downtime (fm_recovery_marker_handback), since that close is the episode's delivery; the Stop hook still delivers on announced downtime, and a later durable append still opens a pending episode the successor recovers.

Regression. test_host_stopped_right_after_a_handled_wake_exits_and_frees_the_queue uses a stub-engine mode that holds the marker lock briefly as the turn ends, so the TERM always lands inside the settle; it requires the host to exit and a queue append to succeed within 10s. It fails 3 of 3 without the fix and passes 3 of 3 with it. The test you named now passes in about 12s, and the full tests/fm-supervision-host.test.sh plus the watcher, Stop-hook, wake-queue and arm suites pass locally (242 ok).

One known edge left as a follow-up: between a handling successor's final queue check and its recovery wake, a concurrent main drain could consume the row, costing one empty recovery turn (never a lost wake).

CI on 50fe57f needs workflow approval to run.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @calebl. That's a clear diagnosis. A TERM landing inside the handled-turn settle left the host's own queue lock blocking its grant release, and behind that the at-turn main-only hand-back was re-announcing its own close. Fixing both in the host's cleanup and through fm_recovery_marker_handback, with a regression that reliably lands the TERM inside the settle, is exactly what was needed.

I read head 50fe57f3 against main bd866530 (0 behind, mergeable). The new code is the cleanup lock release (it releases only locks this process owns), the handback source that republishes as announced, the settle step and the handling-successor recovery check. The rest is tests and docs. There's no workflow, credential or network surface, so I approved this head's fork runs (CI 39700209401, Require no-mistakes 39705710581). The no-mistakes attestation binds this head.

contract-class: restore (my own read, unchanged): main's docs/supervision-host.md already promises that rows queued for main reach main. This uses the existing recovery wake and adds no new wake class or setting. VISION: every rule aligns. Your live host trace from the earlier head still covers the behaviour, and this round's changes are in shutdown and hand-back paths that the new regression pins.

Nothing is waiting on you now. If serial 2 finishes and the run is green on this head, it can take the merge path.

calebl added 14 commits October 22, 2026 10:33
The supervision host parks on the handling successor it starts for a wake
its engine handled, and a handling successor never resurfaced recovery, so
a row another script appended during the park (a captain inbox note from
the Basecamp integration) sat queued until an unrelated close - four hours
in the observed case.

A handling successor now records the newest queued sequence at its start
and closes once with the recovery wake while a newer row is still queued;
a newer row already consumed only advances that mark, so the predecessor's
delivered episode is still never re-announced.

Follow-ups, not built here:
- A row appended in the short window between a handled close and its
  successor's start (about a second) is below the successor's mark; if the
  engine handles that close without claiming the row, the row waits for the
  next close. Closing that window needs the host to treat rows left queued
  after a handled attended turn as main's, which is a separate host change.
- After a machine reboot the primary session does not restart on its own,
  so queued wakes wait until it is resumed by hand. Either auto-resume the
  primary session after boot, or alert the owner when the primary session
  is down while wakes are queued.
…t by extending the auto-relaunch watcher deadline from ~30 to ~60 seconds. The CI runner exceeded the old deadline by about 3 seconds; the changed production branch was not reachable in this fixture. `bash -n` and `git diff --check` pass. The full test was attempted but exceeded the 600-second local execution limit before reaching this case
…rying only documented session-lock contention after both competitors finish. Cleanup now handles fixture-owned read-only hooks. Targeted E2E passed; bash syntax and diff checks passed. Shellcheck reported only existing SC1091 source-following notices
…ded-back closes

Two defects in this branch's handling-successor changes surfaced as the
"Behavior portable serial 2" shard hanging at its 30-minute limit.

A TERM that lands while the host settles a handled turn's successor handoff
left the host holding the wake-queue and recovery-marker locks; its exit
cleanup then waited forever on the queue lock it still owned. The cleanup now
releases those locks if this process owns them before releasing its grant.

When an accepted close turns main-only at its turn, the host hands it back and
leaves the successor running, but republished the episode as pending
downtime, so that successor re-announced the same close and exited. The
handback now republishes the episode as already announced; a later durable
append still opens a pending episode the successor recovers.
@calebl
calebl force-pushed the fm/fm-session-stall-2026-10-16 branch from 50fe57f to e898e1f Compare October 22, 2026 15:21
@calebl calebl changed the title fix: prevent supervision sessions from stalling queued wakes fix: resurface queued wakes from handling successors Oct 22, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @calebl for the follow-up push.

I read what changed since the head I last reviewed (50fe57f3 → e898e1f8, rebased onto 05a68cb2, 4 behind main 1935d27b, merges cleanly). The two new commits only touch the handled-turn settle failure path in bin/fm-supervision-host.sh: if fm_recovery_marker_handling_settled fails, the host now logs handling-settle-failed (tab-delimited) and still parks on the successor instead of exiting to main, with a one-line note in docs/supervision-host.md and matching tests. Parking on the successor is what main already does after a handled wake, and a later main-only pass-through still restores the handoff or delivers the failure to main, so nothing goes silent. No workflow, network or credential surface, so I approved this head's fork runs (CI 39804122896, Require no-mistakes 39804122891, 39804171119). The no-mistakes attestation binds e898e1f8.

Contract-class: restore (my own read, unchanged): main's docs/supervision-host.md already promises rows queued for main reach main; this reuses the existing recovery wake with no new wake class or setting. VISION: every rule aligns. Your real-host live trace from 573b92bb still covers the behaviour; this round's delta is a failure-path fallback that the deterministic tests pin.

Nothing is waiting on you. We're waiting on CI only; if it comes back green and the PR is still cleanly mergeable, it takes the merge path.

@kunchenguid
kunchenguid merged commit ac8a767 into kunchenguid:main Oct 23, 2026
20 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @calebl — really appreciate you taking the time on this.

Rows queued while the host sits parked on a handled wake's successor now reliably make it back to main.