You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(bin): bound the away digest and log why a delivery failed - #5554
Fix#4382 upstream, as its maintainer triage asks (contract-class restore).
The away-mode daemon never delivers its batched escalation digest once the digest is larger than one command-line argument can carry.
On tmux, tmux send-keys -l rejects the text (command too long).
On herdr, herdr pane send-text <pane> <TEXT> takes the text as one positional argument, so above Linux's MAX_ARG_STRLEN (131,072 bytes including the terminating NUL, so at most 131,071 bytes of text) execve fails with E2BIG (Argument list too long, exit 126) before herdr runs; herdr 0.9.1 has no stdin or buffer form of pane send-text, so a tmux-only transport fix leaves herdr broken.
Both adapters discard the stderr, the submit core returns send-failed without ever reaching the Enter loop, the daemon keeps the identical and ever-growing batch and retries it every housekeeping pass, and every attempt is logged as submit unconfirmed after 3 retries (verdict=send-failed, text may be in composer), although no retry happened, nothing was typed, and the composer was empty.
The realistic trigger is the daemon's start-up catch-all scan, which turns each status log's whole unread span into one unbounded buffered item: with three second mates and three to five days between away sessions, the first digest was 147,961 and 195,523 bytes, and delivery failed 2,946 times in a row over 11 hours.
The fix the triage asks for: bound the injected digest in escalate_flush so delivery works on every backend, keep the full text durable so the supervisor can still read everything, and make the failure legible by distinguishing an initial-send failure from an Enter-confirmation failure in the daemon log, with the transport's stderr and the byte count; an explicit size check in the submit seam is optional defense in depth.
Do not fix it by raising the retry count or by bypassing the composer or busy guards.
What Changed
escalate_flush in bin/fm-supervise-daemon.sh now caps the injected digest at 8 KiB. Each item is cut at a UTF-8 boundary to 2 KiB with a [+N bytes] marker, and items past the budget collapse into a +K more event(s) tail. With this cap the digest fits a single tmux send-keys -l call or a single herdr/exec argument, which could not hold it before. Any digest that gets cut or loses events names a file under state/.subsuper-digests/ that holds every buffered event verbatim. The daemon keeps that file once a submit was attempted, reuses it when it retries the same buffer, and deletes it if the send was never attempted.
Delivery failures are now legible. The tmux submit core and the herdr send_literal adapter replay the transport's stderr instead of discarding it. inject_msg records the payload byte count and that error text and logs send-failed as an initial-send/Enter-delivery failure. It no longer uses the misleading "submit unconfirmed after N retries" line, which now appears only for real Enter-confirmation failures. The last failure reason, including busy or composer deferrals, is stored in INJECT_LAST_FAILURE. The wedge alarm ERROR and the .subsuper-inject-wedged marker both report it.
The /afk skill doc now covers the bounded digest, its full-text file, and the staged failure logging. Tests were added: a transport byte ceiling in the fake tmux (FM_FAKE_SEND_MAX_BYTES) and cases in tests/fm-daemon.test.sh and tests/fm-backend-herdr.test.sh.
⚠️ Medium: The bounded digest, the durable full text and the tmux/herdr stderr replay are correct and well tested (the UTF-8 cut and bash local LC_ALL behaviour were probed by hand), but herdr's Enter-never-sent path is still logged as an initial-send failure, and zellij/cmux stderr is still discarded, so the legibility requirement is only partly met.
Testing
I ran the real away daemon against a private tmux server and against a throwaway fm-lab herdr session (guarded provision and teardown; the default session was untouched), at both the base and target commits. The trigger was a 236 KB start-up catch-all span. At the base commit, both backends reproduce #4382: an endless send-failed loop, nothing typed, and a misleading log line. At the target commit, both deliver a single bounded digest of about 6.4 KB whose named full-text file keeps every event verbatim. I also drove the failure paths directly. An initial-send failure is logged by stage with its byte count and the real stderr ('command too long' from tmux, 'Argument list too long' from herdr). A swallowed Enter is logged as an Enter-confirmation failure, the full-text file named in the typed text survives retries without duplicate files, and the wedge alarm names the last delivery failure. All scenarios passed. No UI surface is involved, so the evidence is logs, pane captures, and persisted state.
Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario
Result
Live
Evidence
tmux: 236 KB start-up catch-all span is delivered as one bounded digest, and the full text is kept durable
✅ pass
live
tmux-after/ (submitted.log is one 6,446-byte valid-UTF-8 line with [+N bytes] cut markers and a .subsuper-digests path; subsuper-digests/digest-* is a verbatim copy of the 240,347-byte buffer, includi…
tmux baseline at the base commit reproduces #4382: nothing is typed and the send-failed loop repeats with a misleading 'text may be in composer'
✅ pass
live
tmux-before/daemon.log (repeated 'inject failed: submit unconfirmed after 5 retries (verdict=send-failed, text may be in composer)'; submitted.log is 0 bytes; buffer stuck at 240,347 bytes; wedge alar…
herdr lab: 236 KB start-up catch-all span is delivered as one bounded digest, and the full text is kept durable
✅ pass
live
herdr-after/ (the fm-lab-afkdigest-* session was provisioned and torn down through bin/fm-herdr-lab.sh with teardown rc=0; submitted.log is one 6,447-byte line; the full-text file is verbatim; buffer…
herdr lab baseline at the base commit reproduces #4382 (E2BIG send-failed loop, nothing delivered)
✅ pass
live
herdr-before/daemon.log (5x 'submit unconfirmed after 6 retries (verdict=send-failed, text may be in composer)'; 0 bytes submitted; buffer 240,347 bytes; wedge alarm)
herdr: an oversized initial send is logged as an initial-send-stage failure with the real E2BIG stderr and the byte count, and nothing is typed
✅ pass
live
herdr-after/direct-inject.log: 'inject failed at initial send or Enter delivery (verdict=send-failed, bytes=200058; ...): .../herdr: Argument list too long'; direct-submitted.log is 0 bytes; the compo…
tmux: a transport refusal is logged with real tmux stderr 'command too long' and the byte count, and nothing is typed
✅ pass
live
tmux-direct-50k/direct-inject.log: 'inject failed at initial send or Enter delivery (verdict=send-failed, bytes=50058; ...): command too long'; the pane composer is still empty
Adversarial, tmux with every Enter swallowed: the failure is logged as Enter-confirmation stage, the full-text file named in the typed text survives retries, retries write no extra files, and the wedg…
✅ pass
live
tmux-stages/daemon.log ('inject failed at Enter confirmation: submit unconfirmed after 3 retries (verdict=pending, bytes=4379, ...)', then about 20 composer-guard deferrals and ERROR lines naming 'las…
# Live validation: bounded away-mode digest (issue #4382)
Every run used the real `bin/fm-supervise-daemon.sh` or its real `inject_msg`, with a drawn `❯ ` composer pane that logs each submitted line.
tmux runs used a private `tmux -L` socket.
herdr runs used a throwaway `fm-lab-afkdigest-*` session owned by `bin/fm-herdr-lab.sh` (provision, then teardown rc=0; the default session was untouched).
Three secondmate status logs held about 78 KB of unread `done:` lines each, 236 KB in total, and the start-up catch-all scan buffered 240,347 bytes.
| Scenario | Base d1ce6b6 | Target ae9a182 |
|---|---|---|
| tmux: start-up catch-all digest | `inject failed: submit unconfirmed after 5 retries (verdict=send-failed, text may be in composer)` repeated, 0 bytes submitted, buffer stuck at 240,347 bytes, wedge alarm (`tmux-before/`) | one 6,446-byte line submitted, valid UTF-8, 3 items cut with `[+N bytes]`, names `.subsuper-digests/digest-*`, which is a verbatim copy of the buffer (2,100 `done:` lines plus the needs-decision), buffer cleared (`tmux-after/`) |
| herdr: start-up catch-all digest | same misleading send-failed loop, 0 bytes submitted, wedge alarm (`herdr-before/`) | one 6,447-byte line submitted, full-text file verbatim, buffer cleared (`herdr-after/`) |
| herdr: 200 KB inject_msg | `submit unconfirmed after 3 retries (verdict=send-failed, text may be in composer)` | `inject failed at initial send or Enter delivery (verdict=send-failed, bytes=200058; ...): .../herdr: Argument list too long`, nothing typed, composer still `empty` |
| tmux: 50 KB inject_msg | n/a | `inject failed at initial send or Enter delivery (verdict=send-failed, bytes=50058; ...): command too long`, nothing typed (`tmux-direct-50k/`) |
| tmux: every Enter swallowed | n/a | `inject failed at Enter confirmation: submit unconfirmed after 3 retries (verdict=pending, bytes=4379, ...)`. The full-text file named in the typed composer text still exists after about 20 composer-guard deferrals, only one file was written, and the wedge alarm and marker carry `last delivery failure: deferred: supervisor composer not confirmed-empty (state=pending...)` (`tmux-stages/`) |
[2026-09-24T20:13:49+0300] daemon starting (pid 3078390); target=%0; target_source=FM_SUPERVISOR_TARGET; backend=tmux; backend_source=FM_SUPERVISOR_BACKEND; afk=on; inject_skip='heartbeat'; stale_escalate=999999s; batch=0s
[2026-09-24T20:14:30+0300] inject failed: submit unconfirmed after 5 retries (verdict=send-failed, text may be in composer)
[2026-09-24T20:14:31+0300] inject failed: submit unconfirmed after 5 retries (verdict=send-failed, text may be in composer)
[2026-09-24T20:14:31+0300] ERROR: away-mode escalation undelivered 31s; inject could not confirm a submit (supervisor pane busy or wedged). Buffer + wake-queue preserved; alarm marker written.
[2026-09-24T20:14:33+0300] inject failed: submit unconfirmed after 5 retries (verdict=send-failed, text may be in composer)
[2026-09-24T20:14:36+0300] inject failed: submit unconfirmed after 5 retries (verdict=send-failed, text may be in composer)
[2026-09-24T20:14:38+0300] inject failed: submit unconfirmed after 5 retries (verdict=send-failed, text may be in composer)
[2026-09-24T20:14:39+0300] wake: signal: /tmp/fm-afk-digest-live.dYpxwd/secondmate-alpha.status /tmp/fm-afk-digest-live.dYpxwd/secondmate-bravo.status /tmp/fm-afk-digest-live.dYpxwd/secondmate-charlie.status
[2026-09-24T20:15:03+0300] self-handle: signal: /tmp/fm-afk-digest-live.dYpxwd/secondmate-alpha.status /tmp/fm-afk-digest-live.dYpxwd/secondmate-bravo.status /tmp/fm-afk-digest-live.dYpxwd/secondmate-charlie.status -> signal already escalated (catch-all scan): secondmate-alpha.status: done: secondmate-alpha shipped fix 700 for the café ledger, PR https://github.com/example/repo/pull/700 merged | secondmate-bravo.status: done: secondmate-bravo shipped fix 700 for the café ledger, PR https://github.com/example/repo/pull/700 merged | secondmate-charlie.status: needs-decision [key=pick-db]: choose Postgres or SQLite for the ledger
[2026-09-24T20:15:04+0300] self-handle: signal: /tmp/fm-afk-digest-live.dYpxwd/secondmate-alpha.status /tmp/fm-afk-digest-live.dYpxwd/secondmate-bravo.status /tmp/fm-afk-digest-live.dYpxwd/secondmate-charlie.status -> signal already escalated (catch-all scan): secondmate-alpha.status: done: secondmate-alpha shipped fix 700 for the café ledger, PR https://github.com/example/repo/pull/700 merged | secondmate-bravo.status: done: secondmate-bravo shipped fix 700 for the café ledger, PR https://github.com/example/repo/pull/700 merged | secondmate-charlie.status: needs-decision [key=pick-db]: choose Postgres or SQLite for the ledger
[2026-09-24T20:15:05+0300] self-handle: needs-decision: /tmp/fm-afk-digest-live.dYpxwd/secondmate-alpha.status /tmp/fm-afk-digest-live.dYpxwd/secondmate-bravo.status /tmp/fm-afk-digest-live.dYpxwd/secondmate-charlie.status -> signal already escalated (catch-all scan): secondmate-alpha.status: done: secondmate-alpha shipped fix 700 for the café ledger, PR https://github.com/example/repo/pull/700 merged | secondmate-bravo.status: done: secondmate-bravo shipped fix 700 for the café ledger, PR https://github.com/example/repo/pull/700 merged | secondmate-charlie.status: needs-decision [key=pick-db]: choose Postgres or SQLite for the ledger
[2026-09-24T20:17:55+0300] daemon starting (pid 3197998); target=fm-lab-afkdigest-3196149-23646:w1:p2; target_source=FM_SUPERVISOR_TARGET; backend=herdr; backend_source=FM_SUPERVISOR_BACKEND; afk=on; inject_skip='heartbeat'; stale_escalate=999999s; batch=0s
[2026-09-24T20:18:37+0300] inject failed: submit unconfirmed after 6 retries (verdict=send-failed, text may be in composer)
[2026-09-24T20:18:38+0300] inject failed: submit unconfirmed after 6 retries (verdict=send-failed, text may be in composer)
[2026-09-24T20:18:38+0300] ERROR: away-mode escalation undelivered 33s; inject could not confirm a submit (supervisor pane busy or wedged). Buffer + wake-queue preserved; alarm marker written.
[2026-09-24T20:18:42+0300] inject failed: submit unconfirmed after 6 retries (verdict=send-failed, text may be in composer)
[2026-09-24T20:18:45+0300] inject failed: submit unconfirmed after 6 retries (verdict=send-failed, text may be in composer)
[2026-09-24T20:18:47+0300] inject failed: submit unconfirmed after 6 retries (verdict=send-failed, text may be in composer)
[2026-09-24T20:18:48+0300] wake: signal: /tmp/fm-afk-herdr-digest.6NcIUS/secondmate-alpha.status /tmp/fm-afk-herdr-digest.6NcIUS/secondmate-bravo.status /tmp/fm-afk-herdr-digest.6NcIUS/secondmate-charlie.status
inject failed at initial send or Enter delivery (verdict=send-failed, bytes=200058; text may be in composer on backends that typed before Enter failed): .../bin/backends/herdr.sh: line 403: ~/.local/bin/herdr: Argument list too long
inject failed at initial send or Enter delivery (verdict=send-failed, bytes=50058; text may be in composer on backends that typed before Enter failed): command too long
Evidence: tmux swallowed-Enter: Enter-confirmation stage, kept full text, wedge alarm
⚠️bin/fm-supervise-daemon.sh:1419 - inject_msg treats every send-failed verdict as an initial-send failure, logging initial send (verdict=send-failed…) with no 'text may be in composer' note. herdr does not follow that rule. fm_backend_herdr_send_text_submit also returns send-failed after the literal text was typed but fm_backend_herdr_send_key Enter failed on every retry (bin/backends/herdr.sh:3381 and :3419, both with enter_sent=0). In that case the payload is sitting in the composer and Enter was retried retries times, yet the daemon log (and the wedge alarm/marker, which reuse INJECT_LAST_FAILURE) says only 'initial send'. .agents/skills/afk/SKILL.md:146 makes it worse by stating the initial-send stage 'types nothing and retries no Enter'. Concrete case: on the herdr backend with a non-Claude supervisor, pane send-text succeeds and pane send-keys Enter fails 3 times because the herdr CLI errors. The log then reports an initial send failure while the composer holds the digest, which is the stage confusion the intent asks to remove. herdr.sh:3358 (payload not shown after typing, composer cleared) matches the wording well enough. Fix: make the send-failed wording not claim nothing was typed, e.g. 'initial send or Enter delivery (verdict=send-failed…; text may be in composer on backends that typed before Enter failed)', and correct the SKILL.md sentence. The alternative is having herdr emit a distinct verdict for the Enter-never-sent path.
⚠️bin/backends/zellij.sh:439 - The intent requires the delivery-failure log to include the transport's stderr. The change only replays stderr for tmux (fm-tmux-lib.sh submit core) and herdr (herdr.sh send_literal). The zellij and cmux literal sends still run >/dev/null 2>&1 (bin/backends/zellij.sh:439, bin/backends/cmux.sh:477). The daemon comment itself notes these adapters pass text as one argument, and inject_msg is backend-aware (FM_SUPERVISOR_BACKEND). So an initial-send failure on a zellij or cmux supervisor is logged as initial send (…): no transport error output even when the CLI printed a cause such as E2BIG or a session error. Apply the same err=$(… 2>&1 >/dev/null) || rc=$?; replay on failure pattern to both literal sends.
⚠️bin/fm-supervise-daemon.sh:745 - Simplification: the change adds a retention policy (ESCALATE_FULL_KEEP_DAYS=7 plus a find … -mtime +7 -exec rm prune on every bounded flush, lines 745 and 778). The intent asks only to 'keep the full text durable so the supervisor can still read everything'. It does not ask for automatic deletion, and a time-based prune weakens that durability: a digest file named in an injected message is removed after 7 days whether or not anyone has read it. No stated requirement needs this. Remove the pruning, or confirm with the author that bounded retention is wanted.
🔧 Fix applied.
4 warnings still open:
⚠️bin/fm-supervise-daemon.sh:1419 - inject_msg treats every send-failed verdict as an initial-send failure, logging initial send (verdict=send-failed…) with no 'text may be in composer' note. herdr does not follow that rule. fm_backend_herdr_send_text_submit also returns send-failed after the literal text was typed but fm_backend_herdr_send_key Enter failed on every retry (bin/backends/herdr.sh:3381 and :3419, both with enter_sent=0). In that case the payload is sitting in the composer and Enter was retried retries times, yet the daemon log (and the wedge alarm/marker, which reuse INJECT_LAST_FAILURE) says only 'initial send'. .agents/skills/afk/SKILL.md:146 makes it worse by stating the initial-send stage 'types nothing and retries no Enter'. Concrete case: on the herdr backend with a non-Claude supervisor, pane send-text succeeds and pane send-keys Enter fails 3 times because the herdr CLI errors. The log then reports an initial send failure while the composer holds the digest, which is the stage confusion the intent asks to remove. herdr.sh:3358 (payload not shown after typing, composer cleared) matches the wording well enough. Fix: make the send-failed wording not claim nothing was typed, e.g. 'initial send or Enter delivery (verdict=send-failed…; text may be in composer on backends that typed before Enter failed)', and correct the SKILL.md sentence. The alternative is having herdr emit a distinct verdict for the Enter-never-sent path.
⚠️bin/backends/zellij.sh:439 - The intent requires the delivery-failure log to include the transport's stderr. The change only replays stderr for tmux (fm-tmux-lib.sh submit core) and herdr (herdr.sh send_literal). The zellij and cmux literal sends still run >/dev/null 2>&1 (bin/backends/zellij.sh:439, bin/backends/cmux.sh:477). The daemon comment itself notes these adapters pass text as one argument, and inject_msg is backend-aware (FM_SUPERVISOR_BACKEND). So an initial-send failure on a zellij or cmux supervisor is logged as initial send (…): no transport error output even when the CLI printed a cause such as E2BIG or a session error. Apply the same err=$(… 2>&1 >/dev/null) || rc=$?; replay on failure pattern to both literal sends.
⚠️bin/fm-supervise-daemon.sh:745 - Simplification: the change adds a retention policy (ESCALATE_FULL_KEEP_DAYS=7 plus a find … -mtime +7 -exec rm prune on every bounded flush, lines 745 and 778). The intent asks only to 'keep the full text durable so the supervisor can still read everything'. It does not ask for automatic deletion, and a time-based prune weakens that durability: a digest file named in an injected message is removed after 7 days whether or not anyone has read it. No stated requirement needs this. Remove the pruning, or confirm with the author that bounded retention is wanted.
⚠️bin/fm-supervise-daemon.sh:814 - escalate_flush deletes the bounded digest's full-text file ([ -z "$full" ] || rm -f "$full") whenever inject_msg returns non-zero. That includes failures after the digest text was already typed into the supervisor composer. Concrete sequence: the digest is bounded and inject_msg types it, then the submit returns unknown (pane unreadable after Enter, so the turn may actually have started) or pending (Enter swallowed, text still in the composer, which the returning human or harness later submits). herdr's send-failed after typing (herdr.sh:3381/3419) is a third case. In each case the file is removed, so the delivered or later-submitted digest names a path that no longer exists. That breaks the 'keep the full text durable so the supervisor can still read everything' requirement for that copy, and SKILL.md:161 tells the supervisor to read that file before acting on a cut event. The buffer survives and the next flush makes a new file, but the copy the supervisor sees points at nothing. Fix: remove the file only when inject_msg failed before calling the submit primitive (afk-inactive, encode failure, target missing, busy or composer deferral). For example, have inject_msg set a flag such as INJECT_SUBMIT_ATTEMPTED=1 just before fm_backend_send_text_submit, and keep the file when it is set. Retries that are merely deferred then still leave no files behind.
🔧 Fix applied.
1 warning still open:
⚠️bin/backends/zellij.sh:439 - The intent requires the delivery-failure log to include the transport's stderr. The change only replays stderr for tmux (fm-tmux-lib.sh submit core) and herdr (herdr.sh send_literal). The zellij and cmux literal sends still run >/dev/null 2>&1 (bin/backends/zellij.sh:439, bin/backends/cmux.sh:477). The daemon comment itself notes these adapters pass text as one argument, and inject_msg is backend-aware (FM_SUPERVISOR_BACKEND). So an initial-send failure on a zellij or cmux supervisor is logged as initial send (…): no transport error output even when the CLI printed a cause such as E2BIG or a session error. Apply the same err=$(… 2>&1 >/dev/null) || rc=$?; replay on failure pattern to both literal sends.
✅ **Test** - passed
✅ No issues found.
Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario
Result
Live
Evidence
tmux: 236 KB start-up catch-all span is delivered as one bounded digest, and the full text is kept durable
✅ pass
live
tmux-after/ (submitted.log is one 6,446-byte valid-UTF-8 line with [+N bytes] cut markers and a .subsuper-digests path; subsuper-digests/digest-* is a verbatim copy of the 240,347-byte buffer, includi…
tmux baseline at the base commit reproduces #4382: nothing is typed and the send-failed loop repeats with a misleading 'text may be in composer'
✅ pass
live
tmux-before/daemon.log (repeated 'inject failed: submit unconfirmed after 5 retries (verdict=send-failed, text may be in composer)'; submitted.log is 0 bytes; buffer stuck at 240,347 bytes; wedge alar…
herdr lab: 236 KB start-up catch-all span is delivered as one bounded digest, and the full text is kept durable
✅ pass
live
herdr-after/ (the fm-lab-afkdigest-* session was provisioned and torn down through bin/fm-herdr-lab.sh with teardown rc=0; submitted.log is one 6,447-byte line; the full-text file is verbatim; buffer…
herdr lab baseline at the base commit reproduces #4382 (E2BIG send-failed loop, nothing delivered)
✅ pass
live
herdr-before/daemon.log (5x 'submit unconfirmed after 6 retries (verdict=send-failed, text may be in composer)'; 0 bytes submitted; buffer 240,347 bytes; wedge alarm)
herdr: an oversized initial send is logged as an initial-send-stage failure with the real E2BIG stderr and the byte count, and nothing is typed
✅ pass
live
herdr-after/direct-inject.log: 'inject failed at initial send or Enter delivery (verdict=send-failed, bytes=200058; ...): .../herdr: Argument list too long'; direct-submitted.log is 0 bytes; the compo…
tmux: a transport refusal is logged with real tmux stderr 'command too long' and the byte count, and nothing is typed
✅ pass
live
tmux-direct-50k/direct-inject.log: 'inject failed at initial send or Enter delivery (verdict=send-failed, bytes=50058; ...): command too long'; the pane composer is still empty
Adversarial, tmux with every Enter swallowed: the failure is logged as Enter-confirmation stage, the full-text file named in the typed text survives retries, retries write no extra files, and the wedg…
✅ pass
live
tmux-stages/daemon.log ('inject failed at Enter confirmation: submit unconfirmed after 3 retries (verdict=pending, bytes=4379, ...)', then about 20 composer-guard deferrals and ERROR lines naming 'las…
bash live-tmux-oversized-digest.sh <worktree> tmux-after 75: real daemon plus watcher on a private tmux socket, with a 236 KB start-up catch-all span
bash live-tmux-oversized-digest.sh <git archive d1ce6b6> tmux-before 75: same scenario at the base commit
bash live-herdr-oversized-digest.sh bin/fm-herdr-lab.sh <worktree> herdr-after 80: fm-lab-* herdr session (provision, then teardown), 200 KB inject_msg, then the real daemon with a 236 KB span
bash live-herdr-oversized-digest.sh bin/fm-herdr-lab.sh <git archive d1ce6b6> herdr-before 80: herdr baseline at the base commit
bash live-tmux-failure-stages.sh <worktree> tmux-stages 60: 200 KB inject_msg (exec E2BIG via the shim), then the daemon with every Enter swallowed
bash live-tmux-direct-50k.sh <worktree> tmux-direct-50k: 50 KB inject_msg refused by real tmux ('command too long')
Checked each delivered digest with Python strict UTF-8 decode and confirmed the named full-text file is a verbatim copy of the buffer (2,100 done lines plus the needs-decision)
Intent
Fix #4382 upstream, as its maintainer triage asks (contract-class restore).
The away-mode daemon never delivers its batched escalation digest once the digest is larger than one command-line argument can carry.
On tmux,
tmux send-keys -lrejects the text (command too long).On herdr,
herdr pane send-text <pane> <TEXT>takes the text as one positional argument, so above Linux'sMAX_ARG_STRLEN(131,072 bytes including the terminating NUL, so at most 131,071 bytes of text)execvefails withE2BIG(Argument list too long, exit 126) before herdr runs; herdr 0.9.1 has no stdin or buffer form ofpane send-text, so a tmux-only transport fix leaves herdr broken.Both adapters discard the stderr, the submit core returns
send-failedwithout ever reaching the Enter loop, the daemon keeps the identical and ever-growing batch and retries it every housekeeping pass, and every attempt is logged assubmit unconfirmed after 3 retries (verdict=send-failed, text may be in composer), although no retry happened, nothing was typed, and the composer was empty.The realistic trigger is the daemon's start-up catch-all scan, which turns each status log's whole unread span into one unbounded buffered item: with three second mates and three to five days between away sessions, the first digest was 147,961 and 195,523 bytes, and delivery failed 2,946 times in a row over 11 hours.
The fix the triage asks for: bound the injected digest in
escalate_flushso delivery works on every backend, keep the full text durable so the supervisor can still read everything, and make the failure legible by distinguishing an initial-send failure from an Enter-confirmation failure in the daemon log, with the transport's stderr and the byte count; an explicit size check in the submit seam is optional defense in depth.Do not fix it by raising the retry count or by bypassing the composer or busy guards.
What Changed
escalate_flushinbin/fm-supervise-daemon.shnow caps the injected digest at 8 KiB. Each item is cut at a UTF-8 boundary to 2 KiB with a[+N bytes]marker, and items past the budget collapse into a+K more event(s)tail. With this cap the digest fits a singletmux send-keys -lcall or a single herdr/exec argument, which could not hold it before. Any digest that gets cut or loses events names a file understate/.subsuper-digests/that holds every buffered event verbatim. The daemon keeps that file once a submit was attempted, reuses it when it retries the same buffer, and deletes it if the send was never attempted.send_literaladapter replay the transport's stderr instead of discarding it.inject_msgrecords the payload byte count and that error text and logssend-failedas an initial-send/Enter-delivery failure. It no longer uses the misleading "submit unconfirmed after N retries" line, which now appears only for real Enter-confirmation failures. The last failure reason, including busy or composer deferrals, is stored inINJECT_LAST_FAILURE. The wedge alarm ERROR and the.subsuper-inject-wedgedmarker both report it./afkskill doc now covers the bounded digest, its full-text file, and the staged failure logging. Tests were added: a transport byte ceiling in the fake tmux (FM_FAKE_SEND_MAX_BYTES) and cases intests/fm-daemon.test.shandtests/fm-backend-herdr.test.sh.🤖 Generated with Claude Code
Risk Assessment
Testing
I ran the real away daemon against a private tmux server and against a throwaway fm-lab herdr session (guarded provision and teardown; the default session was untouched), at both the base and target commits. The trigger was a 236 KB start-up catch-all span. At the base commit, both backends reproduce #4382: an endless send-failed loop, nothing typed, and a misleading log line. At the target commit, both deliver a single bounded digest of about 6.4 KB whose named full-text file keeps every event verbatim. I also drove the failure paths directly. An initial-send failure is logged by stage with its byte count and the real stderr ('command too long' from tmux, 'Argument list too long' from herdr). A swallowed Enter is logged as an Enter-confirmation failure, the full-text file named in the typed text survives retries without duplicate files, and the wedge alarm names the last delivery failure. All scenarios passed. No UI surface is involved, so the evidence is logs, pane captures, and persisted state.
Evidence: Before/after summary table
Source: Before/after summary table
Evidence: tmux after: delivered bounded digest
Source: tmux after: delivered bounded digest
Evidence: tmux before: send-failed loop
Source: tmux before: send-failed loop
Evidence: herdr after: delivered bounded digest
Source: herdr after: delivered bounded digest
Evidence: herdr before: send-failed loop
Source: herdr before: send-failed loop
Evidence: herdr initial-send failure log (real E2BIG)
Evidence: tmux initial-send failure log (real tmux stderr)
Evidence: tmux swallowed-Enter: Enter-confirmation stage, kept full text, wedge alarm
Source: tmux swallowed-Enter: Enter-confirmation stage, kept full text, wedge alarm
~/.no-mistakes/evidence/01M3A59VEZ8CECAF4RPSHJXEMT/tmux-after/subsuper-digests)Evidence: Live driver scripts
Source: Live driver scripts
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-supervise-daemon.sh:1419- inject_msg treats everysend-failedverdict as an initial-send failure, logginginitial send (verdict=send-failed…)with no 'text may be in composer' note. herdr does not follow that rule.fm_backend_herdr_send_text_submitalso returnssend-failedafter the literal text was typed butfm_backend_herdr_send_key Enterfailed on every retry (bin/backends/herdr.sh:3381 and :3419, both with enter_sent=0). In that case the payload is sitting in the composer and Enter was retriedretriestimes, yet the daemon log (and the wedge alarm/marker, which reuse INJECT_LAST_FAILURE) says only 'initial send'. .agents/skills/afk/SKILL.md:146 makes it worse by stating the initial-send stage 'types nothing and retries no Enter'. Concrete case: on the herdr backend with a non-Claude supervisor,pane send-textsucceeds andpane send-keys Enterfails 3 times because the herdr CLI errors. The log then reports an initial send failure while the composer holds the digest, which is the stage confusion the intent asks to remove. herdr.sh:3358 (payload not shown after typing, composer cleared) matches the wording well enough. Fix: make the send-failed wording not claim nothing was typed, e.g. 'initial send or Enter delivery (verdict=send-failed…; text may be in composer on backends that typed before Enter failed)', and correct the SKILL.md sentence. The alternative is having herdr emit a distinct verdict for the Enter-never-sent path.bin/backends/zellij.sh:439- The intent requires the delivery-failure log to include the transport's stderr. The change only replays stderr for tmux (fm-tmux-lib.sh submit core) and herdr (herdr.sh send_literal). The zellij and cmux literal sends still run>/dev/null 2>&1(bin/backends/zellij.sh:439, bin/backends/cmux.sh:477). The daemon comment itself notes these adapters pass text as one argument, and inject_msg is backend-aware (FM_SUPERVISOR_BACKEND). So an initial-send failure on a zellij or cmux supervisor is logged asinitial send (…): no transport error outputeven when the CLI printed a cause such as E2BIG or a session error. Apply the sameerr=$(… 2>&1 >/dev/null) || rc=$?; replay on failurepattern to both literal sends.bin/fm-supervise-daemon.sh:745- Simplification: the change adds a retention policy (ESCALATE_FULL_KEEP_DAYS=7 plus afind … -mtime +7 -exec rmprune on every bounded flush, lines 745 and 778). The intent asks only to 'keep the full text durable so the supervisor can still read everything'. It does not ask for automatic deletion, and a time-based prune weakens that durability: a digest file named in an injected message is removed after 7 days whether or not anyone has read it. No stated requirement needs this. Remove the pruning, or confirm with the author that bounded retention is wanted.🔧 Fix applied.
4 warnings still open:
bin/fm-supervise-daemon.sh:1419- inject_msg treats everysend-failedverdict as an initial-send failure, logginginitial send (verdict=send-failed…)with no 'text may be in composer' note. herdr does not follow that rule.fm_backend_herdr_send_text_submitalso returnssend-failedafter the literal text was typed butfm_backend_herdr_send_key Enterfailed on every retry (bin/backends/herdr.sh:3381 and :3419, both with enter_sent=0). In that case the payload is sitting in the composer and Enter was retriedretriestimes, yet the daemon log (and the wedge alarm/marker, which reuse INJECT_LAST_FAILURE) says only 'initial send'. .agents/skills/afk/SKILL.md:146 makes it worse by stating the initial-send stage 'types nothing and retries no Enter'. Concrete case: on the herdr backend with a non-Claude supervisor,pane send-textsucceeds andpane send-keys Enterfails 3 times because the herdr CLI errors. The log then reports an initial send failure while the composer holds the digest, which is the stage confusion the intent asks to remove. herdr.sh:3358 (payload not shown after typing, composer cleared) matches the wording well enough. Fix: make the send-failed wording not claim nothing was typed, e.g. 'initial send or Enter delivery (verdict=send-failed…; text may be in composer on backends that typed before Enter failed)', and correct the SKILL.md sentence. The alternative is having herdr emit a distinct verdict for the Enter-never-sent path.bin/backends/zellij.sh:439- The intent requires the delivery-failure log to include the transport's stderr. The change only replays stderr for tmux (fm-tmux-lib.sh submit core) and herdr (herdr.sh send_literal). The zellij and cmux literal sends still run>/dev/null 2>&1(bin/backends/zellij.sh:439, bin/backends/cmux.sh:477). The daemon comment itself notes these adapters pass text as one argument, and inject_msg is backend-aware (FM_SUPERVISOR_BACKEND). So an initial-send failure on a zellij or cmux supervisor is logged asinitial send (…): no transport error outputeven when the CLI printed a cause such as E2BIG or a session error. Apply the sameerr=$(… 2>&1 >/dev/null) || rc=$?; replay on failurepattern to both literal sends.bin/fm-supervise-daemon.sh:745- Simplification: the change adds a retention policy (ESCALATE_FULL_KEEP_DAYS=7 plus afind … -mtime +7 -exec rmprune on every bounded flush, lines 745 and 778). The intent asks only to 'keep the full text durable so the supervisor can still read everything'. It does not ask for automatic deletion, and a time-based prune weakens that durability: a digest file named in an injected message is removed after 7 days whether or not anyone has read it. No stated requirement needs this. Remove the pruning, or confirm with the author that bounded retention is wanted.bin/fm-supervise-daemon.sh:814- escalate_flush deletes the bounded digest's full-text file ([ -z "$full" ] || rm -f "$full") whenever inject_msg returns non-zero. That includes failures after the digest text was already typed into the supervisor composer. Concrete sequence: the digest is bounded and inject_msg types it, then the submit returnsunknown(pane unreadable after Enter, so the turn may actually have started) orpending(Enter swallowed, text still in the composer, which the returning human or harness later submits). herdr's send-failed after typing (herdr.sh:3381/3419) is a third case. In each case the file is removed, so the delivered or later-submitted digest names a path that no longer exists. That breaks the 'keep the full text durable so the supervisor can still read everything' requirement for that copy, and SKILL.md:161 tells the supervisor to read that file before acting on a cut event. The buffer survives and the next flush makes a new file, but the copy the supervisor sees points at nothing. Fix: remove the file only when inject_msg failed before calling the submit primitive (afk-inactive, encode failure, target missing, busy or composer deferral). For example, have inject_msg set a flag such as INJECT_SUBMIT_ATTEMPTED=1 just before fm_backend_send_text_submit, and keep the file when it is set. Retries that are merely deferred then still leave no files behind.🔧 Fix applied.
1 warning still open:
bin/backends/zellij.sh:439- The intent requires the delivery-failure log to include the transport's stderr. The change only replays stderr for tmux (fm-tmux-lib.sh submit core) and herdr (herdr.sh send_literal). The zellij and cmux literal sends still run>/dev/null 2>&1(bin/backends/zellij.sh:439, bin/backends/cmux.sh:477). The daemon comment itself notes these adapters pass text as one argument, and inject_msg is backend-aware (FM_SUPERVISOR_BACKEND). So an initial-send failure on a zellij or cmux supervisor is logged asinitial send (…): no transport error outputeven when the CLI printed a cause such as E2BIG or a session error. Apply the sameerr=$(… 2>&1 >/dev/null) || rc=$?; replay on failurepattern to both literal sends.✅ **Test** - passed
✅ No issues found.
bash live-tmux-oversized-digest.sh <worktree> tmux-after 75: real daemon plus watcher on a private tmux socket, with a 236 KB start-up catch-all spanbash live-tmux-oversized-digest.sh <git archive d1ce6b6> tmux-before 75: same scenario at the base commitbash live-herdr-oversized-digest.sh bin/fm-herdr-lab.sh <worktree> herdr-after 80: fm-lab-* herdr session (provision, then teardown), 200 KB inject_msg, then the real daemon with a 236 KB spanbash live-herdr-oversized-digest.sh bin/fm-herdr-lab.sh <git archive d1ce6b6> herdr-before 80: herdr baseline at the base commitbash live-tmux-failure-stages.sh <worktree> tmux-stages 60: 200 KB inject_msg (exec E2BIG via the shim), then the daemon with every Enter swallowedbash live-tmux-direct-50k.sh <worktree> tmux-direct-50k: 50 KB inject_msg refused by real tmux ('command too long')Checked each delivered digest with Python strict UTF-8 decode and confirmed the named full-text file is a verbatim copy of the buffer (2,100 done lines plus the needs-decision)✅ **Document** - passed
✅ No issues found.
🔧 Fix applied.
1 warning still open:
✅ **Push** - passed
✅ No issues found.