Repository navigation
fix(bin): stop a self-hosted away daemon deferring every escalation - #3050
AgardnerAU wants to merge 10 commits into
Conversation
…being busy Away mode buffered every escalation and delivered none. The daemon log carried 6,910 consecutive "supervisor pane busy (agent mid-turn)" deferrals with no gap over 8.7 hours, one buffer held 31,396 seconds overnight, and zero deliveries. Cause. On the native hosting the daemon runs as a background job of the very agent it injects into. A backend's native agent-state answers "is anything running in this pane", not "is the agent mid-turn", so the daemon's own existence pinned its target busy for as long as away mode lasted. Measured 2026-08-25 on Herdr 0.8.0 with Claude Code 2.1.245: agent_status stayed "working" for 121 seconds after the turn ended, across 21 samples, while the harness's own title glyph and rendered footer both showed idle; a control pane with no background job reported "done". pane_is_busy treated native busy as conclusive, so the guard could never clear and the max-defer escape could never escape. Native busy now stays conclusive only when the daemon runs outside the pane it injects into. supervisor_pane_hosts_daemon recognizes the self-hosted case, and the verdict then falls through to the rendered delivery signature that fm-composer-lib.sh already owns as the authority on whether a pane can accept a keystroke. The composer guard is untouched, so a half-typed captain line still defers. Coverage pins the condition from both sides: a self-hosted daemon delivers through native busy, still defers while the harness renders a live turn, and a terminal-hosted daemon keeps native busy conclusive. Each new test was checked to fail without the fix, and the pre-existing short-circuit assertion catches the over-broad repair.
…gent-status reader
|
…r-delivers # Conflicts: # docs/scripts.md
|
Merged current Validated on that head: The two red checks are both |
|
The workflow runs on this pull request are held at Could a maintainer release the held runs when convenient? Happy to rebase first if the base has moved far enough to matter. |
1 similar comment
|
The workflow runs on this pull request are held at Could a maintainer release the held runs when convenient? Happy to rebase first if the base has moved far enough to matter. |
…r-delivers # Conflicts: # docs/verification/runtime-backends.md
…probe and Claude doorbell Upstream now probes pane identity before each Herdr submit and delivers Claude-bound digests as a record-backed doorbell, so the self-hosted submit fakes take the identity prefix and the self-hosted digest checks read the delivered record.
|
Merged current main into this branch; it is now up to date and ready for CI. The only conflict was two independent additions to docs/verification/runtime-backends.md, both kept. The self-hosted delivery tests now match upstream's Herdr submit identity probe and Claude doorbell delivery. |
|
Closing: no longer needed on our side; superseded by #5805. |
Intent
On 2026-09-30, after a review of every comment on the fleet's open kunchenguid/firstmate pull requests, the captain approved one upstream refresh pass: bring each conflicting PR up to date with upstream main, post one short note on each PR, and post no reminder comments.
This task covers #3050 ("fix(bin): stop a self-hosted away daemon deferring every escalation"), on branch
fm/fm-afk-inject-never-deliversfrom the forkAgardnerAU/firstmateintokunchenguid:main, current heada3936ce519b79d3bf59b97f6135f82c4541c44cd. Reuse that branch and that PR; never replace them.Context: upstream closes a PR after 14 days of author silence, and only an author push or comment resets that clock; a stale close is irreversible. Every earlier maintainer request on this PR has been addressed, and the no-mistakes attestation in its body matches its current head. The maintainer triages on author activity, and test runs on fork PRs wait for maintainer approval.
What Changed
supervisor_pane_hosts_daemontobin/fm-supervisor-target-lib.sh. It detects when the away-mode daemon runs inside the supervisor pane that it injects into, and it matches the tmux pane or the Herdr session and pane identity against the resolved target.pane_is_busyinbin/fm-supervise-daemon.shno longer treats nativebusyas conclusive for a self-hosted daemon. Instead, it falls through to the rendered delivery signature, so escalations are no longer deferred for all of away mode.fm_backend_herdr_agent_status_rawinbin/backends/herdr.shnow reports a self-hostedworkingstatus as empty. The classifiers map an empty status tounknownand never toidle, so the busy state, submit confirmation, wait-for-working and reconcile paths fall through to the rendered signature or the composer verdict. A swallowed Enter still resolves topending. Theidle,doneandblockedstatuses, and all statuses from other panes, pass through unchanged.docs/herdr-backend.md,docs/scripts.mdanddocs/verification/runtime-backends.md, which records the measured native-busy behaviour while a background job runs. Added Herdr backend and daemon tests for self-hosted delivery, and aligned these tests with the upstream submit identity probe and the Claude doorbell.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The refresh only merges upstream main and aligns three adapter fakes and two daemon digest assertions with upstream's new submit identity probe and Claude doorbell; the self-hosted boundary still holds, because the new direct
agent getread (fm_backend_herdr_agent_identity_raw at bin/backends/herdr.sh:3434) uses only the agent name in submit and only idle/done as positive evidence in the pi classifier, so an unmasked self-hostedworkingcannot be read as idle or delivered.Testing
I ran the two targeted unit suites for the change (daemon and Herdr adapter); both pass. I then drove four live scenarios on real Herdr 0.9.1 in a disposable fm-lab session. The real away daemon ran in two ways: as a background job inside the supervisor pane (true self-hosting, with Herdr's own HERDR_ENV, HERDR_SESSION and HERDR_PANE_ID), or from a separate process. In every case the pane's native agent_status readworking, and the adapter's busy_state readbusyfrom outside the pane. Results: - S1: a self-hosted daemon delivered the digest, and the buffer emptied. - S2 (control): a daemon in its own terminal deferred with "supervisor pane busy" and kept the buffer. - S3 (adversarial): a self-hosted daemon with a realesc to interruptrender still deferred. - S4 (adversarial): a self-hosted daemon whose every Enter was swallowed kept the buffer, raised .subsuper-inject-wedged, and submitted nothing. The adapter single-owner boundary scenario (S5) is covered only by unit tests, so it is recorded as untested live. Two setup problems appeared and were fixed before the final run: - This machine's ~/.local/bin/herdr is a wrapper that execs the next herdr on PATH. Any Enter-swallowing test shim placed first on PATH therefore loops forever. This also hung the existing tests/fm-afk-inject-herdr-e2e.test.sh, which I killed; its lab session was torn down. My shim now execs /opt/homebrew/bin/herdr directly. - A bash-named fixture is classified as a bare shell pane, which drops native busy before the guard is reached. The fixture now runs with argv0codex. Not done: - Showing that S1 fails on base commit eb77f02b needed an extracted copy of the base source in a temp directory, and the permission was denied. The colocated regression tests cover that reproduction. - No rendered-UI screenshot was captured. The change is daemon/CLI behaviour, and the evidence is the daemon log, the submitted-line log and pane captures in self-hosted-live.log. Cleanup: all lab sessions are torn down and the worktree is clean. Two small debug temp dirs (${TMPDIR}/fm-selfhost-live.Zg7Yvo and .nwx9yS) remain because the rm was denied.working, idle composer) delivers a needs-decision escalation into that paneworkingonly for a self-hosted pane; other panes and statuses are unchanged, and self-hosted submits confirm only on a rendered transition or a…Evidence: Live self-hosted Herdr lab transcript (4 scenarios, all PASS)
Source: Live self-hosted Herdr lab transcript (4 scenarios, all PASS)
Evidence: Live scenario driver script
Source: Live scenario driver script
Evidence: fm-daemon unit suite output
Source: fm-daemon unit suite output
Evidence: Live result summary
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
tests/fm-afk-inject-herdr-e2e.test.sh- On this machine ~/.local/bin/herdr is a /bin/sh wrapper that execs the next herdr on PATH. tests/fm-afk-inject-herdr-e2e.test.sh puts its Enter-swallowing shim first on PATH and execscommand -v herdr, which is that wrapper, so the two exec each other forever and the suite hangs. This is a local environment problem and not caused by this change. The test was killed and its lab session torn down.working, idle composer) delivers a needs-decision escalation into that paneworkingonly for a self-hosted pane; other panes and statuses are unchanged, and self-hosted submits confirm only on a rendered transition or a…bash tests/fm-daemon.test.sh(0 failures; includes the supervisor_pane_hosts_daemon, pane_is_busy self-hosted, inject_msg, actionable-wait and swallowed-escalation cases)bash tests/fm-backend-herdr.test.sh(0 failures; includes agent_status_raw masking in both directions and the three self-hosted send_text_submit cases)bash ~/.no-mistakes/evidence/01M3S0FJRB8F1421H1FPJB21X7/self-hosted-live.sh <worktree>: live script on real herdr 0.9.1 in a throwaway fm-lab-selfhost-* session through bin/fm-herdr-lab.sh prepare/teardown. It runs the real bin/fm-supervise-daemon.sh inside a Herdr pane whose registered agent (argv0 codex) is pinned to agent_status=working. 4 scenarios, all PASS.Attemptedtests/fm-afk-inject-herdr-e2e.test.sh. It hung in a local environment loop (see testing_summary) and was killed; its lab session was torn down.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.