Skip to content

fix(bin): let fm-control exit and interrupt recover Claude workers on Herdr - #10

Merged
max-metaplanet merged 2 commits into
mainfrom
fm/herdr-control-send
Sep 24, 2026
Merged

max-metaplanet merged 2 commits into
mainfrom
fm/herdr-control-send

Conversation

@max-metaplanet

Copy link
Copy Markdown
Owner

Intent

Restore firstmate's ability to recover a stuck worker on the Herdr backend.

Since this repository was synced onto current upstream (fork main b59c9fd), bin/fm-control.sh <task> exit fails on Herdr for every persistent second mate - reproduced twice each on three separate homes through bin/fm-secondmate-restart.sh - with "the exit command could not be sent to task on herdr". That message comes from the send step (fm_backend_send_text_submit around bin/fm-control.sh:645) AFTER the composer-empty check has already passed. The Herdr server is healthy (0.9.1, protocol 22, running, compatible, restart_needed false) and every pane resolves through herdr pane get with agent_status done. Before the sync, the same night, the same exit on the same home worked. bin/fm-send.sh still works, both its durable inbox and its doorbell. So the fault is most likely in the synced send path against Herdr 0.9.1, not in Herdr or the panes. Interrupt and relaunch through fm-control may be affected too, and those three actions are how a wedged worker gets recovered.

Known evidence trap: running fm-control under bash -x produces a DIFFERENT error, "endpoint reads unreadable", because the trace output leaks into the command substitutions that parse Herdr JSON. That is an artifact of tracing, not the cause; reproduce without tracing.

What Changed

  • Herdr payload proof reads the whole capture (bin/backends/herdr.sh): fm_backend_herdr_send_text_submit used to read only a short tail sized from the payload length. It now reads 200 rows, both for the empty-composer check before typing and for the proof after typing. A / payload such as /exit opens Claude's slash-command list below the composer, and with many skills that list filled the whole tail. The proof then failed and the send returned send-failed, which surfaced as "the exit command could not be sent". Extraction still picks the lowest composer shape. The comment on fm_backend_herdr_proof_lines now describes its remaining use: counting Ctrl+U presses for the composer clear.
  • Handling for Claude's vim-mode composer (bin/fm-control.sh, bin/fm-control-lib.sh, bin/fm-backend.sh):
    • New helpers: fm_control_interrupt_insert_signal / fm_control_interrupt_insert_key (Claude's signal is -- INSERT -- and its key is i), plus a backend-agnostic fm_backend_send_literal.
    • send_interrupt_keys checks whether the insert indicator was showing before the Escape presses. If it was, the indicator is gone afterwards, and the agent is still alive, it runs restore_insert_mode. That sends i raw, then requires the indicator back and the composer empty. Otherwise it clears the composer with Ctrl+U and refuses.
    • When the composer was out of text entry before /exit was typed and back in it after a send-failed, do_exit retypes the exit command once.
    • A Claude without vim mode renders no indicator, so nothing is typed into it.
  • Docs and tests: docs/agent-control.md and the Claude harness adapter reference cover the vim-mode interrupt and exit behaviour. New cases in tests/fm-backend-herdr.test.sh cover the slash-command payload proof, and new cases in tests/fm-control.test.sh cover the insert-mode restore and the exit retry.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change adds narrowly gated recovery steps: the insert key is typed only when an -- INSERT -- indicator was seen and then disappeared on a still-running agent, and exit is retried only once, after a Herdr refusal whose cause is shown by the mode change. A false read of the indicator only leads to a refusal, never to a wrong input being typed, and behavioral tests cover both the vim and non-vim paths.

Testing

I drove 7 scenarios live, each in its own fm-lab-* Herdr session created and torn down through bin/fm-herdr-lab.sh, with real Claude 2.1.281 on Herdr 0.9.1 and the operator's full skill and plugin set, so the completion list was tall. The default session was never touched. Exit (vim and non-vim), interrupt then exit, busy interrupt then exit, relaunch, and a plain-text submit all passed. The first busy-interrupt run failed because of a bug in my test driver, not the product: it sent the key name C-u, which Herdr rejects, so the test token stayed in the composer. fm-control correctly refused to type /exit onto that pending text. That log is kept as evidence of the guard working. I fixed the driver key to ctrl+u and the re-run passed. Round-1 logs from the same labs show the base and be24904 failing with 'the exit command could not be sent', which confirms a73b713 is what fixes it. The targeted backend test file, including the new tall-completion-list regression test, passed. The only artifacts are CLI transcripts because there is no UI change. The worktree is clean.

  • Live validation: ✅ go - 8 of 8 scenarios driven live against the product
Scenario Result Live Evidence
Root cause: after typing /exit, the Claude payload proof reads /exit from the composer even with the tall slash-command completion list open ✅ pass live r2-01-head-novim-probe-payload-proof.log: composer_content rc=0 [/exit], payload_shown=YES, and the visible screen tail is nothing but completion-list rows
Operator recovers a worker: fm-control exit on an idle vim-mode Claude on Herdr stops the agent ✅ pass live r2-02-head-vim-plain-exit.log: 'stopped mc1 harness=claude backend=herdr', rc=0, and the pane is back at a shell prompt
Adversarial: fm-control exit on an idle Claude without vim mode also works (the fix does not depend on vim) ✅ pass live r2-03-head-novim-plain-exit.log: exit rc=0, agent gone
fm-control interrupt then exit on a vim-mode Claude stops the agent ✅ pass live r2-04-head-vim-interrupt-exit.log: interrupt rc=0, exit rc=0
Interrupting a busy Claude leaves the composer accepting text, and a later exit succeeds ✅ pass live r2-05-head-vim-busy-interrupt.log: interrupt-delivered, 'composer shows MCTOKEN verbatim: TEXT ENTRY OK', exit rc=0
Adversarial: exit refuses to type /exit onto pending composer text ✅ pass live r2-05a-driver-bug-C-u-guard-refusal.log: 'composer visibly holds pending text; refusing to type the /exit exit command', and no concatenation happened
fm-control relaunch replaces a Claude worker on Herdr ✅ pass live r2-06-head-vim-relaunch.log: 'relaunched mc1 harness=claude ... backend=herdr', rc=0, new agent working
No regression: a plain-text send through the Claude proof path still submits and Claude answers ✅ pass live r2-07-head-novim-send-plain.log: verdict=empty, Claude replied PONGLAB
Evidence: Live proof: /exit read from the composer while the slash completion list is open

Source: Live proof: /exit read from the composer while the slash completion list is open

[04:05:21] lab=fm-lab-mc-probe-proof-10682-4779 pane=w1:p1 code=~/.no-mistakes/worktrees/61c6dd39b831/01M396EP9RP6ZBAJXX87NCC9ZK mode=novim flow=probe-proof herdr=herdr 0.9.1 claude=2.1.281 (Claude Code)
[04:05:30] claude ready; footer:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️19 | ⚡80% | P01=E04=U08=J17:05:28    auto mode unavailable for this model
  ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:05:30] send_literal '/exit' (unsubmitted), then read what the Claude payload proof reads
