Skip to content

fix(bin): send Claude's typed /exit when its slash popup draws below the composer - #7388

Open
MoemenDarwish wants to merge 2 commits into
kunchenguid:mainfrom
MoemenDarwish:fm/fm-herdr-secondmate-restart
Open

MoemenDarwish wants to merge 2 commits into
kunchenguid:mainfrom
MoemenDarwish:fm/fm-herdr-secondmate-restart

Conversation

@MoemenDarwish

Copy link
Copy Markdown

Intent

fix the tool first

Context: the captain asked to move both persistent second mates (raneen-hyva-mate, raneen-kiosk-mate) and the long-running raneen-traffic-sentinel worker onto a different Claude account by restarting them. On 2026-10-15 (~19:10Z) every restart failed the same way, on herdr 0.9.3 with Claude Code sessions:

  • bin/fm-secondmate-restart.sh raneen-hyva-mate raneen-kiosk-mate -> "unreached: ... the restart outcome is unknown: the exit command could not be sent to task on herdr", 0 of 2 restarted.
  • bin/fm-control.sh relaunch for raneen-hyva-mate and raneen-traffic-sentinel -> "error: the exit command could not be sent to task on herdr" / "relaunch ... failed while stopping the old agent, which is still running; its original instructions were restored".
    The die is at bin/fm-control.sh ~731-733, after fm_backend_send_text_submit "$BACKEND" "$T" "$cmd" (cmd = Claude's exit command) either returned non-zero or the verdict send-failed. The composer was idle and empty at the time (agent_status done, empty ❯ prompt). herdr pane get now returns a valid pane_id for these panes. The same symptom was first seen 2026-10-10 after updating to fb75c1f (then also with an empty pane_id from herdr pane get). Possibly related but different: upstream issue Herdr + Claude: doorbell always fails (rc 2) in narrow or short panes because the composer proof sees a clipped composer #7354 (Claude composer proof fails on clipped composers in narrow/short panes, doorbell rc 2) - check whether the composer-proof logic in fm_backend_herdr_send_text_submit is also what rejects the short exit command here.

What Changed

  • bin/fm-composer-lib.sh: the composer footer-zone classifier now treats Claude Code's slash-command popup, drawn directly below the composer's closing rule with a ❯-led selected row, as footer furniture. This applies only while the composer's own glyph row holds a typed / command. Popup rows must be the leading rows of the run, indented off column 0, and a wrapped description must sit at the recorded description column. This lets the payload proof read the typed /exit instead of the whole menu, which is why fm-control relaunch and fm-secondmate-restart could not send the exit command on herdr. The exception can never produce empty.
  • bin/backends/herdr.sh: both submit-confirmation awk budget computations (fm_backend_herdr_submit_confirm_budget and the poll interval in fm_backend_herdr_wait_for_working) now run under LC_ALL=C, so comma-decimal locales no longer collapse the poll interval and confirmation window.
  • Adds unit and herdr backend tests for the popup shapes and the locale case, and updates docs/herdr-backend.md and docs/verification/runtime-backends.md with the dated measurement ("Claude slash-command popup below the composer"). The live e2e submit-confirm test was also adjusted.

Risk Assessment

✅ Low: The change narrowly teaches the composer footer-zone classifier to treat Claude 2.1.301's below-composer slash popup as furniture only under a typed / envelope. That exception can only produce a pending/refusal verdict, never empty. The awk locale fix is a small, correct addition, and the new portable tests exercise real behavior.

Testing

I ran the two portable suites that cover the change and the repo's live Herdr submit-confirm guard, all passing. I also confirmed the new composer-lib regression fails on the base commit. In a throwaway fm-lab session I reproduced the popup-below-composer screen with real Claude. The base classifier read the whole menu as the composer content, HEAD read "/exit", and send_text_submit at HEAD submitted /exit so Claude exited. The adversarial popup-shape scenario and the comma-decimal locale scenario were covered only by synthetic unit tests, not driven live, so they are recorded as untested live. I did not drive bin/fm-control.sh exit, relaunch, or bin/fm-secondmate-restart.sh end to end, and I did not run the second-CLAUDE_CONFIG_DIR variant the docs mention, so those stay unexercised. The lab was torn down.

  • Live validation: ✅ go - 2 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Composer classifier on a real Claude capture with the popup below the composer: the base reads the whole menu, HEAD extracts exactly /exit and stays pending ✅ pass live classifier-live-head-vs-base.txt: HEAD gives pending / '/exit'; the base commit gives pending / '/exit Exit the CLI /context Visualize ...'
Typed /exit is proven and submitted via fm_backend_herdr_send_text_submit with the popup below the composer; Claude exits and the pane returns to a shell prompt ✅ pass live send-text-submit-exit-live.txt: the verdict was 'unknown', not send-failed. It was likely 'unknown' because Claude exited and the pane could not be re-read. agent get then returned agent_not_found and…
Adversarial: popup-shaped rows under an empty composer never read empty, a misaligned wrapped row or a rule below the popup does not let the composer be selected, and a column-0 live composer still wi… ⏸️ untested no The prior payload covered this only with tests/fm-composer-lib.test.sh::test_composer_footer_zone_claude_slash_popup, which runs the real classifier on synthetic screens and is not a live run against…
Comma-decimal locale (ar_EG.UTF-8) no longer collapses the Herdr submit confirmation poll interval ⏸️ untested no The prior payload covered this only with tests/fm-backend-herdr.test.sh::test_wait_for_working_budget_ignores_comma_decimal_locale, which runs the awk budget code under a fake herdr and not a live one…
bin/fm-control.sh exit/relaunch and bin/fm-secondmate-restart.sh succeed end to end on a registered Claude task ⏸️ untested no Not driven. It needs a registered task and secondmate in a lab fleet home, which I did not stand up. The shared send path they depend on was exercised live.
Evidence: Live Claude 2.1.301 capture with the popup below the composer (plain)

Source: Live Claude 2.1.301 capture with the popup below the composer (plain)

CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false CLAUDE_CODE_SEND_FEEDBACK=0 claude --dangerously-skip-permissions
╭─moewish@moe-macbook ~/.no-mistakes/worktrees/4d6acb970e7d/01M51HH4VJF3VHZFR2YY04GQDT
╰─$ CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false CLAUDE_CODE_SEND_FEEDBACK=0 claude --dangerously-skip-permissions
 ▐▛███▛█   Claude Code v2.1.301
▝▜██████▀  Opus 5.5 with medium effort · Claude Max
 ▝▝   ▝▝   ~/.no-mistakes/worktrees/4d6acb970e7d/01M51HH4VJF3VHZFR2YY04GQDT


───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ /exit
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ❯ /exit                                          Exit the CLI
    /context                                       Visualize current context usage as a colored grid
    /usage-credits                                 Configure usage credits or request them from your admin when you
                                                   hit a limit
    /quiet                                         Enter quiet supervision mode when the captain invokes /quiet or
                                                   asks for quiet mode, quiet-while-present, or fewer routine wake t…
Evidence: Same capture with ANSI styling

Source: Same capture with ANSI styling

CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false CLAUDE_CODE_SEND_FEEDBACK=0 claude --dangerously-skip-permissions
╭─�[0m�[1m�[38;5;2mmoewish@moe-macbook�[0m �[0m�[1m�[38;5;4m~/.no-mistakes/worktrees/4d6acb970e7d/01M51HH4VJF3VHZFR2YY04GQDT �[0m
╰─�[0m�[1m$�[0m CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false CLAUDE_CODE_SEND_FEEDBACK=0 claude --dangerously-skip-permissions
�[0m�[38;2;215;119;87m ▐�[0m�[38;2;215;119;87m�[48;2;0;0;0m▛███▛█   �[0m�[1mClaude Code �[0m�[38;2;123;135;156mv2.1.301�[0m
�[0m�[38;2;215;119;87m▝▜�[0m�[38;2;215;119;87m�[48;2;0;0;0m█████�[0m�[38;2;215;119;87m█▀  �[0m�[38;2;123;135;156mOpus 5.5 with medium effort · Claude Max�[0m
�[0m�[38;2;215;119;87m ▝▝   ▝▝   �[0m�[38;2;123;135;156m~/.no-mistakes/worktrees/4d6acb970e7d/01M51HH4VJF3VHZFR2YY04GQDT�[0m


�[0m�[38;2;61;90;128m───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────�[0m
❯ �[0m�[38;2;94;179;246m/exit�[0m
�[0m�[38;2;61;90;128m───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────�[0m
  �[0m�[38;2;94;179;246m❯ /�[0m�[1m�[38;2;94;179;246mexit�[0m�[38;2;94;179;246m                                          �[0m�[1m�[38;2;94;179;246mExit�[0m�[38;2;94;179;246m the CLI�[0m
  �[0m�[38;2;123;135;156m  /context                                       Visualize current context usage as a colored grid�[0m
  �[0m�[38;2;123;135;156m  /usage-credits                                 Configure usage credits or request them from your admin when you�[0m
                                                   �[0m�[38;2;123;135;156mhit a limit�[0m
  �[0m�[38;2;123;135;156m  /quiet                                         Enter quiet supervision mode when the captain invokes /quiet or�[0m
                                                   �[0m�[38;2;123;135;156masks for quiet mode, quiet-while-present, or fewer routine wake t…�[0m
Evidence: Composer state/content on the live capture, HEAD vs base

Source: Composer state/content on the live capture, HEAD vs base

== ~/.no-mistakes/worktrees/4d6acb970e7d/01M51HH4VJF3VHZFR2YY04GQDT
pending/exit
== /var/folders/0q/6b8bjvyj67313n440h06lx6w0000gn/T/tmp.2uoRyIHRiL
pending/exit Exit the CLI /context Visualize current context usage as a colored grid /usage-credits Configure usage credits or request them from your admin when you hit a limit /quiet Enter quiet supervision mode when the captain invokes /quiet or asks for quiet mode, quiet-while-present, or fewer routine 
Evidence: send_text_submit /exit result and agent exit

Source: send_text_submit /exit result and agent exit

verdict=unknown
{"error":{"code":"agent_not_found","message":"agent target w1:p1 not found"},"id":"cli:agent:get"}


╭─moewish@moe-macbook ~/.no-mistakes/worktrees/4d6acb970e7d/01M51HH4VJF3VHZFR2YY04GQDT ‹3222b3ac›
╰─$
╭─moewish@moe-macbook ~/.no-mistakes/worktrees/4d6acb970e7d/01M51HH4VJF3VHZFR2YY04GQDT ‹3222b3ac›
╰─$

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 2 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Composer classifier on a real Claude capture with the popup below the composer: the base reads the whole menu, HEAD extracts exactly /exit and stays pending ✅ pass live classifier-live-head-vs-base.txt: HEAD gives pending / '/exit'; the base commit gives pending / '/exit Exit the CLI /context Visualize ...'
Typed /exit is proven and submitted via fm_backend_herdr_send_text_submit with the popup below the composer; Claude exits and the pane returns to a shell prompt ✅ pass live send-text-submit-exit-live.txt: the verdict was 'unknown', not send-failed. It was likely 'unknown' because Claude exited and the pane could not be re-read. agent get then returned agent_not_found and…
Adversarial: popup-shaped rows under an empty composer never read empty, a misaligned wrapped row or a rule below the popup does not let the composer be selected, and a column-0 live composer still wi… ⏸️ untested no The prior payload covered this only with tests/fm-composer-lib.test.sh::test_composer_footer_zone_claude_slash_popup, which runs the real classifier on synthetic screens and is not a live run against…
Comma-decimal locale (ar_EG.UTF-8) no longer collapses the Herdr submit confirmation poll interval ⏸️ untested no The prior payload covered this only with tests/fm-backend-herdr.test.sh::test_wait_for_working_budget_ignores_comma_decimal_locale, which runs the awk budget code under a fake herdr and not a live one…
bin/fm-control.sh exit/relaunch and bin/fm-secondmate-restart.sh succeed end to end on a registered Claude task ⏸️ untested no Not driven. It needs a registered task and secondmate in a lab fleet home, which I did not stand up. The shared send path they depend on was exercised live.
  • bash tests/fm-composer-lib.test.sh (all ok, incl. the new slash-popup footer-zone test)
  • bash tests/fm-backend-herdr.test.sh (all ok, incl. the new popup-below-composer submit test and the comma-decimal locale test)
  • Base-commit check: the new composer-lib test run against 1a6714f2 bin/ fails with the whole popup menu extracted as composer content
  • env -u CLAUDE_CONFIG_DIR -u TMUX -u HERDR_PANE_ID FM_HERDR_SUBMIT_CONFIRM_LIVE=1 bash tests/fm-herdr-submit-confirm-live-e2e.test.sh (all three live scenarios ok, including the typed /exit with the popup)
  • Live fm-lab probe: real Claude 2.1.301 on herdr 0.9.5, /exit typed so the popup draws below the composer; I ran fm_backend_herdr_composer_state and fm_backend_herdr_composer_content from HEAD and from the base commit
  • Live fm-lab probe: fm_backend_herdr_send_text_submit with /exit on the popup-below screen at HEAD; the agent then disappeared and the pane showed a shell prompt
✅ **Document** - passed

✅ No issues found.

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

✅ No issues found.

…ow the composer

Claude Code 2.1.301 can draw the slash-command popup directly below the
composer's closing rule, with its selected row led by the same `❯` the
composer uses. The shared composer classifier took that popup row as the
bottom-most live composer, so the herdr payload proof read the whole menu
instead of `/exit`, cleared the composer, and reported send-failed.
fm-control exit then failed with "the exit command could not be sent", and
relaunch and fm-secondmate-restart inherited it.

The composer footer zone now counts popup rows as envelope furniture only
while the envelope's own glyph row holds a typed `/` command, only as the
run's leading indented rows, and with wrapped descriptions only at their
column, so the pending-text, dialog, and revert-picker refusals are
unchanged and the exception can never produce `empty`.

The herdr submit confirmation budget and poll interval now compute awk under
LC_ALL=C, since a comma-decimal locale made macOS awk collapse the interval.
The piped composer-probe test uses fm_run_timed instead of GNU timeout.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @MoemenDarwish — great diagnosis, and the live lab capture of the 2.1.301 popup-below-composer shape makes this easy to trust.

VISION per-rule

  1. One captain, one interface: aligns — fixes a failed exit/relaunch/secondmate-restart the captain would otherwise have to chase.
  2. Authority is explicit: aligns — the exception only applies under a typed / envelope and can never produce empty, so it can only refuse, never widen sends.
  3. Scripts own the mechanics: aligns — exact shape rules in the composer classifier; no judgment in the script.
  4. A restart is a non-event: aligns — restores the scripted restart path for Claude mates on Herdr.
  5. Delegation with a spine: aligns — portable regressions (incl. adversarial shapes) plus 2/5 live scenarios covering the core send path.
  6. The fleet outlives any vendor: aligns — vendor-rendered-surface reading stays inside the existing, dated Claude/Herdr adapter verification records.
  7. Scope: aligns — adapter + composer-lib + docs/tests only.

Contract-class: restore — fm-control exit/relaunch and fm-secondmate-restart on Herdr with Claude are a specified, verified default path ("Claude exit behind the slash-command popup"), broken by the new popup placement; the LC_ALL=C awk pin restores the promised confirm-budget timing.

CI: reviewed the diff for first-time-fork safety (no .github changes, fake-herdr tests only) and approved the workflow runs (CI 38854773911, Require no-mistakes 38854774031); waiting on them now. Heads-up: #6813 targets the same Claude-popup exit symptom from an earlier Claude version; worth a look to see whether one supersedes the other.

@MoemenDarwish

Copy link
Copy Markdown
Author

Could a maintainer please rerun the cancelled 'Behavior portable serial 2' job? GitHub cancelled it at the 30-minute job limit with no verdict - no test in it failed, and the other 18 checks passed. The same shard also hit the 30-minute limit on main (CI run 38843155914), where tests/fm-supervision-host.test.sh alone takes about 29 minutes.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @MoemenDarwish — done. I re-ran only the cancelled Behavior portable serial 2 job on CI run 38854773911 at unchanged head e9a51599 (it hit the 30-minute job ceiling with no failing test, the same shard limit main has been hitting). Every other check is green and the no-mistakes attestation matches this head.

Re-checked live against main 5f2b81bc: the head is unchanged since my last review, main's only new commit since then is a Pi test that doesn't touch your files, and the PR is still mergeable. Contract-class stays restore, and the VISION verdict is unchanged (all seven rules align).

Nothing is needed from you. Once serial 2 comes back green, this goes on the auto-merge path.

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.

2 participants