Repository navigation
fix(bin): stop ringing steering doorbells into dead panes - #3823
Merged
Merged
Conversation
The steering-inbox doorbell was a plain sentence plus Enter typed into a worker's pane, and the watcher re-rang it on the assumption that a ring is free. In a pane whose agent has exited that line is a shell command, and the re-ring ladder kept typing it into a shell that can never acknowledge it. - Prefix the doorbell with the shell no-op `: ` so a bare shell executes nothing while a live worker still reads the same self-describing line. `#` is not used because interactive zsh does not treat it as a comment by default and the claude harness binds it to memory mode. - fm_task_inbox_ring skips the pane (return 3) when the backend positively classifies the agent as dead; missing, ambiguous, unreadable, and unverified endpoints still ring so a blind classifier never starves a live worker. - The watcher caps the ladder for a dead pane: one stale wake for recovery, no ring, no ladder walk, and the durable record stays for stuck-crewmate-recovery. fm-send and the remote steer leg report the skip. Tests cover the no-op in real shells, the dead/live/unclassifiable ring verdicts, and the single-surfacing watcher path.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "no-mistakes(ci): Fixed the persistence-r..." | Re-trigger Greptile |
…ng for a correlated reply immediately before falling back to a nudge. Added a deterministic regression covering replies arriving between the preliminary resolution pass and timeout handling. Verified with the targeted restart suite, project lint, coverage guard, bash syntax checks, and diff checks
Intent
Stop the wasteful doorbells to dead panes with a simple, reliable fix in the firstmate repo. A dead worker's pane must never execute doorbell text as commands, and no dead endpoint may be re-rung forever.
What Changed
Risk Assessment
Testing
Completed 1 recorded test check.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed (4) ✅
bin/fm-task-inbox-lib.sh:257- The required invariant “A dead worker's pane must never execute doorbell text as commands” is still violated because the new:prefix embeds$absunquoted. For an allowed FM_HOME such as/tmp/fm; touch /tmp/doorbell-ran; #, a worker that exits after the liveness check causes the shell to parse and executetouch. Quote or safely encode both generated paths so arbitrary valid path bytes cannot introduce shell syntax.🔧 Fix: Quote doorbell paths against shell injection
1 error still open:
bin/fm-task-inbox-lib.sh:255- The required invariant “A dead worker's pane must never execute doorbell text as commands” remains violated for valid paths containing terminal control bytes. Shell quoting does not neutralize the TTY line discipline: an ETX/Ctrl-C byte in$abscan clear the leading:aftertmux send-keys -l, leaving a crafted suffix such astouch marker; #to execute when Enter is sent. The existingsh -cregression bypasses this terminal boundary. Require explicit approval for the path policy, then encode paths into terminal-safe printable text or reject control-byte paths before constructing the doorbell.🔧 Fix: Reject terminal-control paths before ringing
1 error still open:
bin/fm-task-inbox-lib.sh:294- The required invariant “A dead worker's pane must never execute doorbell text as commands” remains violated during an agent-to-shell transition. After the liveness check reports alive,fm_backend_send_text_submitdelivers the line as individual terminal input and later sends Enter; if the agent consumes the prefix and exits while the remaining suffix is delivered, the shell can receive and execute a suffix such asmv each handled file to '<inbox>'/handled/.. With matching files in the pane's working directory, this causes real mutation. The leading:only protects delivery of the complete line. A durable remedy needs authorization because it requires process-bound/atomic delivery at the shared backend submission boundary or another protocol guaranteeing every partial suffix is inert.🔧 Fix: Document accepted partial doorbell delivery race
2 errors still open:
bin/fm-task-inbox-lib.sh:284- The liveness guard skips onlydead, although the shared backend contract also treatsmissingas authoritative recovery evidence. For a tmux window omitted from the verified session inventory,fm_backend_agent_statereturnsmissing, after which this function continues into composer capture and submission; the tmux classifier explicitly warns that an absent named target can fall back to the active window, so an unrelated agent can receive and act on this inbox doorbell. Treat bothdeadandmissingas non-ringable recovery states at this shared boundary.bin/fm-watch.sh:357- The new dead-agent recovery branch is unreachable when a crashed worker leaves a trustedbusyrecord behind. Concrete sequence: the agent records busy, exits abruptly to a shell without settling, then receives an inbox record; the initial ring returns 3, but every watcher poll returns here beforefm_task_inbox_ringperforms its live process check. The pane-staleness path also trusts the same busy record, so the instruction is never rung or surfaced for recovery. Check recovery-grade agent liveness before the semantic busy early-return and route a confirmed dead agent through the one-time escalation path.🔧 Fix: Skip unavailable endpoints before busy-state handling
✅ Re-checked - no issues remain.
bin/fm-test-run.sh --changed --exclude-family real-herdr-gated🔧 Fix: Respect shell startup PATH in environment allowlist test
1 error still open:
bin/fm-test-run.sh --changed --exclude-family real-herdr-gated🔧 Fix: Fix doorbell test fixtures for endpoint liveness
1 error still open:
bin/fm-test-run.sh --changed --exclude-family real-herdr-gated🔧 Fix: Prioritize confirmed restarts and clean shell test syntax
1 error still open:
bin/fm-test-run.sh --changed --exclude-family real-herdr-gatedbin/fm-send.sh:1014- The user-facing notice says the agent exited and names only a dead pane, although return code 3 also covers a missing endpoint; the remote notice at bin/fm-remote-secondmate-control.sh:289 has the same mismatch. Executable strings were outside this documentation-only phase.🔧 Fix: Verify doorbell recovery documentation
1 warning still open:
bin/fm-send.sh:1014- The notice still says only that the agent exited, although return code 3 also covers a missing endpoint; bin/fm-remote-secondmate-control.sh:289 has the same mismatch, but changing executable output is outside this documentation-only phase.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.