[04:05:32] composer_content rc=0: [/exit]
[04:05:32] payload_shown('/exit') = YES
[04:05:32] visible screen tail:
  /vercel:next-upgrade                           (vercel) Upgrade Next.js to the latest version following official
                                                 migration guides and codemods. Use when upgrading Next.js versions,…
  /pptx                                          Use this skill any time a .pptx or .potx file is involved in any way
                                                 — as input, output, or both. This includes: creating slide decks, p…
  /usage-credits                                 Configure usage credits or request them from your admin when you hit
                                                 a limit
  /docs                                          docs (living docs people share, comment on and edit; use only when
                                                 the user asks for one: names a doc, document, page, memo, spec, PRD…
  /doctor                                        Health-check the user's Claude Code setup and fix issues: diagnose
                                                 installation health — what the `claude doctor` terminal diagnostics…
  /skill-creator                                 Create new skills, modify and improve existing skills, and measure
                                                 skill performance. Use when users want to create a skill from scrat…
{"error":{"code":"invalid_key","message":"unsupported key C-u"},"id":"cli:request"}
{"error":{"code":"invalid_key","message":"unsupported key C-u"},"id":"cli:request"}
{"error":{"code":"invalid_key","message":"unsupported key C-u"},"id":"cli:request"}
[04:05:34] send_literal 'hello world' (unsubmitted), then read what the Claude payload proof reads
[04:05:36] composer_content rc=0: [/exithello world]
[04:05:36] payload_shown('hello world') = NO -> send_text_submit would refuse with send-failed
[04:05:36] visible screen tail:
> cd '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-mc-live.wVLon9/wt' && CLAUDE_CODE_ENABLE_PROMPT_SUGGE
STION=false CLAUDE_CODE_SEND_FEEDBACK=0 claude --dangerously-skip-permissions --model haiku --settings '{"feedbackDraft
s":"off","editorMode":"normal"}'
 ▐▛███▛█   Claude Code v2.1.281
▝▜██████▀  Haiku 4.5 · Claude Team
  ▝▝ ▝▝    /private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-mc-live.wVLon9/wt
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ /exithello world
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️20 | ⚡80% | P01=E04=U08=J17:05:34
  ⏵⏵ bypass permissions on (shift+tab to cycle)
{"error":{"code":"invalid_key","message":"unsupported key C-u"},"id":"cli:request"}
{"error":{"code":"invalid_key","message":"unsupported key C-u"},"id":"cli:request"}
{"error":{"code":"invalid_key","message":"unsupported key C-u"},"id":"cli:request"}
[04:05:37] FLOW RESULT: PASS
[04:05:37] teardown fm-lab-mc-probe-proof-10682-4779
Evidence: fm-control exit on vim-mode Claude: stopped

Source: fm-control exit on vim-mode Claude: stopped

[04:05:56] lab=fm-lab-mc-plain-exit-29645-27631 pane=w1:p1 code=~/.no-mistakes/worktrees/61c6dd39b831/01M396EP9RP6ZBAJXX87NCC9ZK mode=vim flow=plain-exit herdr=herdr 0.9.1 claude=2.1.281 (Claude Code)
[04:06:03] claude ready; footer:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️18 | ⚡80% | P01=E04=U08=J17:06:01    auto mode unavailable for this model
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:06:03] $ fm-control.sh mc1 exit
stopped mc1 harness=claude backend=herdr endpoint=fm-lab-mc-plain-exit-29645-27631:w1:p1 worktree=/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-mc-live.bkfhkj/wt
[04:06:10] exit rc=0
[04:06:11] agent status after exit: 
[04:06:11] footer after exit:
  /skill-creator                                 Create new skills, modify and improve existing skills, and measure
                                                 skill performance. Use when users want to create a skill from scrat…
wt  mc1 took 11s
>
[04:06:12] FLOW RESULT: PASS
[04:06:12] teardown fm-lab-mc-plain-exit-29645-27631
Evidence: fm-control exit on non-vim Claude: stopped

Source: fm-control exit on non-vim Claude: stopped

[04:06:15] lab=fm-lab-mc-plain-exit-38616-16810 pane=w1:p1 code=~/.no-mistakes/worktrees/61c6dd39b831/01M396EP9RP6ZBAJXX87NCC9ZK mode=novim flow=plain-exit herdr=herdr 0.9.1 claude=2.1.281 (Claude Code)
[04:06:24] claude ready; footer:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️21 | ⚡80% | P01=E04=U08=J17:06:21    auto mode unavailable for this model
  ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:06:24] $ fm-control.sh mc1 exit
