Repository navigation
fix: keep Claude watcher owned until handling starts - #71
Merged
Merged
Conversation
A Claude rewake only requests the handling turn. The mid-turn health predicate accepted any rewake bound to the live session and recovery generation with no age bound, so a continuation that never started read as healthy indefinitely. Long-turn tolerance now requires the recovery marker to show handling, or the rewake to still be inside grace. With acknowledged hand-backs on, the away return on a captain inbox note now goes through the same acknowledged owner as every other host hand-back instead of resting on one successor cycle.
… handling receipt, stale-beacon failure case, and unverified host successor. The focused ancestry, auto-arm, host, and host-park tests pass; `bin/fm-lint.sh` and `git diff --check` pass. CI-3 remains tied to the same-generation receipt case explicitly declined in this run, CI-4 is an unrelated timeout in the unmodified remote lifecycle test, and Full suite aggregates lane failures
…k marker failures Code: - A handling-mode continuation owner exits once main has begun handling a generation it followed, instead of re-reading the marker and reviving on a later downtime episode (for example one an explicit stop opens), which raced fresh arms for the watcher lock. - A Claude hand-back whose downtime republication fails now logs pass-through downtime-unrestored, as the main-only path did before the continuation owner took over that path. Fixtures (both encoded the old idle gap, where no watcher survived a hand-back): - park_again treated a live watcher as proof the next park started; the continuation owner now leaves one live between parks, so it also waits for the park's own output. - The stream case stopped the hand-back's watcher and expected a fresh arm's watcher to stay up; that stop now opens a downtime episode, so main handles it before the orphan arm starts.
The gated-actionable arm fixture replaced the shared fixture header, so the handling successor now started by fm-supervision-handoff.sh ran the gated foreground body and never reported a healthy watcher. Append to the shared header instead and count the two foreground arms and the one successor separately; product behaviour is unchanged.
Keep the fixture successor alive until handling is observed instead of repeating the old immediate-exit arm behavior. Give each phase its own generation and retire its watcher before testing the next session's identity. Add the missing ShellCheck source directive for the engine library.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Q2244 ALL (2026-11-18, main chat): "q2244 all. feel free to do whatever you think is the good idea amd is safe" - use the Claude allowance before its reset on three Claude-only jobs.
This job is part of option C: build this held Firstmate fix now, with Claude writing the code.
A Claude rewake idle gap: when Claude's requested follow-up turn never starts, supervision can go idle for hours. The 2026-10-31 investigation found that gap still reproduces. A recorded rewake only proves a follow-up was requested; it does not prove the follow-up turn started. If that turn never starts, the watcher can exit and leave queued work with nobody watching for hours.
Keep a watcher owner until there is a generation-bound receipt that handling actually started, rather than treating the rewake request as that receipt. The owner has to keep or replace the watcher across later closes while that receipt is absent, including when a session parks or a hand-back fails, because those paths can leave no watcher at all. One extra watcher that exits on the next close is not enough. Retry in a bounded way when the follow-up turn is missing. Do not invent a vendor scheduling fix from the lost historical trace. Keep the already-shipped successor-before-rewake correction; do not recreate it.
Make the health check stricter: require observed handling before treating a long idle stretch as a healthy long turn, and record a failed successor as failed continuity even when a rewake was requested.
The regression should withhold the handling turn, send a second decision, and require the watcher to stay owned without another turn ending. Keep the case where the next turn does start as a control, and cover the park boundary and a failed successor.
Later captain word: "q2252 y". That choice skips this pipeline's own test step for this pull request and relies on GitHub CI.
What Changed
Risk Assessment
Testing
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-supervision-host.sh:809- continuation_handback now runs for every Claude hand-back, including the default handling mode where config/supervision-handoff-ack is absent. Sequence: the opt-in is off, the handling owner fails to start (for example, the main session identity cannot be read), and leave_successor_for_main also fails. Main's rewake then carries 'supervision-host: the acknowledged hand-back successor could not be verified', which wrongly tells main that an acknowledged hand-back was configured and is pending. Choose the line by $mode: keep this one for ack, and use a neutral 'the hand-back continuation successor could not be verified' for handling. tests/fm-supervision-host-hook.test.sh:65/80/101 assert on the current string; keep the ack-mode assertion and adjust any assertion that covers handling mode.⏭️ **Test** - skipped
Step was skipped.
✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.