Skip to content

fix(bin): bound the away digest and log why a delivery failed - #5554

Merged
kunchenguid merged 5 commits into
kunchenguid:mainfrom
Sophylax:fm/fm-afk-digest-upstream-pr
Sep 25, 2026
Merged

kunchenguid merged 5 commits into
kunchenguid:mainfrom
Sophylax:fm/fm-afk-digest-upstream-pr

Conversation

@Sophylax

@Sophylax Sophylax commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

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 -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.

🤖 Generated with Claude Code

Risk Assessment

⚠️ 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…
Evidence: Before/after summary table

Source: Before/after summary table

# 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/`) |
Evidence: tmux after: delivered bounded digest

Source: tmux after: delivered bounded digest

⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (3 event(s)): secondmate-alpha.status: done: secondmate-alpha shipped fix 1 for the café ledger, PR https://github.com/example/repo/pull/1 merged ; done: secondmate-alpha shipped fix 2 for the café ledger, PR https://github.com/example/repo/pull/2 merged ; done: secondmate-alpha shipped fix 3 for the café ledger, PR https://github.com/example/repo/pull/3 merged ; done: secondmate-alpha shipped fix 4 for the café ledger, PR https://github.com/example/repo/pull/4 merged ; done: secondmate-alpha shipped fix 5 for the café ledger, PR https://github.com/example/repo/pull/5 merged ; done: secondmate-alpha shipped fix 6 for the café ledger, PR https://github.com/example/repo/pull/6 merged ; done: secondmate-alpha shipped fix 7 for the café ledger, PR https://github.com/example/repo/pull/7 merged ; done: secondmate-alpha shipped fix 8 for the café ledger, PR https://github.com/example/repo/pull/8 merged ; done: secondmate-alpha shipped fix 9 for the café ledger, PR https://github.com/example/repo/pull/9 merged ; done: secondmate-alpha shipped fix 10 for the café ledger, PR https://github.com/example/repo/pull/10 merged ; done: secondmate-alpha shipped fix 11 for the café ledger, PR https://github.com/example/repo/pull/11 merged ; done: secondmate-alpha shipped fix 12 for the café ledger, PR https://github.com/example/repo/pull/12 merged ; done: secondmate-alpha shipped fix 13 for the café ledger, PR https://github.com/example/repo/pull/13 merged ; done: secondmate-alpha shipped fix 14 for the café ledger, PR https://github.com/example/repo/pull/14 merged ; done: secondmate-alpha shipped fix 15 for the café ledger, PR https://github.com/example/repo/pull/15 merged ; done: secondmate-alpha shipped fix 16 for the café ledger, PR https://github.com/example/repo/pull/16 merged ; done: secondmate-alpha shipped fix 17 for the café ledger, PR https://github.com/example/repo/pull/17 merged ; done: secondmate-alpha shipped fix 18 for the café ledger, PR https://github.com/example/repo/pull/18 merged ; done: secondmate-alpha sh [+77575 bytes] | secondmate-bravo.status: done: secondmate-bravo shipped fix 1 for the café ledger, PR https://github.com/example/repo/pull/1 merged ; done: secondmate-bravo shipped fix 2 for the café ledger, PR https://github.com/example/repo/pull/2 merged ; done: secondmate-bravo shipped fix 3 for the café ledger, PR https://github.com/example/repo/pull/3 merged ; done: secondmate-bravo shipped fix 4 for the café ledger, PR https://github.com/example/repo/pull/4 merged ; done: secondmate-bravo shipped fix 5 for the café ledger, PR https://github.com/example/repo/pull/5 merged ; done: secondmate-bravo shipped fix 6 for the café ledger, PR https://github.com/example/repo/pull/6 merged ; done: secondmate-bravo shipped fix 7 for the café ledger, PR https://github.com/example/repo/pull/7 merged ; done: secondmate-bravo shipped fix 8 for the café ledger, PR https://github.com/example/repo/pull/8 merged ; done: secondmate-bravo shipped fix 9 for the café ledger, PR https://github.com/example/repo/pull/9 merged ; done: secondmate-bravo shipped fix 10 for the café ledger, PR https://github.com/example/repo/pull/10 merged ; done: secondmate-bravo shipped fix 11 for the café ledger, PR https://github.com/example/repo/pull/11 merged ; done: secondmate-bravo shipped fix 12 for the café ledger, PR https://github.com/example/repo/pull/12 merged ; done: secondmate-bravo shipped fix 13 for the café ledger, PR https://github.com/example/repo/pull/13 merged ; done: secondmate-bravo shipped fix 14 for the café ledger, PR https://github.com/example/repo/pull/14 merged ; done: secondmate-bravo shipped fix 15 for the café ledger, PR https://github.com/example/repo/pull/15 merged ; done: secondmate-bravo shipped fix 16 for the café ledger, PR https://github.com/example/repo/pull/16 merged ; done: secondmate-bravo shipped fix 17 for the café ledger, PR https://github.com/example/repo/pull/17 merged ; done: secondmate-bravo shipped fix 18 for the café ledger, PR https://github.com/example/repo/pull/18 merged ; done: secondmate-bravo sh [+77575 bytes] | secondmate-charlie.status: done: secondmate-charlie shipped fix 1 for the café ledger, PR https://github.com/example/repo/pull/1 merged ; done: secondmate-charlie shipped fix 2 for the café ledger, PR https://github.com/example/repo/pull/2 merged ; done: secondmate-charlie shipped fix 3 for the café ledger, PR https://github.com/example/repo/pull/3 merged ; done: secondmate-charlie shipped fix 4 for the café ledger, PR https://github.com/example/repo/pull/4 merged ; done: secondmate-charlie shipped fix 5 for the café ledger, PR https://github.com/example/repo/pull/5 merged ; done: secondmate-charlie shipped fix 6 for the café ledger, PR https://github.com/example/repo/pull/6 merged ; done: secondmate-charlie shipped fix 7 for the café ledger, PR https://github.com/example/repo/pull/7 merged ; done: secondmate-charlie shipped fix 8 for the café ledger, PR https://github.com/example/repo/pull/8 merged ; done: secondmate-charlie shipped fix 9 for the café ledger, PR https://github.com/example/repo/pull/9 merged ; done: secondmate-charlie shipped fix 10 for the café ledger, PR https://github.com/example/repo/pull/10 merged ; done: secondmate-charlie shipped fix 11 for the café ledger, PR https://github.com/example/repo/pull/11 merged ; done: secondmate-charlie shipped fix 12 for the café ledger, PR https://github.com/example/repo/pull/12 merged ; done: secondmate-charlie shipped fix 13 for the café ledger, PR https://github.com/example/repo/pull/13 merged ; done: secondmate-charlie shipped fix 14 for the café ledger, PR https://github.com/example/repo/pull/14 merged ; done: secondmate-charlie shipped fix 15 for the café ledger, PR https://github.com/example/repo/pull/15 merged ; done: secondmate-charlie shipped fix 16 for the café ledger, PR https://github.com/example/repo/pull/16 merged ; done: secondmate-charlie shipped fix 17 for the café ledger, PR https://github.com/example/repo/pull/17 merged ; done: secondmate-charlie shipped fix 18 for the café ledger, PR https://github.com/example/repo/pull [+79050 bytes] (digest bounded; full text of every event: /tmp/fm-afk-digest-live.S9hQ4M/.subsuper-digests/digest-20260924T201250.6XQ1Km) (pre-read; re-arm not needed — watcher daemon-managed)
Evidence: tmux before: send-failed loop

