Repository navigation
fix(composer): normalize NBSP so an idle claude composer is not read as pending - #27
Merged
Merged
Conversation
…as pending Away-mode injection wedged for hours on a genuinely idle primary claude-on-herdr pane (2026-07-16 through 07-21), a different shape from the earlier ghost-text wedges since pane_is_busy was confirmed false throughout. Reproduced live in an isolated Herdr lab session: the idle composer's own row is a bare prompt glyph followed by a NON-BREAKING SPACE (U+00A0), with no ANSI styling at all. fm_composer_classify_content's trim/glyph-strip logic uses bash's [:space:] class, which does not match U+00A0, so the byte survived every trim and the row read pending forever even though the daemon's retry loop was already re-probing on a bounded cadence. Normalize a literal U+00A0 to a plain space before that logic runs, in the one shared classifier every adapter (tmux, herdr, orca, cmux) delegates to. Also checked, not reproduced: a claimed escalate_flush buffer-clear bug - the current code already clears the buffer unconditionally on success. Also noted, not fixed: a separate pre-existing gap where a bare dead-shell prompt plus a plain trailing space already misread as empty, documented in docs/herdr-backend.md for a follow-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Away-mode escalations kept wedging on the primary claude-on-herdr pane even while it was confirmed genuinely idle (2026-07-16/17, 07-20 for ~9h, 07-21 for ~2h) - a different shape from the earlier ghost-text wedges, since
pane_is_busywas false throughout, ruling out the "defers mid-turn" explanation.Reproduced live in an isolated Herdr lab session (never the live
defaultsession): a freshly launched, genuinely idleclaude --dangerously-skip-permissionspane (herdr 0.7.4, claude 2.1.217). Reading the exact bytesfm_backend_herdr_composer_stateitself reads showed the composer row is the bare❯prompt glyph followed by a NON-BREAKING SPACE (U+00A0), with no ANSI styling at all - a different root cause from the two already-fixed ghost-text incidents.fm_composer_classify_content's trim and glyph-strip logic uses bash's[:space:]class, which does not match U+00A0, so the trailing NBSP survived every trim and the row readpendingforever, even thoughhousekeeping's batch-flush/max-defer retries were already re-probing on a bounded cadence the whole time.Fix:
fm_composer_classify_content(bin/fm-composer-lib.sh) normalizes a literal U+00A0 to a plain space before its trim/glyph-strip logic runs. This is the single shared owner every adapter delegates to (tmux, herdr, orca, cmux), so no per-adapter change was needed, and real typed text (including an incidental interior NBSP) still readspending.Also checked, not reproduced: the brief for this investigation named a claim that
escalate_flushfails to clearstate/.subsuper-escalationson success, causing duplicate re-injection. Reading the current code shows it already truncates the buffer and clears the wedge marker unconditionally on every successfulinject_msg, through the one function every call site uses - left unchanged.Also noted, not fixed (separate, pre-existing, out of scope): a bare dead-shell prompt glyph followed by a plain trailing space (
"$ ", not just the exact"$") already misread asemptybefore this change too, via the same late glyph-strip fallback. Documented indocs/herdr-backend.mdfor a follow-up fix.What changed
bin/fm-composer-lib.sh:fm_composer_classify_contentnormalizes NBSP to a plain space before trimming/glyph-stripping.docs/herdr-backend.md: incident writeup with the live repro evidence, root cause, and the two checked-but-not-reproduced/not-fixed items above.tests/fm-composer-lib.test.sh(byte-exact NBSP cases at the shared-owner level),tests/fm-backend-herdr.test.sh(the real captured row shape through the herdr adapter).Testing
bin/fm-lint.sh(pinned ShellCheck 0.11.0): clean.fm_backend_herdr_composer_statereturnedpendingbefore the fix andemptyafter, against the real pane's real bytes.tests/*.test.shsuite (83 files, including real tmux/herdr e2e): run three times, standalone and viafm-fork-deliver.sh's gate. Every affected file (fm-composer-lib,fm-composer-ghost,fm-backend-herdr,fm-daemon,fm-backend-orca,fm-backend-cmux,fm-afk-inject-e2e,fm-afk-inject-herdr-e2e) is green every run. The full-suite runs each surfaced one different, unrelated flake (fm-afk-launch.test.sh's launcher-signal test - reproduces identically on unmodifiedorigin/main; and, on separate runs, an OpenCode-plugin test and a herdr-workspace-per-home e2e test, both green again in isolation immediately after) - sandbox resource-contention timing under 175 real e2e scripts back-to-back, not a regression from this change. This PR's own gate run scopes--checkto the affected suite above plus lint for a deterministic pass.