Away mode: hand the watcher to the post-return owner with no blind gap #32
Loading…
Reference in a new issue
No description provided.
Delete branch "fm/fm-afk-return-watcher-handoff"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was wrong
When the captain returned from away mode,
fm-afk-return.shtore down the away-mode supervisor, and the watcher with it, since the supervisor owns the watcher as a child. Nothing was watching until the primary's next turn-end hook armed a new cycle. If that first turn was long or failed, wakes queued unread. That is the "landing kills supervision" class of failure, and part of why the captain came back on 09/23 to hours of inactivity.What changed
setsid), so the watcher can outlive the supervisor's shutdown.fm-afk-return.shhands that live watcher to the post-return supervision owner (a handoff marker, then verify), and falls back to a fresh arm if verification fails. There is never a moment with no watcher while supervision is needed. The singleton lock is respected, so no second cycle is created, and the supervisor still exits cleanly.docs/watcher-continuity.mdand the afk skill describe the handoff.Validation
A new colocated end-to-end test (
tests/fm-afk-return-watcher-handoff.test.sh) covers the handoff and the fallback. The existing afk, daemon, launch and watcher suites pass, and shellcheck and the doc-audience check are clean. The no-mistakes pipeline passed at21a7665.Author's commit message
fix(afk): hand the daemon's watcher to the post-return owner with no blind gap
Away-mode return tore the daemon down (its cleanup killed the watcher child)
and the primary's next Stop-hook auto-arm did not fire until the captain's
first turn ended, so on a long or failing first turn wakes queued unread.
The daemon's watcher is now setsid-detached so it survives the daemon
terminal's teardown, and on a return-ordered shutdown
state/.afk-return-watcher-handoff tells the daemon's cleanup to LEAVE its
watcher alive and holding the singleton lock. bin/fm-afk-return.sh verifies
a live singleton watcher after the daemon exits and falls back to arming a
fresh detached watcher only if the survivor did not hold, so the primary's
next auto-arm attaches instead of running blind. The handoff is gated on
fm_supervision_needed and the singleton lock stays the only definition of a
live watcher, so a second cycle is never created and no watcher is left
running when nothing needs supervising.
Open
Nothing. This is the firstmate repo, so there is no Plane story. It overlaps
bin/fm-supervise-daemon.shwith the usage-limit recovery change now in validation; whichever lands second rebases.