Source: tmux before: send-failed loop

[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
Evidence: herdr after: delivered bounded digest

Source: herdr after: delivered bounded digest

⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (3 event(s)): secondmate-alpha.status: done: secondmate-alpha shipped fix 1 for the café ledger, PR https://github.com/example/repo/pull/1 merged ; done: secondmate-alpha shipped fix 2 for the café ledger, PR https://github.com/example/repo/pull/2 merged ; done: secondmate-alpha shipped fix 3 for the café ledger, PR https://github.com/example/repo/pull/3 merged ; done: secondmate-alpha shipped fix 4 for the café ledger, PR https://github.com/example/repo/pull/4 merged ; done: secondmate-alpha shipped fix 5 for the café ledger, PR https://github.com/example/repo/pull/5 merged ; done: secondmate-alpha shipped fix 6 for the café ledger, PR https://github.com/example/repo/pull/6 merged ; done: secondmate-alpha shipped fix 7 for the café ledger, PR https://github.com/example/repo/pull/7 merged ; done: secondmate-alpha shipped fix 8 for the café ledger, PR https://github.com/example/repo/pull/8 merged ; done: secondmate-alpha shipped fix 9 for the café ledger, PR https://github.com/example/repo/pull/9 merged ; done: secondmate-alpha shipped fix 10 for the café ledger, PR https://github.com/example/repo/pull/10 merged ; done: secondmate-alpha shipped fix 11 for the café ledger, PR https://github.com/example/repo/pull/11 merged ; done: secondmate-alpha shipped fix 12 for the café ledger, PR https://github.com/example/repo/pull/12 merged ; done: secondmate-alpha shipped fix 13 for the café ledger, PR https://github.com/example/repo/pull/13 merged ; done: secondmate-alpha shipped fix 14 for the café ledger, PR https://github.com/example/repo/pull/14 merged ; done: secondmate-alpha shipped fix 15 for the café ledger, PR https://github.com/example/repo/pull/15 merged ; done: secondmate-alpha shipped fix 16 for the café ledger, PR https://github.com/example/repo/pull/16 merged ; done: secondmate-alpha shipped fix 17 for the café ledger, PR https://github.com/example/repo/pull/17 merged ; done: secondmate-alpha shipped fix 18 for the café ledger, PR https://github.com/example/repo/pull/18 merged ; done: secondmate-alpha sh [+77575 bytes] | secondmate-bravo.status: done: secondmate-bravo shipped fix 1 for the café ledger, PR https://github.com/example/repo/pull/1 merged ; done: secondmate-bravo shipped fix 2 for the café ledger, PR https://github.com/example/repo/pull/2 merged ; done: secondmate-bravo shipped fix 3 for the café ledger, PR https://github.com/example/repo/pull/3 merged ; done: secondmate-bravo shipped fix 4 for the café ledger, PR https://github.com/example/repo/pull/4 merged ; done: secondmate-bravo shipped fix 5 for the café ledger, PR https://github.com/example/repo/pull/5 merged ; done: secondmate-bravo shipped fix 6 for the café ledger, PR https://github.com/example/repo/pull/6 merged ; done: secondmate-bravo shipped fix 7 for the café ledger, PR https://github.com/example/repo/pull/7 merged ; done: secondmate-bravo shipped fix 8 for the café ledger, PR https://github.com/example/repo/pull/8 merged ; done: secondmate-bravo shipped fix 9 for the café ledger, PR https://github.com/example/repo/pull/9 merged ; done: secondmate-bravo shipped fix 10 for the café ledger, PR https://github.com/example/repo/pull/10 merged ; done: secondmate-bravo shipped fix 11 for the café ledger, PR https://github.com/example/repo/pull/11 merged ; done: secondmate-bravo shipped fix 12 for the café ledger, PR https://github.com/example/repo/pull/12 merged ; done: secondmate-bravo shipped fix 13 for the café ledger, PR https://github.com/example/repo/pull/13 merged ; done: secondmate-bravo shipped fix 14 for the café ledger, PR https://github.com/example/repo/pull/14 merged ; done: secondmate-bravo shipped fix 15 for the café ledger, PR https://github.com/example/repo/pull/15 merged ; done: secondmate-bravo shipped fix 16 for the café ledger, PR https://github.com/example/repo/pull/16 merged ; done: secondmate-bravo shipped fix 17 for the café ledger, PR https://github.com/example/repo/pull/17 merged ; done: secondmate-bravo shipped fix 18 for the café ledger, PR https://github.com/example/repo/pull/18 merged ; done: secondmate-bravo sh [+77575 bytes] | secondmate-charlie.status: done: secondmate-charlie shipped fix 1 for the café ledger, PR https://github.com/example/repo/pull/1 merged ; done: secondmate-charlie shipped fix 2 for the café ledger, PR https://github.com/example/repo/pull/2 merged ; done: secondmate-charlie shipped fix 3 for the café ledger, PR https://github.com/example/repo/pull/3 merged ; done: secondmate-charlie shipped fix 4 for the café ledger, PR https://github.com/example/repo/pull/4 merged ; done: secondmate-charlie shipped fix 5 for the café ledger, PR https://github.com/example/repo/pull/5 merged ; done: secondmate-charlie shipped fix 6 for the café ledger, PR https://github.com/example/repo/pull/6 merged ; done: secondmate-charlie shipped fix 7 for the café ledger, PR https://github.com/example/repo/pull/7 merged ; done: secondmate-charlie shipped fix 8 for the café ledger, PR https://github.com/example/repo/pull/8 merged ; done: secondmate-charlie shipped fix 9 for the café ledger, PR https://github.com/example/repo/pull/9 merged ; done: secondmate-charlie shipped fix 10 for the café ledger, PR https://github.com/example/repo/pull/10 merged ; done: secondmate-charlie shipped fix 11 for the café ledger, PR https://github.com/example/repo/pull/11 merged ; done: secondmate-charlie shipped fix 12 for the café ledger, PR https://github.com/example/repo/pull/12 merged ; done: secondmate-charlie shipped fix 13 for the café ledger, PR https://github.com/example/repo/pull/13 merged ; done: secondmate-charlie shipped fix 14 for the café ledger, PR https://github.com/example/repo/pull/14 merged ; done: secondmate-charlie shipped fix 15 for the café ledger, PR https://github.com/example/repo/pull/15 merged ; done: secondmate-charlie shipped fix 16 for the café ledger, PR https://github.com/example/repo/pull/16 merged ; done: secondmate-charlie shipped fix 17 for the café ledger, PR https://github.com/example/repo/pull/17 merged ; done: secondmate-charlie shipped fix 18 for the café ledger, PR https://github.com/example/repo/pull [+79050 bytes] (digest bounded; full text of every event: /tmp/fm-afk-herdr-digest.eaEA33/.subsuper-digests/digest-20260924T201659.hhN31x) (pre-read; re-arm not needed — watcher daemon-managed)
Evidence: herdr before: send-failed loop

Source: herdr before: send-failed loop

[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
Evidence: herdr initial-send failure log (real E2BIG)
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
Evidence: tmux initial-send failure log (real tmux stderr)
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

Source: tmux swallowed-Enter: Enter-confirmation stage, kept full text, wedge alarm

[2026-09-24T20:19:54+0300] daemon starting (pid 3255806); 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:20:02+0300] inject failed at Enter confirmation: submit unconfirmed after 3 retries (verdict=pending, bytes=4379, text may be in composer)
[2026-09-24T20:20:04+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:04+0300] wake: signal: /tmp/fm-afk-stage-live.RIjXg5/secondmate-alpha.status /tmp/fm-afk-stage-live.RIjXg5/secondmate-bravo.status
[2026-09-24T20:20:11+0300] self-handle: signal: /tmp/fm-afk-stage-live.RIjXg5/secondmate-alpha.status /tmp/fm-afk-stage-live.RIjXg5/secondmate-bravo.status -> signal already escalated (catch-all scan): secondmate-alpha.status: done: secondmate-alpha shipped fix 150, PR https://github.com/example/repo/pull/150 merged | secondmate-bravo.status: done: secondmate-bravo shipped fix 150, PR https://github.com/example/repo/pull/150 merged
[2026-09-24T20:20:11+0300] self-handle: signal: /tmp/fm-afk-stage-live.RIjXg5/secondmate-alpha.status /tmp/fm-afk-stage-live.RIjXg5/secondmate-bravo.status -> signal already escalated (catch-all scan): secondmate-alpha.status: done: secondmate-alpha shipped fix 150, PR https://github.com/example/repo/pull/150 merged | secondmate-bravo.status: done: secondmate-bravo shipped fix 150, PR https://github.com/example/repo/pull/150 merged
[2026-09-24T20:20:14+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:15+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:15+0300] ERROR: away-mode escalation undelivered 18s; last delivery failure: deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane). Buffer + wake-queue preserved; alarm marker written.
[2026-09-24T20:20:17+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:20+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:22+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:25+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:27+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:29+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:32+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:32+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:32+0300] ERROR: away-mode escalation undelivered 36s; last delivery failure: deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane). Buffer + wake-queue preserved; alarm marker written.
[2026-09-24T20:20:35+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:37+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:39+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:41+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:44+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:46+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:48+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:49+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:49+0300] ERROR: away-mode escalation undelivered 52s; last delivery failure: deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane). Buffer + wake-queue preserved; alarm marker written.
[2026-09-24T20:20:51+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
[2026-09-24T20:20:54+0300] inject deferred: supervisor composer not confirmed-empty (state=pending: pending input, dead-shell prompt, or unreadable pane)
  • Evidence: Full-text digest file (tmux after) (local file: ~/.no-mistakes/evidence/01M3A59VEZ8CECAF4RPSHJXEMT/tmux-after/subsuper-digests)
Evidence: Live driver scripts

Source: Live driver scripts

#!/usr/bin/env bash
# Live driver for the herdr backend, inside a throwaway fm-lab-* session owned
# by bin/fm-herdr-lab.sh (prepare/provision ... teardown). The supervisor pane
# runs a drawn "❯ " composer that registers itself as a herdr agent via
# `pane report-agent` (idle/working around each submission, as
# tests/fm-afk-inject-herdr-e2e.test.sh does) and logs every submitted line.
#
# Phase 1 (direct): inject_msg with a 200,000-byte message through the real
#   herdr CLI, to capture the initial-send failure log line (real E2BIG).
# Phase 2 (daemon): the real daemon with three ~78 KB unread status spans, so
#   the start-up catch-all scan buffers ~236 KB (issue #4382 trigger).
#
# Usage: live-herdr-oversized-digest.sh <lab-helper> <firstmate-root> <out-dir> [run-secs]
set -u
LAB=$1 ROOT=$2 OUT=$3 RUN_SECS=${4:-80}
DAEMON="$ROOT/bin/fm-supervise-daemon.sh"
mkdir -p "$OUT"
unset HERDR_ENV HERDR_PANE_ID HERDR_TAB_ID HERDR_WORKSPACE_ID HERDR_SOCKET_PATH HERDR_SESSION
SESSION=$("$LAB" name afkdigest) || exit 1
printf '%s\n' "$SESSION" > "$OUT/lab-session.txt"
STATE=$(mktemp -d "${TMPDIR:-/tmp}/fm-afk-herdr-digest.XXXXXX")
SUBMITTED="$STATE/submitted.log"; : > "$SUBMITTED"
DPID=
cleanup() {
  [ -z "$DPID" ] || { rm -f "$STATE/.afk"; kill "$DPID" 2>/dev/null; wait "$DPID" 2>/dev/null; }
  "$LAB" teardown "$SESSION" > "$OUT/lab-teardown.txt" 2>&1; echo "teardown rc=$?" >> "$OUT/lab-teardown.txt"
  rm -rf "$STATE"
}
trap cleanup EXIT
"$LAB" provision "$SESSION" || exit 1
export HERDR_SESSION="$SESSION"

# shellcheck source=/dev/null
. "$DAEMON"
fm_backend_source herdr || exit 1
CONTAINER_RAW=$(fm_backend_herdr_container_ensure /tmp) || { echo "container_ensure failed" >&2; exit 1; }
CONTAINER=${CONTAINER_RAW%%$'\t'*}
SEEDED=${CONTAINER_RAW#*$'\t'}
IDS=$(fm_backend_herdr_create_task "$CONTAINER" fm-afk-digest-supervisor /tmp "$SEEDED") || exit 1
read -r _TAB PANE <<EOF
$IDS
EOF
TARGET="$SESSION:$PANE"
ready=0
for _ in $(seq 1 100); do
  if fm_backend_herdr_cli "$SESSION" pane process-info --pane "$PANE" 2>/dev/null | jq -e '
      .result.process_info as $p | ($p.foreground_processes | length == 1)
      and ($p.foreground_processes[0].pid == $p.shell_pid)' >/dev/null 2>&1; then
    ready=$((ready + 1)); [ "$ready" -ge 10 ] && break
  else ready=0; fi
  sleep 0.1
done

cat > "$STATE/loop.sh" <<'LOOP'
#!/usr/bin/env bash
LOG="$1"
rep() { herdr pane report-agent "$HERDR_PANE_ID" --source fm-test-supervisor --agent fm-test-supervisor --state "$1" --session "$HERDR_SESSION" >/dev/null 2>&1; }
stty -echo -icanon min 1 time 0 2>/dev/null
rep idle
_buf=
redraw() { local s=$_buf; [ "${#s}" -le 40 ] || s="...${s: -37}"; printf '\r\033[K❯ %s' "$s"; }
submit_line() { printf '%s\n' "$_buf" >> "$LOG"; _buf=; printf '\r\033[K\n'; redraw; rep working; sleep 0.6; rep idle; }
redraw
while IFS= read -r -n 1 _ch; do
  if [ -z "$_ch" ]; then submit_line; continue; fi
  case "$_ch" in $'\r'|$'\n') submit_line ;; *) _buf+=$_ch ;; esac
  read -t 0 || redraw