stopped mc1 harness=claude backend=herdr endpoint=fm-lab-mc-plain-exit-38616-16810:w1:p1 worktree=/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-mc-live.0CuFEP/wt
[04:06:29] exit rc=0
[04:06:31] agent status after exit: 
[04:06:31] footer after exit:
  /skill-creator                                 Create new skills, modify and improve existing skills, and measure
                                                 skill performance. Use when users want to create a skill from scrat…
wt  mc1 took 12s
>
[04:06:31] FLOW RESULT: PASS
[04:06:31] teardown fm-lab-mc-plain-exit-38616-16810
Evidence: fm-control interrupt then exit: stopped

Source: fm-control interrupt then exit: stopped

[04:06:33] lab=fm-lab-mc-interrupt-exi-51697-30059 pane=w1:p1 code=~/.no-mistakes/worktrees/61c6dd39b831/01M396EP9RP6ZBAJXX87NCC9ZK mode=vim flow=interrupt-exit herdr=herdr 0.9.1 claude=2.1.281 (Claude Code)
[04:06:41] claude ready; footer:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️20 | ⚡80% | P01=E04=U08=J17:06:38    auto mode unavailable for this model
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:06:41] $ fm-control.sh mc1 interrupt
interrupt-delivered mc1 harness=claude backend=herdr verified=agent-alive cancel=unconfirmed
[04:06:44] interrupt rc=0
[04:06:45] footer after interrupt:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️23 | ⚡80% | P01=E04=U08=J17:06:44    auto mode unavailable for this model
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:06:45] $ fm-control.sh mc1 exit
stopped mc1 harness=claude backend=herdr endpoint=fm-lab-mc-interrupt-exi-51697-30059:w1:p1 worktree=/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-mc-live.DBZLOz/wt
[04:06:52] exit rc=0
[04:06:53] agent status after exit: 
[04:06:53] footer after exit:
  /skill-creator                                 Create new skills, modify and improve existing skills, and measure
                                                 skill performance. Use when users want to create a skill from scrat…
wt  mc1 took 17s
>
[04:06:53] FLOW RESULT: PASS
[04:06:53] teardown fm-lab-mc-interrupt-exi-51697-30059
Evidence: Busy interrupt, composer still accepts text, then exit

Source: Busy interrupt, composer still accepts text, then exit

[04:08:23] lab=fm-lab-mc-busy-interrup-5161-18575 pane=w1:p1 code=~/.no-mistakes/worktrees/61c6dd39b831/01M396EP9RP6ZBAJXX87NCC9ZK mode=vim flow=busy-interrupt herdr=herdr 0.9.1 claude=2.1.281 (Claude Code)
[04:08:32] claude ready; footer:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️20 | ⚡80% | P01=E04=U08=J17:08:29    auto mode unavailable for this model
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:08:32] submitting a long prompt so claude is mid-turn
[04:08:34] agent status before interrupt: working
[04:08:34] $ fm-control.sh mc1 interrupt
interrupt-delivered mc1 harness=claude backend=herdr verified=agent-alive cancel=unconfirmed
[04:08:38] interrupt rc=0
[04:08:40] footer after interrupt:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | 3.5¢ 12.7s | ⚙️48 | ⚡80% | P01=E04=U08=J17:08:38
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:08:40] typing 'MCTOKEN24226' raw to prove the composer takes text
[04:08:42] composer shows MCTOKEN24226 verbatim: TEXT ENTRY OK
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | 3.5¢ 12.7s | ⚙️48 | ⚡80% | P01=E04=U08=J17:08:38
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:08:43] $ fm-control.sh mc1 exit
stopped mc1 harness=claude backend=herdr endpoint=fm-lab-mc-busy-interrup-5161-18575:w1:p1 worktree=/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-mc-live.UyWlik/wt
[04:08:52] exit rc=0
[04:08:53] agent status after exit: 
[04:08:53] footer after exit:
  /skill-creator                                 Create new skills, modify and improve existing skills, and measure
                                                 skill performance. Use when users want to create a skill from scrat…
wt  mc1 took 25s
>
[04:08:53] FLOW RESULT: PASS
[04:08:53] teardown fm-lab-mc-busy-interrup-5161-18575
Evidence: Adversarial: pending composer text makes exit refuse rather than concatenate

Source: Adversarial: pending composer text makes exit refuse rather than concatenate

[04:06:55] lab=fm-lab-mc-busy-interrup-62943-5744 pane=w1:p1 code=~/.no-mistakes/worktrees/61c6dd39b831/01M396EP9RP6ZBAJXX87NCC9ZK mode=vim flow=busy-interrupt herdr=herdr 0.9.1 claude=2.1.281 (Claude Code)
[04:07:05] claude ready; footer:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️25 | ⚡80% | P01=E04=U08=J17:07:02    auto mode unavailable for this model
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:07:05] submitting a long prompt so claude is mid-turn
[04:07:06] agent status before interrupt: working
[04:07:06] $ fm-control.sh mc1 interrupt
interrupt-delivered mc1 harness=claude backend=herdr verified=agent-alive cancel=unconfirmed
[04:07:10] interrupt rc=0
[04:07:12] footer after interrupt:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | 3.5¢ 14.0s | ⚙️21 | ⚡80% | P01=E04=U08=J17:07:11
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:07:12] typing 'MCTOKEN30894' raw to prove the composer takes text
[04:07:14] composer shows MCTOKEN30894 verbatim: TEXT ENTRY OK
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | 3.5¢ 14.0s | ⚙️21 | ⚡80% | P01=E04=U08=J17:07:11
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
{"error":{"code":"invalid_key","message":"unsupported key C-u"},"id":"cli:request"}
[04:07:14] $ fm-control.sh mc1 exit
error: task mc1's composer visibly holds pending text; refusing to type the /exit exit command because it would concatenate onto that text. Clear or submit the pending text, then retry 'exit'
[04:07:16] exit rc=1
[04:07:17] agent status after exit: idle
[04:07:17] footer after exit:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | 3.5¢ 14.0s | ⚙️21 | ⚡80% | P01=E04=U08=J17:07:11
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:07:17] FLOW RESULT: FAIL
[04:07:17] teardown fm-lab-mc-busy-interrup-62943-5744
Evidence: fm-control relaunch replaces the Claude worker

