Repository navigation
fix(bin): prevent routed secondmate work from stranding - #2848
Merged
Merged
Conversation
Confidence Score: 5/5The PR appears safe to merge because the previously reported handoff and teardown failures no longer remain at the current head. No blocking failure remains. Reviews (7): Last reviewed commit: "no-mistakes(document): Clarify handoff r..." | Re-trigger Greptile |
…te wake confirmation
kunchenguid
force-pushed
the
fm/fm-handoff-stranding-fix-r1
branch
from
August 23, 2026 10:38
ec352be to
8727e97
Compare
Intent
Fix routed-work STRANDING in firstmate shared supervision and hand-off core, referencing GitHub issue #2791. Address both coupled defects: (1) distinguish agent liveness from wake-loop and queue-consumption liveness for registered local second mates, so when the oldest unacknowledged foreign durable wake-queue row exceeds a bounded age, outer supervision emits exactly one durable, idempotent parent notification identifying the mate and row, remains quiet for empty or healthy queues, and detects age read-only without consuming or rewriting the foreign row; (2) make a routed backlog hand-off reliably wake the receiving home through its supported delivery path, or fail loudly and observably if it cannot, so routed work cannot silently strand until a manual nudge. Preserve the diagnosis boundary around wake-queue consumption and hand-off wake, excluding process-event application or re-arm behavior unless genuinely reproduced. Add behavioral regression tests under tests/ for both reproductions: stalled foreign queue notification exactly once and idempotently with byte-for-byte row preservation plus quiet empty/healthy cases, and routed hand-off waking the receiver or surfacing failure. Exercise executable interfaces and review affected supported harness/runtime surfaces. Deliver one no-mistakes PR, reference #2791, do not merge, and note that homes pick up the fix after merge plus self-update coordinated with the main firstmate.
What Changed
Risk Assessment
✅ Low: The durable wake, stall supervision, handoff recovery, and teardown staging paths preserve the required invariants with no remaining source-verifiable defect found.
Testing
Targeted local and remote handoff, wake-queue stall supervision, crash recovery, retry, concurrency, teardown, and pending-reply reconciliation checks passed; end-user transcripts demonstrate one durable stall notification with byte-identical foreign rows and a routed item persisted and woken exactly once through the supported tmux endpoint.
Evidence: Stalled foreign queue supervision transcript
Source: Stalled foreign queue supervision transcript
Evidence: Routed handoff and receiver wake transcript
Source: Routed handoff and receiver wake transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
bin/fm-teardown.sh:2653- The home is irreversibly removed before wake retirement. Ifhandoff_wake_retirethen fails, teardown preserves the registry route and metadata while its home no longer exists; the advertised retry fails earlier at home validation and can never finish cleanup. Make home removal and wake retirement recoverable as one teardown transition, such as staging wake state for rollback before removing the home.🔧 Fix: Make local wake retirement recoverable
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
Inspected the target diff against base commit801c0838fdb19823b6d215f6ad15522ee7c3c007.bash tests/fm-wake-queue.test.shbash tests/fm-backlog-handoff.test.shbash tests/fm-remote-backlog-handoff.test.shbash tests/fm-pending-reply.test.shExecuted evidence-only focused harnesses exercisingfm-watch-checkpoint.sh,fm-wake-drain.sh, andfm-backlog-handoff.shthrough their executable interfaces.git status --shortconfirmed testing left the worktree clean.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.