done
LOOP
fm_backend_herdr_send_text_line "$TARGET" "bash '$STATE/loop.sh' '$SUBMITTED'" || exit 1
sleep 2
{ printf 'composer state before tests: '; fm_backend_composer_state herdr "$TARGET"; echo; } > "$OUT/preflight.txt" 2>&1

# Phase 1: a message larger than one exec argument, through inject_msg.
afk_enter "$STATE"
big=$(head -c 200000 /dev/zero | tr '\0' 'x')
LOG="$OUT/direct-inject.log" FM_SUPERVISOR_BACKEND=herdr FM_SUPERVISOR_TARGET="$TARGET" \
  FM_INJECT_CONFIRM_SLEEP=0.5 FM_INJECT_CONFIRM_RETRIES=3 inject_msg "Supervisor escalate: $big" "$STATE"
echo "inject_msg rc=$?" >> "$OUT/direct-inject.log"
cp "$SUBMITTED" "$OUT/direct-submitted.log"
fm_backend_herdr_cli "$SESSION" pane read "$PANE" --source visible --lines 5 > "$OUT/direct-pane.txt" 2>&1
{ printf 'composer state after direct: '; fm_backend_composer_state herdr "$TARGET"; echo; } >> "$OUT/preflight.txt" 2>&1

# Phase 2: the real daemon with a huge start-up catch-all span.
for sm in alpha bravo charlie; do
  : > "$STATE/secondmate-$sm.status"
  for i in $(seq 1 700); do
    printf 'done: secondmate-%s shipped fix %d for the café ledger, PR https://github.com/example/repo/pull/%d merged\n' "$sm" "$i" "$i" >> "$STATE/secondmate-$sm.status"
  done