Source: fm-control relaunch replaces the Claude worker

[04:07:22] lab=fm-lab-mc-relaunch-75763-32727 pane=w1:p1 code=~/.no-mistakes/worktrees/61c6dd39b831/01M396EP9RP6ZBAJXX87NCC9ZK mode=vim flow=relaunch herdr=herdr 0.9.1 claude=2.1.281 (Claude Code)
[04:07:31] claude ready; footer:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️19 | ⚡80% | P01=E04=U08=J17:07:28    auto mode unavailable for this model
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:07:31] $ fm-control.sh mc1 interrupt
interrupt-delivered mc1 harness=claude backend=herdr verified=agent-alive cancel=unconfirmed
[04:07:34] interrupt rc=0
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️26 | ⚡80% | P01=E04=U08=J17:07:34    auto mode unavailable for this model
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:07:35] $ fm-control.sh mc1 relaunch --note 'lab relaunch'
warning: /private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-mc-live.QytiID/home/data/mc1/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
relaunched mc1 harness=claude from=claude model=default effort=default backend=herdr endpoint=fm-lab-mc-relaunch-75763-32727:w1:p1 worktree=/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-mc-live.QytiID/wt
[04:07:53] relaunch rc=0
[04:07:57] agent status after relaunch: working
[04:07:57] screen after relaunch:
  specification, not captain intent.
  The Definition of done's rule that --intent must be self-sufficient still governs the string you pass: resolve any
  report, decision, or PR the intent below refers to into its substance rather than passing the pointer.
  Captain intent authorized for --intent
  Lab.
✢ Flowing… (5s · thinking)
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Opus 5.5 (1M context) | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️28 | ⚡80% | P01=E04=U08=J17:07:51          ◐ medium · /effort
  -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:07:57] FLOW RESULT: PASS
[04:07:57] teardown fm-lab-mc-relaunch-75763-32727
Evidence: Plain-text submit (the fm-send path) still works

Source: Plain-text submit (the fm-send path) still works

[04:09:10] lab=fm-lab-mc-send-plain-40008-19228 pane=w1:p1 code=~/.no-mistakes/worktrees/61c6dd39b831/01M396EP9RP6ZBAJXX87NCC9ZK mode=novim flow=send-plain herdr=herdr 0.9.1 claude=2.1.281 (Claude Code)
[04:09:19] claude ready; footer:
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️37 | ⚡80% | P01=E04=U08=J17:09:17    auto mode unavailable for this model
  ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:09:19] fm_backend_herdr_send_text_submit plain text (the fm-send path)
[04:09:22] verdict=empty
[04:09:25] claude answered PONGLAB: submitted
  ▝▝ ▝▝    /private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-mc-live.VM7xxO/wt
❯ Reply with only the single word PONGLAB and nothing else.
⏺ PONGLAB
✻ Cogitated for 2s · done 4:09 AM
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker · restart with CLAUDE_CODE_FORCE_SESSION_P…
  Haiku 4.5 | p/v/f/1/g/T/f/wt [mc1 ✓] | ⚙️37 | ⚡80% | P01=E04=U08=J17:09:17
  ⏵⏵ bypass permissions on (shift+tab to cycle)
[04:09:25] FLOW RESULT: PASS
[04:09:25] teardown fm-lab-mc-send-plain-40008-19228
Evidence: Lab driver used for round 2

Source: Lab driver used for round 2

