Repository navigation
fix: auto-relaunch dead secondmates during supervision - #5496
Conversation
…supervision A persistent secondmate whose primary agent exits mid-session previously stayed down until the next session-start liveness sweep. Extract the sweep's probe/classify/relaunch mechanics into a shared library and drive the same contract from a cadence-gated watcher tick, so a positively dead or missing endpoint is relaunched through the guarded spawn path within a poll cycle instead of an hour later. Only the recovery-grade `dead` and `missing` verdicts authorize relaunch; ambiguous, unreadable, unverified, and unreachable-remote reads stay fail-closed and a remote route is never replaced by a local endpoint. Each relaunch emits exactly one `check` wake and appends to a durable per-mate ledger; a mate exceeding the bounded attempt budget is parked behind a marker until a live probe rearms it. A per-mate liveness lock serializes the tick against a concurrent session-start sweep.
…te on remote teardown
…nder liveness lock
…id-session recovery
…liveness library in both callers and marked its result globals as intentional library outputs. Changed-file lint passed; full CI partitions were not run locally
…tests/fm-wake-queue.test.sh. ShellCheck, bash syntax, and the full wake-queue test script pass
…legs now seed the liveness cadence marker, preventing the new endpoint probe from interfering with their assertions. The full wake-queue test, ShellCheck, and diff checks pass locally
|
Live validation results (disposable Herdr session fm-lab-liveval-63043-16676, disposable FM_HOME, HERDR_SESSION pinned to the lab on every command; fm-remote/default session/real homes untouched; lab torn down after): Scenario 1 - ordinary supervision relaunch: PASS. Killed the mate's agent -> one Scenario 2 - safety states: PASS. Remote mate rsm1 registered against a scripted stub ssh. Replies Scenario 3 - cadence, budget, rearm, locking: PASS. Gated leg (FM_SECONDMATE_LIVENESS_SECS=3600, fresh tick marker) left the dead mate untouched. Fourth death after three attempts emitted the park line Scenario 4 - session-start, detect-only, retirement: PASS. Full evidence: data/fm-secondmate-auto-relaunch-r1/live-validation.md in the task home. No defect found; no code changed. |
) * feat(bin): auto-relaunch dead persistent secondmates during ordinary supervision A persistent secondmate whose primary agent exits mid-session previously stayed down until the next session-start liveness sweep. Extract the sweep's probe/classify/relaunch mechanics into a shared library and drive the same contract from a cadence-gated watcher tick, so a positively dead or missing endpoint is relaunched through the guarded spawn path within a poll cycle instead of an hour later. Only the recovery-grade `dead` and `missing` verdicts authorize relaunch; ambiguous, unreadable, unverified, and unreachable-remote reads stay fail-closed and a remote route is never replaced by a local endpoint. Each relaunch emits exactly one `check` wake and appends to a durable per-mate ledger; a mate exceeding the bounded attempt budget is parked behind a marker until a live probe rearms it. A per-mate liveness lock serializes the tick against a concurrent session-start sweep. * no-mistakes(review): Fail closed on relaunch ledger errors; clear state on remote teardown * no-mistakes(review): Share ledger read guard; retire relaunch state under liveness lock * no-mistakes(review): Lazy-load wake lib; live rearm restores full relaunch budget * no-mistakes(review): Finish liveness tick for every mate before waking once * no-mistakes(review): Keep liveness tick scanning past per-mate errors, then wake * no-mistakes(review): Wake only on queued rows; teardown holds liveness lock * no-mistakes(review): Queue liveness outcome wake before releasing mate lock * no-mistakes(document): Update secondmate liveness documentation for mid-session recovery * no-mistakes(lint): Fix empty assignments flagged by ShellCheck * no-mistakes(ci): Added ShellCheck analysis boundaries for the shared liveness library in both callers and marked its result globals as intentional library outputs. Changed-file lint passed; full CI partitions were not run locally * no-mistakes(ci): Fixed Lint 2 by removing an unused test variable in tests/fm-wake-queue.test.sh. ShellCheck, bash syntax, and the full wake-queue test script pass * no-mistakes(ci): Fixed the CI wake-queue fixture: stall-only watcher legs now seed the liveness cadence marker, preventing the new endpoint probe from interfering with their assertions. The full wake-queue test, ShellCheck, and diff checks pass locally
) * feat(bin): auto-relaunch dead persistent secondmates during ordinary supervision A persistent secondmate whose primary agent exits mid-session previously stayed down until the next session-start liveness sweep. Extract the sweep's probe/classify/relaunch mechanics into a shared library and drive the same contract from a cadence-gated watcher tick, so a positively dead or missing endpoint is relaunched through the guarded spawn path within a poll cycle instead of an hour later. Only the recovery-grade `dead` and `missing` verdicts authorize relaunch; ambiguous, unreadable, unverified, and unreachable-remote reads stay fail-closed and a remote route is never replaced by a local endpoint. Each relaunch emits exactly one `check` wake and appends to a durable per-mate ledger; a mate exceeding the bounded attempt budget is parked behind a marker until a live probe rearms it. A per-mate liveness lock serializes the tick against a concurrent session-start sweep. * no-mistakes(review): Fail closed on relaunch ledger errors; clear state on remote teardown * no-mistakes(review): Share ledger read guard; retire relaunch state under liveness lock * no-mistakes(review): Lazy-load wake lib; live rearm restores full relaunch budget * no-mistakes(review): Finish liveness tick for every mate before waking once * no-mistakes(review): Keep liveness tick scanning past per-mate errors, then wake * no-mistakes(review): Wake only on queued rows; teardown holds liveness lock * no-mistakes(review): Queue liveness outcome wake before releasing mate lock * no-mistakes(document): Update secondmate liveness documentation for mid-session recovery * no-mistakes(lint): Fix empty assignments flagged by ShellCheck * no-mistakes(ci): Added ShellCheck analysis boundaries for the shared liveness library in both callers and marked its result globals as intentional library outputs. Changed-file lint passed; full CI partitions were not run locally * no-mistakes(ci): Fixed Lint 2 by removing an unused test variable in tests/fm-wake-queue.test.sh. ShellCheck, bash syntax, and the full wake-queue test script pass * no-mistakes(ci): Fixed the CI wake-queue fixture: stall-only watcher legs now seed the liveness cadence marker, preventing the new endpoint probe from interfering with their assertions. The full wake-queue test, ShellCheck, and diff checks pass locally
) * feat(bin): auto-relaunch dead persistent secondmates during ordinary supervision A persistent secondmate whose primary agent exits mid-session previously stayed down until the next session-start liveness sweep. Extract the sweep's probe/classify/relaunch mechanics into a shared library and drive the same contract from a cadence-gated watcher tick, so a positively dead or missing endpoint is relaunched through the guarded spawn path within a poll cycle instead of an hour later. Only the recovery-grade `dead` and `missing` verdicts authorize relaunch; ambiguous, unreadable, unverified, and unreachable-remote reads stay fail-closed and a remote route is never replaced by a local endpoint. Each relaunch emits exactly one `check` wake and appends to a durable per-mate ledger; a mate exceeding the bounded attempt budget is parked behind a marker until a live probe rearms it. A per-mate liveness lock serializes the tick against a concurrent session-start sweep. * no-mistakes(review): Fail closed on relaunch ledger errors; clear state on remote teardown * no-mistakes(review): Share ledger read guard; retire relaunch state under liveness lock * no-mistakes(review): Lazy-load wake lib; live rearm restores full relaunch budget * no-mistakes(review): Finish liveness tick for every mate before waking once * no-mistakes(review): Keep liveness tick scanning past per-mate errors, then wake * no-mistakes(review): Wake only on queued rows; teardown holds liveness lock * no-mistakes(review): Queue liveness outcome wake before releasing mate lock * no-mistakes(document): Update secondmate liveness documentation for mid-session recovery * no-mistakes(lint): Fix empty assignments flagged by ShellCheck * no-mistakes(ci): Added ShellCheck analysis boundaries for the shared liveness library in both callers and marked its result globals as intentional library outputs. Changed-file lint passed; full CI partitions were not run locally * no-mistakes(ci): Fixed Lint 2 by removing an unused test variable in tests/fm-wake-queue.test.sh. ShellCheck, bash syntax, and the full wake-queue test script pass * no-mistakes(ci): Fixed the CI wake-queue fixture: stall-only watcher legs now seed the liveness cadence marker, preventing the new endpoint probe from interfering with their assertions. The full wake-queue test, ShellCheck, and diff checks pass locally
) * feat(bin): auto-relaunch dead persistent secondmates during ordinary supervision A persistent secondmate whose primary agent exits mid-session previously stayed down until the next session-start liveness sweep. Extract the sweep's probe/classify/relaunch mechanics into a shared library and drive the same contract from a cadence-gated watcher tick, so a positively dead or missing endpoint is relaunched through the guarded spawn path within a poll cycle instead of an hour later. Only the recovery-grade `dead` and `missing` verdicts authorize relaunch; ambiguous, unreadable, unverified, and unreachable-remote reads stay fail-closed and a remote route is never replaced by a local endpoint. Each relaunch emits exactly one `check` wake and appends to a durable per-mate ledger; a mate exceeding the bounded attempt budget is parked behind a marker until a live probe rearms it. A per-mate liveness lock serializes the tick against a concurrent session-start sweep. * no-mistakes(review): Fail closed on relaunch ledger errors; clear state on remote teardown * no-mistakes(review): Share ledger read guard; retire relaunch state under liveness lock * no-mistakes(review): Lazy-load wake lib; live rearm restores full relaunch budget * no-mistakes(review): Finish liveness tick for every mate before waking once * no-mistakes(review): Keep liveness tick scanning past per-mate errors, then wake * no-mistakes(review): Wake only on queued rows; teardown holds liveness lock * no-mistakes(review): Queue liveness outcome wake before releasing mate lock * no-mistakes(document): Update secondmate liveness documentation for mid-session recovery * no-mistakes(lint): Fix empty assignments flagged by ShellCheck * no-mistakes(ci): Added ShellCheck analysis boundaries for the shared liveness library in both callers and marked its result globals as intentional library outputs. Changed-file lint passed; full CI partitions were not run locally * no-mistakes(ci): Fixed Lint 2 by removing an unused test variable in tests/fm-wake-queue.test.sh. ShellCheck, bash syntax, and the full wake-queue test script pass * no-mistakes(ci): Fixed the CI wake-queue fixture: stall-only watcher legs now seed the liveness cadence marker, preventing the new endpoint probe from interfering with their assertions. The full wake-queue test, ShellCheck, and diff checks pass locally
) * feat(bin): auto-relaunch dead persistent secondmates during ordinary supervision A persistent secondmate whose primary agent exits mid-session previously stayed down until the next session-start liveness sweep. Extract the sweep's probe/classify/relaunch mechanics into a shared library and drive the same contract from a cadence-gated watcher tick, so a positively dead or missing endpoint is relaunched through the guarded spawn path within a poll cycle instead of an hour later. Only the recovery-grade `dead` and `missing` verdicts authorize relaunch; ambiguous, unreadable, unverified, and unreachable-remote reads stay fail-closed and a remote route is never replaced by a local endpoint. Each relaunch emits exactly one `check` wake and appends to a durable per-mate ledger; a mate exceeding the bounded attempt budget is parked behind a marker until a live probe rearms it. A per-mate liveness lock serializes the tick against a concurrent session-start sweep. * no-mistakes(review): Fail closed on relaunch ledger errors; clear state on remote teardown * no-mistakes(review): Share ledger read guard; retire relaunch state under liveness lock * no-mistakes(review): Lazy-load wake lib; live rearm restores full relaunch budget * no-mistakes(review): Finish liveness tick for every mate before waking once * no-mistakes(review): Keep liveness tick scanning past per-mate errors, then wake * no-mistakes(review): Wake only on queued rows; teardown holds liveness lock * no-mistakes(review): Queue liveness outcome wake before releasing mate lock * no-mistakes(document): Update secondmate liveness documentation for mid-session recovery * no-mistakes(lint): Fix empty assignments flagged by ShellCheck * no-mistakes(ci): Added ShellCheck analysis boundaries for the shared liveness library in both callers and marked its result globals as intentional library outputs. Changed-file lint passed; full CI partitions were not run locally * no-mistakes(ci): Fixed Lint 2 by removing an unused test variable in tests/fm-wake-queue.test.sh. ShellCheck, bash syntax, and the full wake-queue test script pass * no-mistakes(ci): Fixed the CI wake-queue fixture: stall-only watcher legs now seed the liveness cadence marker, preventing the new endpoint probe from interfering with their assertions. The full wake-queue test, ShellCheck, and diff checks pass locally
) * feat(bin): auto-relaunch dead persistent secondmates during ordinary supervision A persistent secondmate whose primary agent exits mid-session previously stayed down until the next session-start liveness sweep. Extract the sweep's probe/classify/relaunch mechanics into a shared library and drive the same contract from a cadence-gated watcher tick, so a positively dead or missing endpoint is relaunched through the guarded spawn path within a poll cycle instead of an hour later. Only the recovery-grade `dead` and `missing` verdicts authorize relaunch; ambiguous, unreadable, unverified, and unreachable-remote reads stay fail-closed and a remote route is never replaced by a local endpoint. Each relaunch emits exactly one `check` wake and appends to a durable per-mate ledger; a mate exceeding the bounded attempt budget is parked behind a marker until a live probe rearms it. A per-mate liveness lock serializes the tick against a concurrent session-start sweep. * no-mistakes(review): Fail closed on relaunch ledger errors; clear state on remote teardown * no-mistakes(review): Share ledger read guard; retire relaunch state under liveness lock * no-mistakes(review): Lazy-load wake lib; live rearm restores full relaunch budget * no-mistakes(review): Finish liveness tick for every mate before waking once * no-mistakes(review): Keep liveness tick scanning past per-mate errors, then wake * no-mistakes(review): Wake only on queued rows; teardown holds liveness lock * no-mistakes(review): Queue liveness outcome wake before releasing mate lock * no-mistakes(document): Update secondmate liveness documentation for mid-session recovery * no-mistakes(lint): Fix empty assignments flagged by ShellCheck * no-mistakes(ci): Added ShellCheck analysis boundaries for the shared liveness library in both callers and marked its result globals as intentional library outputs. Changed-file lint passed; full CI partitions were not run locally * no-mistakes(ci): Fixed Lint 2 by removing an unused test variable in tests/fm-wake-queue.test.sh. ShellCheck, bash syntax, and the full wake-queue test script pass * no-mistakes(ci): Fixed the CI wake-queue fixture: stall-only watcher legs now seed the liveness cadence marker, preventing the new endpoint probe from interfering with their assertions. The full wake-queue test, ShellCheck, and diff checks pass locally
) * feat(bin): auto-relaunch dead persistent secondmates during ordinary supervision A persistent secondmate whose primary agent exits mid-session previously stayed down until the next session-start liveness sweep. Extract the sweep's probe/classify/relaunch mechanics into a shared library and drive the same contract from a cadence-gated watcher tick, so a positively dead or missing endpoint is relaunched through the guarded spawn path within a poll cycle instead of an hour later. Only the recovery-grade `dead` and `missing` verdicts authorize relaunch; ambiguous, unreadable, unverified, and unreachable-remote reads stay fail-closed and a remote route is never replaced by a local endpoint. Each relaunch emits exactly one `check` wake and appends to a durable per-mate ledger; a mate exceeding the bounded attempt budget is parked behind a marker until a live probe rearms it. A per-mate liveness lock serializes the tick against a concurrent session-start sweep. * no-mistakes(review): Fail closed on relaunch ledger errors; clear state on remote teardown * no-mistakes(review): Share ledger read guard; retire relaunch state under liveness lock * no-mistakes(review): Lazy-load wake lib; live rearm restores full relaunch budget * no-mistakes(review): Finish liveness tick for every mate before waking once * no-mistakes(review): Keep liveness tick scanning past per-mate errors, then wake * no-mistakes(review): Wake only on queued rows; teardown holds liveness lock * no-mistakes(review): Queue liveness outcome wake before releasing mate lock * no-mistakes(document): Update secondmate liveness documentation for mid-session recovery * no-mistakes(lint): Fix empty assignments flagged by ShellCheck * no-mistakes(ci): Added ShellCheck analysis boundaries for the shared liveness library in both callers and marked its result globals as intentional library outputs. Changed-file lint passed; full CI partitions were not run locally * no-mistakes(ci): Fixed Lint 2 by removing an unused test variable in tests/fm-wake-queue.test.sh. ShellCheck, bash syntax, and the full wake-queue test script pass * no-mistakes(ci): Fixed the CI wake-queue fixture: stall-only watcher legs now seed the liveness cadence marker, preventing the new endpoint probe from interfering with their assertions. The full wake-queue test, ShellCheck, and diff checks pass locally
* fix(bin): bound the startup-network worker's lock waits by its budget (#5528) * fix(bin): bound the startup-network worker's lock waits by its budget Fixes #5377 The deferred startup network worker bounded its sweeps with a stage budget but took the publish lock and the fleet-lock lease with an unbounded wait, so a live holder of that lock kept the detached worker alive for hours past its timeout with its output discarded at the end. Every wait now goes through the bounded acquire and shares the remaining stage or
Intent
When ongoing monitoring sees a registered persistent secondmate's recorded agent session positively dead or missing, relaunch it automatically during ordinary supervision and report it in one captain-visible line, instead of leaving the mate down until the next fleet/session startup. The user chose this option after a real incident where a secondmate's Claude session exited gracefully after hours of idleness and stayed down about an hour until the next session-start liveness sweep. Requirements: extract the existing sweep's probe/classification/relaunch mechanics from bin/fm-bootstrap.sh into a shared library (bin/fm-secondmate-liveness-lib.sh) so the session-start sweep and the watcher use identical evidence and paths; add a cadence-gated poll tick in bin/fm-watch.sh (FM_SECONDMATE_LIVENESS_SECS default 60s); relaunch only on the backend's positive dead or missing verdict through FM_SPAWN_NO_GUARD=1 fm-spawn.sh --secondmate; never relaunch on alive, ambiguous, unreadable, unverified, or remote transport failure (ssh 255 is not evidence of death); never replace a remote route with a local endpoint; kill a local endpoint only when positively dead, never pre-kill a missing one; serialize probe/kill/relaunch per mate via a shared lock so the sweep and tick cannot interfere; bound each watcher-driven spawn with a timeout; bound total attempts per mate per window (default 3 per hour) and park a flapping mate with one escalation until a live probe rearms it; emit exactly one check wake per relaunch attempt outcome and keep a durable per-mate ledger (state/.secondmate-relaunch-) so relaunch frequency is visible. Preserve bootstrap sweep output compatibility and FM_BOOTSTRAP_DETECT_ONLY behavior. Exit-status/exit-reason instrumentation was intentionally deferred - the notification lines and durable records are meant to reveal frequency first.
What Changed
Risk Assessment
🚨 High: The session-start path bypasses the required attempt limit, and ledger failures can also permit unbounded, unrecorded relaunches.
Testing
The sweep, watcher, remote-route and retirement checks passed against isolated test environments. A real named Herdr lab confirmed that an exited agent is classified dead while a live idle agent remains alive. The current gate prevented repeating a successful live spawn; no UI-facing surface changed, so no visual artifact was captured.
tests/fm-backend-herdr-agent-exit-shell-e2e.test.shran in a named Herdr lab and tore it downPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-bootstrap.sh:756- The intent requires a bound on total attempts per mate per window and parking until a live probe rearms the mate. The changed sweep relaunches every dead or missing mate without checking the ledger or park marker; only the watcher checks them at bin/fm-watch.sh:1024-1045. After three watcher attempts park a flapping mate, a session-start sweep can relaunch it while it is still dead, bypassing the bound. Enforce the shared limit before either driver acts on a relaunchable verdict.bin/fm-secondmate-liveness-lib.sh:82- If a mate's ledger is unwritable, the attempt append silently succeeds and relaunch proceeds at line 249; an unreadable ledger is counted as zero at line 92. A dead mate can therefore be relaunched on every watcher cadence without a durable record or effective bound. Fail closed on ledger read/write errors before killing or spawning.bin/fm-teardown.sh:3671- This ledger and park-marker cleanup runs only for local teardown: successful remote teardown exits at bin/fm-teardown.sh:1013-1015. Retire a flapping remote mate and register a new mate with the same ID within the window, and its first dead probe inherits the old attempts or park marker and may be incorrectly parked. Clear the per-mate relaunch state on successful remote retirement too.🔧 Fix applied.
5 issues (3 errors, 2 warnings) still open:
bin/fm-bootstrap.sh:756- The intent requires a bound on total attempts per mate per window and parking until a live probe rearms the mate. The changed sweep relaunches every dead or missing mate without checking the ledger or park marker; only the watcher checks them at bin/fm-watch.sh:1024-1045. After three watcher attempts park a flapping mate, a session-start sweep can relaunch it while it is still dead, bypassing the bound. Enforce the shared limit before either driver acts on a relaunchable verdict.bin/fm-secondmate-liveness-lib.sh:82- If a mate's ledger is unwritable, the attempt append silently succeeds and relaunch proceeds at line 249; an unreadable ledger is counted as zero at line 92. A dead mate can therefore be relaunched on every watcher cadence without a durable record or effective bound. Fail closed on ledger read/write errors before killing or spawning.bin/fm-teardown.sh:3671- This ledger and park-marker cleanup runs only for local teardown: successful remote teardown exits at bin/fm-teardown.sh:1013-1015. Retire a flapping remote mate and register a new mate with the same ID within the window, and its first dead probe inherits the old attempts or park marker and may be incorrectly parked. Clear the per-mate relaunch state on successful remote retirement too.bin/fm-secondmate-liveness-lib.sh:258- The round-1 fail-closed fix checks whether an attempt can be appended, but leaves the bootstrap sibling at bin/fm-bootstrap.sh:756 without a ledger read check. If an existing ledger is writable but unreadable, a dead mate is killed and spawned despite the explicit requirement to refuse either action when the ledger cannot be read. Check readability at the shared relaunch boundary before the attempt append or endpoint kill; the watcher already checks it at bin/fm-watch.sh:1028.bin/fm-teardown.sh:988- The round-1 remote-teardown fix introduced cleanup without coordinating with the liveness lock. A watcher can hold that lock while probing a dead remote mate; teardown can then retire the route and delete its ledger and lock at lines 988–990. The watcher can recreate a failed-attempt ledger for the retired ID, which a later same-ID mate inherits. Local teardown has the same lock-removal site at lines 3673–3676. Coordinate retirement and state cleanup with active liveness episodes without removing an owned lock.🔧 Fix applied.
4 issues (3 errors, 1 warning) still open:
bin/fm-bootstrap.sh:756- The intent requires a bound on total attempts per mate per window and parking until a live probe rearms the mate. The changed sweep relaunches every dead or missing mate without checking the ledger or park marker; only the watcher checks them at bin/fm-watch.sh:1024-1045. After three watcher attempts park a flapping mate, a session-start sweep can relaunch it while it is still dead, bypassing the bound. Enforce the shared limit before either driver acts on a relaunchable verdict.bin/fm-bootstrap.sh:200- The criterion “Preserve ... FM_BOOTSTRAP_DETECT_ONLY behavior” is contradicted by the new unconditional library import: bin/fm-secondmate-liveness-lib.sh:57 sources fm-wake-lib.sh, whose line 16 runsmkdir -p "$STATE". A detect-only bootstrap with no state directory now creates one. Load the mutating dependency only when a sweep runs.bin/fm-watch.sh:1075- The criterion “park a flapping mate with one escalation until a live probe rearms it” is not met: this branch removes only the park marker. If three attempts remain inside the hour, a live probe followed by another death immediately meets the unchanged count at bin/fm-watch.sh:1028 and parks again without attempting recovery. The new test at tests/fm-wake-queue.test.sh:2971 avoids this sequence by raising the limit to 10. Preserve the historical ledger while resetting the effective budget on a live rearm.bin/fm-watch.sh:1055- After a successful spawn, failure to append the check wake exits the watcher. On restart the endpoint probes alive, so that attempt's outcome is never queued or reported, contrary to “emit exactly one check wake per relaunch attempt outcome.” The failed-spawn branch at bin/fm-watch.sh:1068 and parked escalation at :1042 have the same lost-notification path. Making publication recoverable would require durable pending-delivery handling beyond this change; that remedy needs authorization.🔧 Fix applied.
4 issues (3 errors, 1 warning) still open:
bin/fm-bootstrap.sh:756- The intent requires a bound on total attempts per mate per window and parking until a live probe rearms the mate. The changed sweep relaunches every dead or missing mate without checking the ledger or park marker; only the watcher checks them at bin/fm-watch.sh:1024-1045. After three watcher attempts park a flapping mate, a session-start sweep can relaunch it while it is still dead, bypassing the bound. Enforce the shared limit before either driver acts on a relaunchable verdict.bin/fm-watch.sh:1075- The criterion “park a flapping mate with one escalation until a live probe rearms it” is not met: this branch removes only the park marker. If three attempts remain inside the hour, a live probe followed by another death immediately meets the unchanged count at bin/fm-watch.sh:1028 and parks again without attempting recovery. The new test at tests/fm-wake-queue.test.sh:2971 avoids this sequence by raising the limit to 10. Preserve the historical ledger while resetting the effective budget on a live rearm.bin/fm-watch.sh:1055- After a successful spawn, failure to append the check wake exits the watcher. On restart the endpoint probes alive, so that attempt's outcome is never queued or reported, contrary to “emit exactly one check wake per relaunch attempt outcome.” The failed-spawn branch at bin/fm-watch.sh:1068 and parked escalation at :1042 have the same lost-notification path. Making publication recoverable would require durable pending-delivery handling beyond this change; that remedy needs authorization.bin/fm-watch.sh:1057- With two registered mates whose endpoints are dead, the first relaunch callswake, which exits the watcher (bin/fm-push-transition-lib.sh:88–110) before the loop reaches the second mate. The global cadence marker was already stamped at bin/fm-watch.sh:1008, so even a restarted watcher delays that mate's probe. The failure and parked-bound branches at bin/fm-watch.sh:1070 and :1048 exit the same way. This contradicts the required ordinary-supervision recovery for registered mates. Reporting every outcome while completing the tick needs a change to wake delivery or scheduling; authorize that remedy rather than retaining the early-exit path.🔧 Fix applied.
5 issues (3 errors, 2 warnings) still open:
bin/fm-bootstrap.sh:756- The intent requires a bound on total attempts per mate per window and parking until a live probe rearms the mate. The changed sweep relaunches every dead or missing mate without checking the ledger or park marker; only the watcher checks them at bin/fm-watch.sh:1024-1045. After three watcher attempts park a flapping mate, a session-start sweep can relaunch it while it is still dead, bypassing the bound. Enforce the shared limit before either driver acts on a relaunchable verdict.bin/fm-watch.sh:1075- The criterion “park a flapping mate with one escalation until a live probe rearms it” is not met: this branch removes only the park marker. If three attempts remain inside the hour, a live probe followed by another death immediately meets the unchanged count at bin/fm-watch.sh:1028 and parks again without attempting recovery. The new test at tests/fm-wake-queue.test.sh:2971 avoids this sequence by raising the limit to 10. Preserve the historical ledger while resetting the effective budget on a live rearm.bin/fm-watch.sh:1055- After a successful spawn, failure to append the check wake exits the watcher. On restart the endpoint probes alive, so that attempt's outcome is never queued or reported, contrary to “emit exactly one check wake per relaunch attempt outcome.” The failed-spawn branch at bin/fm-watch.sh:1068 and parked escalation at :1042 have the same lost-notification path. Making publication recoverable would require durable pending-delivery handling beyond this change; that remedy needs authorization.bin/fm-watch.sh:1057- With two registered mates whose endpoints are dead, the first relaunch callswake, which exits the watcher (bin/fm-push-transition-lib.sh:88–110) before the loop reaches the second mate. The global cadence marker was already stamped at bin/fm-watch.sh:1008, so even a restarted watcher delays that mate's probe. The failure and parked-bound branches at bin/fm-watch.sh:1070 and :1048 exit the same way. This contradicts the required ordinary-supervision recovery for registered mates. Reporting every outcome while completing the tick needs a change to wake delivery or scheduling; authorize that remedy rather than retaining the early-exit path.bin/fm-watch.sh:1030- Round 4 deferred the captain-visible wake until after the loop, but left early returns inside it. If the first dead mate relaunches and queues its check row, then the next mate's ledger is unreadable, this return exits the watcher without printing the first recovery line or checking later mates. The same invariant is left behind at bin/fm-watch.sh:1036-1038 (bound-marker write), :1044-1047 (bound wake append), :1057 (success wake append), :1062-1065 (skipped relaunch), :1070 (failure wake append), :1077-1080 (rearm append), and :1082-1084 (marker removal). Preserve the pending wake and finish or explicitly handle the remaining mates on these error paths.🔧 Fix applied.
7 issues (3 errors, 4 warnings) still open:
bin/fm-bootstrap.sh:756- The intent requires a bound on total attempts per mate per window and parking until a live probe rearms the mate. The changed sweep relaunches every dead or missing mate without checking the ledger or park marker; only the watcher checks them at bin/fm-watch.sh:1024-1045. After three watcher attempts park a flapping mate, a session-start sweep can relaunch it while it is still dead, bypassing the bound. Enforce the shared limit before either driver acts on a relaunchable verdict.bin/fm-watch.sh:1075- The criterion “park a flapping mate with one escalation until a live probe rearms it” is not met: this branch removes only the park marker. If three attempts remain inside the hour, a live probe followed by another death immediately meets the unchanged count at bin/fm-watch.sh:1028 and parks again without attempting recovery. The new test at tests/fm-wake-queue.test.sh:2971 avoids this sequence by raising the limit to 10. Preserve the historical ledger while resetting the effective budget on a live rearm.bin/fm-watch.sh:1055- After a successful spawn, failure to append the check wake exits the watcher. On restart the endpoint probes alive, so that attempt's outcome is never queued or reported, contrary to “emit exactly one check wake per relaunch attempt outcome.” The failed-spawn branch at bin/fm-watch.sh:1068 and parked escalation at :1042 have the same lost-notification path. Making publication recoverable would require durable pending-delivery handling beyond this change; that remedy needs authorization.bin/fm-watch.sh:1057- With two registered mates whose endpoints are dead, the first relaunch callswake, which exits the watcher (bin/fm-push-transition-lib.sh:88–110) before the loop reaches the second mate. The global cadence marker was already stamped at bin/fm-watch.sh:1008, so even a restarted watcher delays that mate's probe. The failure and parked-bound branches at bin/fm-watch.sh:1070 and :1048 exit the same way. This contradicts the required ordinary-supervision recovery for registered mates. Reporting every outcome while completing the tick needs a change to wake delivery or scheduling; authorize that remedy rather than retaining the early-exit path.bin/fm-watch.sh:1030- Round 4 deferred the captain-visible wake until after the loop, but left early returns inside it. If the first dead mate relaunches and queues its check row, then the next mate's ledger is unreadable, this return exits the watcher without printing the first recovery line or checking later mates. The same invariant is left behind at bin/fm-watch.sh:1036-1038 (bound-marker write), :1044-1047 (bound wake append), :1057 (success wake append), :1062-1065 (skipped relaunch), :1070 (failure wake append), :1077-1080 (rearm append), and :1082-1084 (marker removal). Preserve the pending wake and finish or explicitly handle the remaining mates on these error paths.bin/fm-watch.sh:1069- Round 5 introduced this path while preserving the pending wake. If appending the first mate’s check row fails,first_reasonis still set; after scanning the remaining mates,wakeprints that unqueued outcome and exits 0, hiding the failure. The same path applies to relaunch success, relaunch failure, and bound escalation at lines 1034–1045. Set the wake reason only for a successfully queued or already-present row, while retaining the error when no row was queued.bin/fm-teardown.sh:1001- The earlier fix-round teardown cleanup treats a busy liveness lock as successful retirement and leaves both the ledger and park marker. A subsequent secondmate registered with the same ID inherits the old marker and can remain parked despite its own dead endpoint. Both remote teardown at line 989 and local teardown at line 3687 use this helper. Make retirement report incomplete cleanup for retry, or serialize cleanup before reporting teardown complete.🔧 Fix applied.
7 issues (3 errors, 4 warnings) still open:
bin/fm-bootstrap.sh:756- The intent requires a bound on total attempts per mate per window and parking until a live probe rearms the mate. The changed sweep relaunches every dead or missing mate without checking the ledger or park marker; only the watcher checks them at bin/fm-watch.sh:1024-1045. After three watcher attempts park a flapping mate, a session-start sweep can relaunch it while it is still dead, bypassing the bound. Enforce the shared limit before either driver acts on a relaunchable verdict.bin/fm-watch.sh:1075- The criterion “park a flapping mate with one escalation until a live probe rearms it” is not met: this branch removes only the park marker. If three attempts remain inside the hour, a live probe followed by another death immediately meets the unchanged count at bin/fm-watch.sh:1028 and parks again without attempting recovery. The new test at tests/fm-wake-queue.test.sh:2971 avoids this sequence by raising the limit to 10. Preserve the historical ledger while resetting the effective budget on a live rearm.bin/fm-watch.sh:1055- After a successful spawn, failure to append the check wake exits the watcher. On restart the endpoint probes alive, so that attempt's outcome is never queued or reported, contrary to “emit exactly one check wake per relaunch attempt outcome.” The failed-spawn branch at bin/fm-watch.sh:1068 and parked escalation at :1042 have the same lost-notification path. Making publication recoverable would require durable pending-delivery handling beyond this change; that remedy needs authorization.bin/fm-watch.sh:1057- With two registered mates whose endpoints are dead, the first relaunch callswake, which exits the watcher (bin/fm-push-transition-lib.sh:88–110) before the loop reaches the second mate. The global cadence marker was already stamped at bin/fm-watch.sh:1008, so even a restarted watcher delays that mate's probe. The failure and parked-bound branches at bin/fm-watch.sh:1070 and :1048 exit the same way. This contradicts the required ordinary-supervision recovery for registered mates. Reporting every outcome while completing the tick needs a change to wake delivery or scheduling; authorize that remedy rather than retaining the early-exit path.bin/fm-watch.sh:1030- Round 4 deferred the captain-visible wake until after the loop, but left early returns inside it. If the first dead mate relaunches and queues its check row, then the next mate's ledger is unreadable, this return exits the watcher without printing the first recovery line or checking later mates. The same invariant is left behind at bin/fm-watch.sh:1036-1038 (bound-marker write), :1044-1047 (bound wake append), :1057 (success wake append), :1062-1065 (skipped relaunch), :1070 (failure wake append), :1077-1080 (rearm append), and :1082-1084 (marker removal). Preserve the pending wake and finish or explicitly handle the remaining mates on these error paths.bin/fm-watch.sh:1069- Round 5 introduced this path while preserving the pending wake. If appending the first mate’s check row fails,first_reasonis still set; after scanning the remaining mates,wakeprints that unqueued outcome and exits 0, hiding the failure. The same path applies to relaunch success, relaunch failure, and bound escalation at lines 1034–1045. Set the wake reason only for a successfully queued or already-present row, while retaining the error when no row was queued.bin/fm-watch.sh:1063- Round 7 made teardown hold the per-mate liveness lock through retirement, but left wake publication outside that lock. After a relaunch, the watcher can unlock; teardown can then remove the mate's route and ledger; and the watcher can append a check wake for the retired mate. The same gap affects failed-relaunch and parked-bound wakes at lines 1032–1045. Queue each outcome while the liveness lock is still held so retirement cannot finish before publication.🔧 Fix applied.
2 issues (1 error, 1 warning) still open:
bin/fm-bootstrap.sh:756- The intent requires a bound on total attempts per mate per window and parking until a live probe rearms the mate. The changed sweep relaunches every dead or missing mate without checking the ledger or park marker; only the watcher checks them at bin/fm-watch.sh:1024-1045. After three watcher attempts park a flapping mate, a session-start sweep can relaunch it while it is still dead, bypassing the bound. Enforce the shared limit before either driver acts on a relaunchable verdict.bin/fm-watch.sh:1055- After a successful spawn, failure to append the check wake exits the watcher. On restart the endpoint probes alive, so that attempt's outcome is never queued or reported, contrary to “emit exactly one check wake per relaunch attempt outcome.” The failed-spawn branch at bin/fm-watch.sh:1068 and parked escalation at :1042 have the same lost-notification path. Making publication recoverable would require durable pending-delivery handling beyond this change; that remedy needs authorization.🔧 **Test** - 2 issues found → no changes applied ✅
tests/fm-backend-herdr-agent-exit-shell-e2e.test.shdrove real Pi panes in a guarded Herdr lab.tests/fm-secondmate-liveness.test.shtests/fm-wake-queue.test.shtests/fm-remote-secondmate-lifecycle-e2e.test.shtests/fm-secondmate-lifecycle-e2e.test.shtests/fm-backend-herdr-agent-exit-shell-e2e.test.shin a guarded Herdr labbash ~/.no-mistakes/evidence/01M38TF2KZXC1QXX3WV5GG523P/live-watch-lab.shagainst a guarded, non-default Herdr session🔧 No changes applied.
✅ Re-checked - no issues remain.
tests/fm-backend-herdr-agent-exit-shell-e2e.test.shran in a named Herdr lab and tore it downtests/fm-secondmate-liveness.test.shtests/fm-wake-queue.test.shtests/fm-remote-secondmate-lifecycle-e2e.test.shtests/fm-secondmate-lifecycle-e2e.test.shtests/fm-backend-herdr-agent-exit-shell-e2e.test.sh✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.