done
printf 'needs-decision [key=pick-db]: choose Postgres or SQLite for the ledger\n' >> "$STATE/secondmate-charlie.status"
wc -c "$STATE"/*.status > "$OUT/status-sizes.txt"
FM_STATE_OVERRIDE="$STATE" FM_SUPERVISOR_TARGET="$TARGET" FM_SUPERVISOR_BACKEND=herdr \
  FM_ESCALATE_BATCH_SECS=0 FM_HOUSEKEEPING_TICK=1 FM_POLL=1 FM_SIGNAL_GRACE=1 FM_HEARTBEAT=999999 \
  FM_HEARTBEAT_SCAN_SECS=1 FM_CHECK_INTERVAL=999999 FM_INJECT_CONFIRM_SLEEP=0.5 FM_INJECT_CONFIRM_RETRIES=6 \
  FM_STALE_ESCALATE_SECS=999999 FM_MAX_DEFER_SECS=10 FM_WEDGE_ALARM_CHANNEL=off \
  nohup "$DAEMON" > "$STATE/daemon.out" 2> "$STATE/daemon.err" &
DPID=$!
sleep "$RUN_SECS"

cp "$STATE/.supervise-daemon.log" "$OUT/daemon.log" 2>/dev/null
cp "$SUBMITTED" "$OUT/submitted.log"
fm_backend_herdr_cli "$SESSION" pane read "$PANE" --source visible --lines 8 > "$OUT/supervisor-pane.txt" 2>&1
{ printf 'buffer bytes: '; LC_ALL=C wc -c < "$STATE/.subsuper-escalations" 2>/dev/null || echo absent; } > "$OUT/buffer-state.txt"
if [ -d "$STATE/.subsuper-digests" ]; then
  mkdir -p "$OUT/subsuper-digests"; cp "$STATE/.subsuper-digests"/* "$OUT/subsuper-digests/" 2>/dev/null
  ls -l "$STATE/.subsuper-digests" >> "$OUT/buffer-state.txt"
fi
cp "$STATE/.subsuper-inject-wedged" "$OUT/wedge-marker.txt" 2>/dev/null

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 warning
  • ⚠️ 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 &gt;/dev/null 2&gt;&amp;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&gt;&amp;1 &gt;/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 &gt;/dev/null 2&gt;&amp;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&gt;&amp;1 &gt;/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 &#34;$full&#34; ] || rm -f &#34;$full&#34;) 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 &gt;/dev/null 2&gt;&amp;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&gt;&amp;1 &gt;/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 &lt;worktree&gt; 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 &lt;git archive d1ce6b6&gt; tmux-before 75: same scenario at the base commit
  • bash live-herdr-oversized-digest.sh bin/fm-herdr-lab.sh &lt;worktree&gt; 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 &lt;git archive d1ce6b6&gt; herdr-before 80: herdr baseline at the base commit
  • bash live-tmux-failure-stages.sh &lt;worktree&gt; 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 &lt;worktree&gt; 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.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 1)

🔧 Fix applied.
1 warning still open:

  • ⚠️ linter found issues (exit code 1)
✅ **Push** - passed

✅ No issues found.