#!/usr/bin/env bash
# Live Herdr lab driver (round 2: proof reads whole capture, 200 rows).
# Usage: live-lab-driver.sh <code-root> <vim|novim> <flow>
#   flows: interrupt-exit | escape-exit | busy-interrupt | relaunch
# Runs a REAL claude in an isolated fm-lab-* Herdr session (bin/fm-herdr-lab.sh)
# and drives <code-root>/bin/fm-control.sh against it. Tears the lab down on exit.
set -u
CODE=$1 MODE=$2 FLOW=$3
LABROOT=~/.no-mistakes/worktrees/61c6dd39b831/01M396EP9RP6ZBAJXX87NCC9ZK
LAB_HELPER=$LABROOT/bin/fm-herdr-lab.sh
ORIGINAL_PATH=$PATH
unset HERDR_PANE_ID HERDR_TAB_ID HERDR_WORKSPACE_ID HERDR_SOCKET_PATH HERDR_ENV
SESSION=$("$LAB_HELPER" name "mc-$FLOW")
TMP_ROOT=$(mktemp -d "$(cd "${TMPDIR:-/tmp}" && pwd -P)/fm-mc-live.XXXXXX")
FAKEBIN="$TMP_ROOT/fakebin"; mkdir -p "$FAKEBIN"
log() { printf '[%s] %s\n' "$(date +%H:%M:%S)" "$*"; }
cleanup() {
  local rc=$?
  trap - EXIT
  log "teardown $SESSION"
  PATH="$ORIGINAL_PATH" "$LAB_HELPER" teardown "$SESSION" || rc=1
  rm -rf "$TMP_ROOT"
  exit "$rc"
}
trap cleanup EXIT
cat > "$FAKEBIN/herdr" <<EOF
#!/usr/bin/env bash
set -u
args=("\$@")
n=\${#args[@]}
if [ "\$n" -ge 2 ] && [ "\${args[\$((n-2))]}" = --session ]; then
  [ "\${args[\$((n-1))]}" = "$SESSION" ] || { echo "wrapper refused foreign session" >&2; exit 97; }
  args=("\${args[@]:0:\$((n-2))}")
fi
for ((k=0;k<\${#args[@]};k++)); do
  if [ "\${args[k]}" = --session ]; then
    [ "\${args[k+1]}" = "$SESSION" ] || { echo "wrapper refused foreign session" >&2; exit 97; }
    args=("\${args[@]:0:k}" "\${args[@]:k+2}"); break
  fi
done
case "\${args[0]:-}" in --version|version) exec env PATH="$ORIGINAL_PATH" herdr "\${args[@]}";; esac
exec env PATH="$ORIGINAL_PATH" "$LAB_HELPER" run "$SESSION" "\${args[@]}"
EOF
chmod +x "$FAKEBIN/herdr"
"$LAB_HELPER" provision "$SESSION" || { log "provision failed"; exit 1; }
export PATH="$FAKEBIN:$ORIGINAL_PATH" HERDR_SESSION="$SESSION"
lab() { env PATH="$ORIGINAL_PATH" "$LAB_HELPER" run "$SESSION" "$@"; }

HOME_DIR="$TMP_ROOT/home"; PROJ="$TMP_ROOT/proj"; WT="$TMP_ROOT/wt"
mkdir -p "$HOME_DIR/state" "$HOME_DIR/data/mc1" "$PROJ"
printf '# Task\n## Captain'"'"'s intent\nLab.\n\n## Firstmate spec\nLab.\n' > "$HOME_DIR/data/mc1/brief.md"
git -C "$PROJ" init -q; printf '# proj\n' > "$PROJ/README.md"; git -C "$PROJ" add README.md
git -C "$PROJ" -c user.name=t -c [email protected] commit -qm initial
git -C "$PROJ" worktree add --quiet -b mc1 "$WT"

WS_JSON=$(lab workspace create --cwd "$WT" --label fm-mclive --no-focus) || { log "workspace create failed"; exit 1; }
PANE=$(printf '%s' "$WS_JSON" | jq -er '.result.root_pane.pane_id')
WSID=$(printf '%s' "$WS_JSON" | jq -er '.result.workspace.workspace_id // .result.root_pane.workspace_id')
TABID=$(printf '%s' "$WS_JSON" | jq -er '.result.root_pane.tab_id // .result.tab.tab_id')
{
  echo "window=$SESSION:$PANE"; echo "endpoint_task_id=mc1"; echo "worktree=$WT"; echo "project=$PROJ"
  echo "harness=claude"; echo "kind=ship"; echo "mode=no-mistakes"; echo "yolo=on"
  echo "model=default"; echo "effort=default"; echo "backend=herdr"; echo "herdr_session=$SESSION"
  echo "herdr_workspace_id=$WSID"; echo "herdr_tab_id=$TABID"; echo "herdr_pane_id=$PANE"
} > "$HOME_DIR/state/mc1.meta"
log "lab=$SESSION pane=$PANE code=$CODE mode=$MODE flow=$FLOW herdr=$(PATH=$ORIGINAL_PATH herdr --version) claude=$(claude --version)"

if [ "$MODE" = vim ]; then EDM=vim; else EDM=normal; fi
lab pane run "$PANE" "cd '$WT' && CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false CLAUDE_CODE_SEND_FEEDBACK=0 claude --dangerously-skip-permissions --model haiku --settings '{\"feedbackDrafts\":\"off\",\"editorMode\":\"$EDM\"}'" >/dev/null
screen() { lab pane read "$PANE" --source visible 2>/dev/null; }
footer() { screen | grep -v '^[[:space:]]*$' | tail -4; }
wait_idle() {
  local i=0 st
  while [ $i -lt 60 ]; do
    st=$(lab agent get "$PANE" 2>/dev/null | jq -r '.result.agent.agent_status // empty')
    case "$st" in
      idle|done) return 0 ;;
      blocked) case "$(screen)" in *'Yes, I trust this folder'*) lab pane send-keys "$PANE" down enter >/dev/null ;; esac ;;
    esac
    i=$((i+1)); sleep 1
  done
  return 1
}
wait_idle || { log "claude never idle"; screen; exit 1; }
sleep 2
log "claude ready; footer:"; footer
ctl() {
  env FM_GATE_REFUSE_BYPASS=1 FM_HOME="$HOME_DIR" HERDR_SESSION="$SESSION" FM_SPAWN_NO_GUARD=1 FM_CONTROL_POLL=0.3 FM_CONTROL_EXIT_WAIT=15 \
    "$CODE/bin/fm-control.sh" "$@" 2>&1
}
agentstat() { lab agent get "$PANE" 2>/dev/null | jq -r '.result.agent.agent_status // "none"'; }
procs() { lab pane process-info "$PANE" 2>/dev/null | jq -c '[.. | .name? // empty]' 2>/dev/null; }
RESULT=0
run_exit() {
  log "\$ fm-control.sh mc1 exit"
  OUT=$(ctl mc1 exit); rc=$?
  printf '%s\n' "$OUT"; log "exit rc=$rc"
  sleep 1; log "agent status after exit: $(agentstat)"; log "footer after exit:"; footer
  [ $rc -eq 0 ] || RESULT=1
}
case "$FLOW" in
  probe-proof)
    . "$CODE/bin/fm-backend.sh"; fm_backend_source herdr
    T="$SESSION:$PANE"
    for payload in "/exit" "hello world"; do
      log "send_literal '$payload' (unsubmitted), then read what the Claude payload proof reads"
      fm_backend_herdr_send_literal "$T" "$payload"; sleep 1.2
      lines=200
      content=$(fm_backend_herdr_composer_content "$T" "$lines"); crc=$?
      log "composer_content rc=$crc: [$(printf '%s' "$content" | tr '\n' '|')]"
      if fm_backend_herdr_composer_payload_shown "$payload" "$content"; then log "payload_shown('$payload') = YES"; else log "payload_shown('$payload') = NO -> send_text_submit would refuse with send-failed"; fi
      log "visible screen tail:"; screen | grep -v '^[[:space:]]*$' | tail -12
      for _ in 1 2 3; do lab pane send-keys "$PANE" ctrl+u >/dev/null; done; sleep 0.8
    done ;;
  send-plain)
    . "$CODE/bin/fm-backend.sh"; fm_backend_source herdr
    T="$SESSION:$PANE"
    log "fm_backend_herdr_send_text_submit plain text (the fm-send path)"
    v=$(fm_backend_herdr_send_text_submit "$T" "Reply with only the single word PONGLAB and nothing else." 3 0.3 1.2)
    log "verdict=$v"
    case "$v" in send-failed|unknown|'') RESULT=1 ;; esac
    for _ in $(seq 1 30); do screen | grep -q '^[^❯]*PONGLAB' && break; sleep 1; done
    if screen | grep -v 'Reply with' | grep -q PONGLAB; then log "claude answered PONGLAB: submitted"; else log "no PONGLAB reply"; RESULT=1; fi
    screen | grep -v '^[[:space:]]*$' | tail -10 ;;
  plain-exit)
    run_exit ;;
  interrupt-exit)
    log "\$ fm-control.sh mc1 interrupt"
    OUT=$(ctl mc1 interrupt); rc=$?; printf '%s\n' "$OUT"; log "interrupt rc=$rc"
    [ $rc -eq 0 ] || RESULT=1
    sleep 1; log "footer after interrupt:"; footer
    run_exit ;;
  escape-exit)
    log "raw Escape via herdr pane send-keys (an earlier Escape outside fm-control)"
    lab pane send-keys "$PANE" escape >/dev/null; sleep 1.5
    log "footer after raw Escape:"; footer
    run_exit ;;
  busy-interrupt)
    log "submitting a long prompt so claude is mid-turn"
    lab pane send-text "$PANE" "Count slowly from 1 to 400, one number per line, no other text." >/dev/null
    sleep 0.5; lab pane send-keys "$PANE" enter >/dev/null
    for _ in $(seq 1 20); do [ "$(agentstat)" = working ] && break; sleep 0.5; done
    log "agent status before interrupt: $(agentstat)"
    log "\$ fm-control.sh mc1 interrupt"
    OUT=$(ctl mc1 interrupt); rc=$?; printf '%s\n' "$OUT"; log "interrupt rc=$rc"
    [ $rc -eq 0 ] || RESULT=1
    sleep 2; log "footer after interrupt:"; footer
    TOKEN="MCTOKEN$RANDOM"
    log "typing '$TOKEN' raw to prove the composer takes text"
    lab pane send-text "$PANE" "$TOKEN" >/dev/null; sleep 1
    if screen | grep -q "$TOKEN"; then log "composer shows $TOKEN verbatim: TEXT ENTRY OK"; else log "composer did NOT show $TOKEN verbatim"; RESULT=1; fi
    footer
    lab pane send-keys "$PANE" ctrl+u >/dev/null; sleep 0.5
    run_exit ;;
  relaunch)
    log "\$ fm-control.sh mc1 interrupt"
    OUT=$(ctl mc1 interrupt); rc=$?; printf '%s\n' "$OUT"; log "interrupt rc=$rc"
    sleep 1; footer
    log "\$ fm-control.sh mc1 relaunch --note 'lab relaunch'"
    OUT=$(ctl mc1 relaunch --note "lab relaunch proof"); rc=$?; printf '%s\n' "$OUT"; log "relaunch rc=$rc"
    [ $rc -eq 0 ] || RESULT=1
    sleep 3; log "agent status after relaunch: $(agentstat)"; log "screen after relaunch:"; screen | grep -v '^[[:space:]]*$' | tail -12
    ;;
esac
log "FLOW RESULT: $([ $RESULT -eq 0 ] && echo PASS || echo FAIL)"
exit $RESULT
- Outcome: 🔧 2 issues found → auto-fixed ✅ across 2 runs (22m7s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ℹ️ bin/fm-control.sh:740 - The one-time exit retry only runs on a send-failed verdict, and only Herdr's Claude payload check produces that. On tmux, zellij or cmux, a Claude composer that is already in vim command mode when exit starts (idle agent, so no interrupt runs first) still turns /exit into the character t. That t is then submitted as a prompt, and exit times out waiting for the agent to stop. entry_before=other is already known before typing, but the change deliberately refuses to type into a composer whose mode is unproven. The intent is Herdr-only, so no action is needed here; this is a known gap on the other backends.
🔧 **Test** - 2 issues found → auto-fixed ✅
  • 🚨 bin/backends/herdr.sh:3348 - fm-control exit still fails on Herdr 0.9.1 with Claude 2.1.281 at this commit, with or without vim mode and with or without a prior interrupt. After fm_backend_herdr_send_text_submit types /exit, Claude opens its slash-command completion list. With the operator's many skills and plugins the list pushes the composer row out of the fm_backend_herdr_proof_lines tail capture. fm_backend_herdr_composer_content returns rc=1, the payload proof fails, the composer is cleared, and the result is send-failed, which do_exit reports as 'the exit command could not be sent'. Plain text opens no list, which is why fm-send works. The vim-mode restore in this change is real but secondary. The exit/relaunch recovery the intent requires stays broken until the proof can see a /-prefixed payload while the completion list is open. Possible directions: capture past the list, or read the composer row instead of the tail. A deterministic regression should reproduce a tall completion list below the composer.
  • 🚨 live validation verdict: no-go (7 of 7 scenarios were driven live against the product); failed: Operator recovers a worker: fm-control exit on an idle Claude (vim mode) on Herdr stops the agent, Adversarial: fm-control exit on an idle Claude WITHOUT vim mode also works (the fix must not depend on vim), fm-control interrupt then exit on a vim-mode Claude stops the agent, fm-control relaunch replaces a Claude worker on Herdr, Root cause: after /exit is typed, the Herdr Claude payload proof can read the composer
  • Live validation: ❌ no-go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Reproduce: at the base commit, fm-control interrupt then exit on an idle vim-mode Claude on Herdr reports 'the exit command could not be sent' ✅ pass live 01-base-vim-interrupt-exit.log (the footer loses -- INSERT -- after the interrupt; exit rc=1 with the exact reported error)
Operator recovers a worker: fm-control exit on an idle Claude (vim mode) on Herdr stops the agent ❌ fail live 03-head-vim-plain-exit.log: 'error: the exit command could not be sent to task mc1 on herdr', agent still idle
Adversarial: fm-control exit on an idle Claude WITHOUT vim mode also works (the fix must not depend on vim) ❌ fail live 04-head-novim-plain-exit.log: same send-failed error with editorMode normal
fm-control interrupt then exit on a vim-mode Claude stops the agent ❌ fail live 02-head-vim-interrupt-exit.log: the interrupt restores -- INSERT --, but exit still fails with the reported error
fm-control interrupt on a mid-turn vim-mode Claude leaves the composer taking typed text ✅ pass live 06-head-vim-busy-interrupt.log: interrupt-delivered, the footer shows -- INSERT --, and a raw token appears verbatim in the composer
fm-control relaunch replaces a Claude worker on Herdr ❌ fail live 07-head-vim-relaunch.log: 'relaunch of mc1 failed while stopping the old agent' after the same exit send error
Root cause: after /exit is typed, the Herdr Claude payload proof can read the composer ❌ fail live 05-head-novim-probe-payload-proof.log: composer_content rc=1 because the slash-completion list pushes the composer out of the proof's tail capture; payload_shown=NO
  • live-lab-driver.sh &lt;base-73ae45e&gt; vim interrupt-exit: isolated fm-lab-* Herdr session, real Claude 2.1.281 in vim mode, fm-control interrupt then exit at the base commit
  • live-lab-driver.sh &lt;head&gt; vim interrupt-exit: same flow at be24904
  • live-lab-driver.sh &lt;head&gt; vim plain-exit: fm-control exit on an idle vim-mode Claude with no prior interrupt
  • live-lab-driver.sh &lt;head&gt; novim plain-exit: fm-control exit on an idle Claude with editorMode normal
  • live-lab-driver.sh &lt;head&gt; novim probe-proof: typed /exit and hello world unsubmitted, then called the adapter's own fm_backend_herdr_composer_content and fm_backend_herdr_composer_payload_shown to see what the send proof reads
  • live-lab-driver.sh &lt;head&gt; vim busy-interrupt: interrupted a mid-turn Claude through fm-control, then typed a token raw to prove the composer takes text
  • live-lab-driver.sh &lt;head&gt; vim relaunch: fm-control interrupt, then fm-control relaunch --note

🔧 Fix applied.
✅ Re-checked - no issues remain.

  • Live validation: ✅ go - 8 of 8 scenarios driven live against the product
Scenario Result Live Evidence
Root cause: after typing /exit, the Claude payload proof reads /exit from the composer even with the tall slash-command completion list open ✅ pass live r2-01-head-novim-probe-payload-proof.log: composer_content rc=0 [/exit], payload_shown=YES, and the visible screen tail is nothing but completion-list rows
Operator recovers a worker: fm-control exit on an idle vim-mode Claude on Herdr stops the agent ✅ pass live r2-02-head-vim-plain-exit.log: 'stopped mc1 harness=claude backend=herdr', rc=0, and the pane is back at a shell prompt
Adversarial: fm-control exit on an idle Claude without vim mode also works (the fix does not depend on vim) ✅ pass live r2-03-head-novim-plain-exit.log: exit rc=0, agent gone
fm-control interrupt then exit on a vim-mode Claude stops the agent ✅ pass live r2-04-head-vim-interrupt-exit.log: interrupt rc=0, exit rc=0
Interrupting a busy Claude leaves the composer accepting text, and a later exit succeeds ✅ pass live r2-05-head-vim-busy-interrupt.log: interrupt-delivered, 'composer shows MCTOKEN verbatim: TEXT ENTRY OK', exit rc=0
Adversarial: exit refuses to type /exit onto pending composer text ✅ pass live r2-05a-driver-bug-C-u-guard-refusal.log: 'composer visibly holds pending text; refusing to type the /exit exit command', and no concatenation happened
fm-control relaunch replaces a Claude worker on Herdr ✅ pass live r2-06-head-vim-relaunch.log: 'relaunched mc1 harness=claude ... backend=herdr', rc=0, new agent working
No regression: a plain-text send through the Claude proof path still submits and Claude answers ✅ pass live r2-07-head-novim-send-plain.log: verdict=empty, Claude replied PONGLAB
  • live-lab-driver-r2.sh &lt;worktree&gt; novim probe-proof: typed /exit without submitting into live Claude and read the composer the way the payload proof does, using a 200-row capture
  • live-lab-driver-r2.sh &lt;worktree&gt; vim plain-exit: bin/fm-control.sh mc1 exit on an idle vim-mode Claude
  • live-lab-driver-r2.sh &lt;worktree&gt; novim plain-exit: fm-control exit on an idle Claude without vim mode
  • live-lab-driver-r2.sh &lt;worktree&gt; vim interrupt-exit: fm-control interrupt, then fm-control exit
  • live-lab-driver-r2.sh &lt;worktree&gt; vim busy-interrupt: interrupt a Claude mid-turn, type a token into the composer, clear it, then exit (re-run after fixing the driver's key name)
  • live-lab-driver-r2.sh &lt;worktree&gt; vim relaunch: fm-control interrupt, then fm-control relaunch --note
  • live-lab-driver-r2.sh &lt;worktree&gt; novim send-plain: fm_backend_herdr_send_text_submit with plain text on a live Claude, checking that the reply arrives
  • bash tests/fm-backend-herdr.test.sh (targeted, includes the new slash-completion-list regression test)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Claude's optional vim editor mode makes Escape - which is also its
interrupt key - leave the composer's text entry. Everything typed after
that is read as editor commands instead of text: `/exit` is consumed as
the search, end-of-word, delete-char and insert commands, and only the
trailing `t` reaches the composer. On Herdr the Claude payload proof
catches the fragment and refuses with `send-failed`, so `fm-control exit`
reported that the exit command could not be sent and a wedged worker
could not be stopped, interrupted out of the state, or relaunched.

The interrupt now restores text entry when its own key took it away,
proven from the harness's rendered indicator and only on a still-running
agent. Exit types its command once more when a refusal is attributable to
the mode: the composer was not taking text when the command was typed and
is taking text now, which is what the refused `/exit` does to itself.
Nothing is typed to establish that, so a composer with no modal editor -
which renders no indicator either way - is never touched by a refusal it
did not cause, and a refusal with any other cause is still reported.

bin/fm-control-lib.sh gains the per-harness indicator and insert key,
bin/fm-backend.sh gains the raw unsubmitted send the restore needs.

Verified live in an isolated Herdr lab on herdr 0.9.1 with claude in vim
mode: interrupt, exit after that interrupt, relaunch, and exit against a
composer an earlier Escape had already left in command mode.
@max-metaplanet
max-metaplanet merged commit 234a667 into main Sep 24, 2026
19 checks passed
max-metaplanet added a commit that referenced this pull request Sep 25, 2026
)

* fix(bin): submit the Herdr doorbell into a vim-mode Claude composer

Claude's optional vim editor mode gives its composer a command mode whose
keystrokes are editor commands, and Escape - Claude's own interrupt key -
is what leaves text entry. A doorbell typed into a composer left there is
eaten from the front: `: Firstma` becomes the space, find-backwards,
replace, till and append commands, so only `te instruction waiting: ...`
is inserted. The Herdr payload proof correctly refuses that fragment, and
the steer was reported as a doorbell that did not reach the pane while no
instruction was ever delivered.

The adapter now recovers a refusal the mode caused, exactly once. After
the refused fragment is cleared back to the proven-empty state the send
started from, it checks the harness's text-entry indicator: an eaten
payload usually ends on an insert command and has already restored text
entry itself, so nothing is typed, and only an absent indicator makes the
adapter type the text-entry key - which counts only when the indicator
appears while the composer still reads empty. The payload is then typed
and proven a second time before Enter, so the whole doorbell is submitted
rather than its remainder. A payload still refused after that is reported
send-failed with the composer empty.

The steering ring no longer counts an unaccountable delivery as rung. A
backend verdict of `unknown` means it could confirm neither the
submission nor that its own half-typed text is gone, and a composer still
holding that fragment answers every later ring with the pending skip, so
both `unknown` and `send-failed` now report a failed ring and the
watcher's re-ring is expected rather than a surprise. `pending` keeps its
meaning: the composer provably holds the complete doorbell, which the
next ring submits.

The indicator, the text-entry key, and how the indicator is recognized
move to bin/fm-composer-lib.sh, the composer owner, because delivery and
lifecycle control now both read them; bin/fm-control.sh keeps its own
restore and sources that owner directly.

Two things this is NOT. It is not the composer-reader defect in
kunchenguid#5558: the reader identified the idle pane and the
fragment correctly, and refusing that fragment was the right call. And it
is not a consequence of the restart-control change in #10 - the tail
capture width that change replaced refuses the identical fragment,
measured live against the same pane.

Verified live in an isolated Herdr lab on herdr 0.9.1 with Claude Code
2.1.282, editorMode pinned per pane: the doorbell is submitted to a
composer taking text, to one an Escape left in command mode, and to one
with no modal editor.

* no-mistakes(review): Count unknown rings as rung; read INSERT only in composer footer

* no-mistakes(document): Document Herdr unaccounted verdict and footer-only indicator read
max-metaplanet added a commit that referenced this pull request Oct 6, 2026
… Herdr

Carried from fork commit 234a667 (#10).

bin/backends/herdr.sh takes upstream's composer read instead of this commit's.
Upstream independently diagnosed and fixed the same bounded-tail defect, and its
fix is the stronger one: the capture is the full visible viewport rather than a
200-row tail, which also survives an overlay rendered between the composer and
the pane bottom.
Upstream's `fm_backend_herdr_composer_content` takes only a target, so this
commit's extra row-count argument would have been silently ignored.

bin/fm-control.sh unions the locals in do_exit, because both sides' variables are
used in the merged body: upstream's `dialog` for the blocking-prompt refusal and
this commit's `insert_signal` and `entry_before` for the modal-composer restore.

tests/fm-control.test.sh keeps both the fake pane's after-Enter handling and this
commit's vim screen branch, and keeps both independent test groups.
The conflict boundary fell inside upstream's resume-flag test, so its closing
brace is restored at the junction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant