Repository navigation
fix: make composer detection ignore Claude ghost text - #59
Merged
Merged
Conversation
claude renders a predicted-next-prompt suggestion as dim/faint (ANSI SGR 2) text inside an otherwise-empty composer. A plain tmux capture cannot tell it apart from human-typed text, so firstmate misread an idle composer as holding pending input. Two prongs: 1. Disable at the source. Launch every claude crewmate and secondmate with CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false (per-launch env prefix in fm-spawn.sh, scoped to firstmate-launched agents; never touches the captain's global config). The CLI --prompt-suggestions flag is print/SDK-mode only and does NOT suppress the interactive ghost text (verified empirically on v2.1.186), so the env var is the correct control. 2. Make the reader ghost-text-aware (defense in depth, any harness). The composer reader captures only the cursor line WITH ANSI styling, drops dim/faint runs (new fm_tmux_strip_ghost), and classifies what is left, so only normal-intensity typed text counts as pending input. The styled capture is internal to the boolean detector; fm-peek and every human/LLM-facing path stay plain capture-pane with no escape codes. Tests: new tests/fm-composer-ghost.test.sh covers the dim-stripper, a dim-ghost-only composer reading as not-pending (incl. bordered), normal text still pending, and an escape-free fm-peek path; the wake-queue fake tmux honors the single-line band capture. Verified end to end against real tmux + claude.
augustomklee
added a commit
to augustomklee/firstmate
that referenced
this pull request
Jun 24, 2026
Port upstream batch 2: away-mode reliability (kunchenguid#54) + Claude ghost text (kunchenguid#59)
leo1oel
added a commit
to leo1oel/nemo
that referenced
this pull request
Jun 24, 2026
… to herdr (#1) Port two upstream changes onto the herdr backend: - kunchenguid#61 self-update: bin/fm-update.sh fast-forwards the firstmate repo and every secondmate home from origin, fast-forward-only with fm-fleet-sync safety (never force/merge-commit/stash; skip dirty/diverged/offline/wrong-branch). Secondmate homes are herdr worktrees on lease branch secondmate-<id> rather than detached-HEAD treehouse leases, and nudges target fm-<id> (herdr pane). Adds the /updatefirstmate skill, AGENTS.md section 12, README entries, and tests/fm-update.test.sh. - kunchenguid#59 ghost text: launch claude with CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false and make fm-herdr-lib.sh capture `herdr pane read --format ansi` then strip dim/faint (SGR 2) runs before border-aware classification, so Claude's predicted-prompt ghost text never reads as pending input. The styled capture stays internal; fm-peek stays plain. Adds tests/fm-composer-ghost.test.sh.
This was referenced Aug 9, 2026
This was referenced Aug 10, 2026
This was referenced Aug 11, 2026
This was referenced Aug 11, 2026
This was referenced Aug 12, 2026
This was referenced Oct 7, 2026
Diagnosis (facts vs hypotheses)The cause below is the likely one, not proven on a real iPhone. Facts:
Hypotheses:
Fix: after the upload, a sheet shows a real link "Mở Thermer để in"; the tap on it is the navigation. Adds a "Đang gửi lệnh in..." toast and an expiry message. The one extra tap is deliberate. Please try it on a real iPhone. If Thermer still does not open, suspect (d). |
fritznoff
pushed a commit
to fritznoff/starship
that referenced
this pull request
Nov 2, 2026
kunchenguid#59) * fix: restore stock macOS Bash 3.2 brief scaffolding Hand-port upstream 514f0ab while preserving the fork's brief and lint contracts. * fix(bin): normalize relative durable paths Hand-port upstream 6ec5e08 into the fork's spawn, lock, X-mode, and isolated-secondmate paths. * fix(bin): allow session-local todo tools in the subagent guard Hand-port upstream 7cbb3f6 while retaining the fork's tracked status-line boundary and exact delegation guard. * test: replace temp-root source assertions with behavioral coverage Adapt upstream a2d5f26 by moving GOTMPDIR coverage through the real spawn interface. Retain fork capability tests and shard ownership that upstream deleted because they protect declared fork-surface contracts. * fix(bin): preserve full task contract in no-mistakes intent Hand-port upstream 68641a3 into the fork's generated no-mistakes brief without changing faster delivery paths. * fix(bin): parse punctuated secondmate registry entries safely Adapt upstream 1e24757c8e394532579a3ac0d43fe87dddc626b0 around this fork's isolated secondmate homes. Centralize suffix parsing and binding validation while preserving seeded-home, operational-directory, and cleanup boundaries. * test: register and tighten the secondmate parser adaptation Declare the converged upstream 1e24757 surface, preserve established nested-home refusal wording, and keep the touched snapshot script ShellCheck-clean. * fix(bin): scope registry defects to the entry under validation Add a scoped validation mode so a defect in one secondmate registry entry stops only that entry, and keep strict mode for a deliberate whole-registry audit. A malformed or unresolvable line for an unrelated secondmate must never abort spawning or tearing down a healthy one, and only the duplicate and overlap checks the expected entry genuinely takes part in can refuse it. Tolerate an absent binding in scoped mode and report it through SECONDMATE_REGISTRY_MATCH_FOUND, so a caller holding other proof of ownership can still reach guarded cleanup. A binding that exists but points elsewhere still refuses in either mode. Name a refused symlinked registry as its own condition instead of returning the same empty result as an unregistered id, so read paths can report the real cause. Trim trailing whitespace from every parsed field, which the parsers this library replaced all did, and resolve paths inside a subshell so the caller's working directory is never relocated. Collapse the ten repeated temp-directory removals into one cleanup owned by the entry point. * fix(bin): consolidate the durable path normalizer behind one owner Five near-identical copies of the relative-path normalizer had drifted across brief, spawn, afk launch, and bootstrap, all spelling the same resolution and the same operator diagnostic. Give them one owner in bin/fm-path-lib.sh, keep that diagnostic byte-identical because three test files assert on it, and keep bootstrap reporting through its own arm-failed path rather than exiting. Normalize FM_HOME in teardown through the same owner. The registry isolation check resolves that home with a resolver that refuses a relative path, so a relative FM_HOME refused every guarded secondmate and child home removal - the exact bug class this batch exists to close. Resolve inside a subshell so no caller's working directory is relocated, and declare the new fork-only path in fork-surface.conf. * fix(fork-surface): point the normalizer capability at its landed commit The declaration was written alongside the implementation and briefly referenced an amended-away commit, which resolves as a dangling object but is not in this branch's history and would rot exactly like the stale pre-merge refs already corrected on the default branch. Point it at the commit that actually carries bin/fm-path-lib.sh. * fix(bin): stop unrelated registry entries blocking spawn and teardown Spawn and teardown validated the whole secondmate registry and refused on the first defect anywhere, so one malformed or unresolvable line for an unrelated secondmate aborted work on a perfectly healthy one. That changes which worker runs the captain's work and strands guarded cleanup. Both now validate in scoped mode: defects of the entry being acted on still refuse, along with the duplicate and overlap checks that entry genuinely takes part in. Validate a nested secondmate against its parent home's own registry rather than the top-level one. Nested entries are only ever registered in the parent, and teardown already reads that file, so a forced teardown of a secondmate owning a nested secondmate refused with a binding it could never have found. Tolerate an absent binding when the on-disk marker has already proved ownership, so a home deregistered early or orphaned by a partial decommission stays removable through the guard instead of only by hand. Source the registry library explicitly in spawn and update instead of relying on fm-ff-lib.sh pulling it in, and drop the unreachable projects default. * fix(bin): name a refused registry symlink without changing its established wording Keep the operator-facing "unavailable or unsafe" phrasing the seeding tests assert on, and append the actual cause so a symlinked registry is no longer indistinguishable from a missing one. Link the libraries teardown really sources into both fake-root fixtures. The path library is new, and the busy library has been a transitive requirement of the tmux adapter since kunchenguid#51, so without them the teardown subprocess failed before reaching the behaviour under test. Drop the fakebin and backends scaffolding, which nothing writes into now that the adapter is an inline stub. * fix(bin): report a refused registry symlink on every read path The shared lookup refuses a symlinked secondmate registry, which is right, but three read paths had no error branch and turned that refusal into silence: the live-secondmate listing and the nudge retry both fell through as "no home", and backlog handoff reported that the secondmate had no home at all. An operator who symlinked the registry saw every secondmate look unregistered with nothing naming the real cause. Each read path now distinguishes a refused registry from an unregistered id and says which one it hit. The listing reports once per listing rather than once per secondmate. A silent wrong answer is the failure class this fleet never accepts. * test: restore the lint severity contract and stop leaking task temp roots The canonical-set refactor dropped the two guards that kept bin/fm-lint.sh from lowering severity below the CI default or blanket-excluding checks CI enforces, and put nothing in their place. Prove that contract through the real lint interface instead of grepping the owner's source: a fixture carrying a default-severity finding must still fail, and must still name it. Follow symlinks when building the expected inventory. The owner globs those directories and a glob includes symlinked scripts, so plain -type f would false-fail as soon as a symlinked test is added - a pattern this suite already uses elsewhere. Derive the task temp root from the meta value spawn publishes rather than repeating spawn's own spelling, so a directory left by an earlier failed run cannot make the assertion pass spuriously. Clear every spawn's root from one exit trap: the leak was suite-wide, not confined to the three cases that lacked an explicit cleanup line. * fix(bin): give the snapshot one registry grammar and stop conflict probes failing open The fleet snapshot carried a second, hand-maintained copy of the registry suffix grammar that had already drifted from the shared parser: it accepted a looser id charset and an empty scope, so lines the parser rejects were reported as healthy bindings while every other consumer refused the registry. Feed jq records the shared parser produced instead, and report a line it rejects as malformed rather than as a home. Separate "no conflict found" from "registry entry is malformed" in the home assignment probes. Both returned 1, and the callers gate on empty output, so a malformed registry read as a clean bill of health and skipped the duplicate-home and duplicate-id guards entirely. * test: cover the scoped-validation and shared-grammar rulings Prove the behaviour the rulings settled rather than the shape of the code. A healthy secondmate still tears down when unrelated registry entries are malformed or point at a vanished home. A home whose registry entry was already removed is still removable once its on-disk marker proves ownership, while a binding that exists and points elsewhere still refuses and says so. The fleet snapshot and the shared parser agree on entries the parser rejects, so a bad id or an empty scope can no longer surface as a healthy home in one consumer while every other one refuses it. * fix(fork-surface): repoint capability refs at their rebased commits Rebasing onto the current default branch rewrote the two commits this batch's capability entries named, leaving them pointing at objects that are no longer in this branch's history. They still resolve while the old objects survive, so the check stays green and the rot is invisible - the same stale pre-merge reference class already corrected on the default branch. Point both at the commits that actually carry the declared paths. * no-mistakes(review): name refused registry symlinks on every read path * no-mistakes(document): docs: cover new path and registry libs, teardown normalization
fritznoff
pushed a commit
to fritznoff/starship
that referenced
this pull request
Nov 18, 2026
…red files (kunchenguid#59) * refactor: give the fork its own registries beside upstream's shared files Every catch-up from upstream conflicted in the same shared files because fork features added lines inside them. Move the fork's lines into fork-owned files reached through one stable hook, pointer or row each: - bin/fm-test-run.sh: the fork's measured CI timing hints, parallel lane packing and serial shard count now live in tests/fork-test-timing.conf, which bin/fm-fork-test-registry-lib.sh applies as an overlay after the runner defines its own tables (a fork hint wins for its script, upstream hints for other scripts pass through). Fork-only family and changed-path rows moved into tests/fork-test-registry.conf. Selection, scheduling and --check-coverage output are unchanged. - docs/configuration.md and docs/scripts.md: fork sections and rows move to docs/fork-configuration.md and docs/fork-scripts.md, linked from one row each; references repointed. - operational-home-layout skill: fork layout lines move to fork-layout.md beside it, named once from the skill. - bin/fm-bootstrap.sh: the fork's diagnostics (HOST_ENV, ACCOUNTS, TOOLCHAIN_DRIFT, UPSTREAM, UPSTREAM_REPORT/CATCHUP, STACK_TOOLS) run as built-in hooks/bootstrap hooks, and its local upkeep (opt-in skill links, pre-push leak check, Mothership arming) as hooks at a new bootstrap-sweep point; each hook's header owns its lines. * no-mistakes(review): Scope bootstrap-sweep to built-ins and raise its bound * no-mistakes(review): Widen bootstrap hook bounds, test two moved hooks * no-mistakes(document): Correct fm-addon bootstrap hook bound and env notes * no-mistakes(ci): I kept the two edits the timed-out agent left uncommitted; both are sound. One check (Declared fork surface) needed a registry row, one (Behavior portable serial 4) needed a narrower test assertion, and the other two (wsl floater, Full suite) need no code change. No product behaviour changed. 1. **Declared fork surface.** Rule that broke: every path this PR changes must map to a test suite. The new `.agents/skills/operational-home-layout/fork-layout.md` didn't, because the runner only maps `SKILL.md` in that folder. Fix: a `covers` row in `tests/fork-test-registry.conf` pointing it at `tests/fm-documentation-audiences.test.sh`. That suite runs the real audience check, which classifies this file and checks its local links (it is listed in `docs/documentation-audiences.json`). The other new docs, `docs/fork-configuration.md` and `docs/fork-scripts.md`, were already handled by the runner's existing rules. Results: - `bin/fm-test-run.sh --list --changed --base cbe7fee` now exits 0, so every changed path maps. - `bin/fm-fork-surface.sh check` prints `FORK_SURFACE OK capabilities=101 owned_paths=380`. - All four cases in `fm-documentation-audiences.test.sh` pass. 2. **Behavior portable serial 4.** Rule that broke: when an add-on carries its own copy of the intake hooks, the built-in intake hooks must not also run. In `tests/fm-channel-intake.test.sh`, the test for this ("a built-in intake hook still runs beside the add-on's") failed on any built-in under `hooks/bootstrap/`. This PR moves other built-in checks into that folder (01 to 06), so it tripped on those. It now looks only for the two built-in intake hooks, `10-morning-intake` and `20-channel-intake`, so it still proves the add-on replaces them. The full suite exits 0; the last lines show the add-on case passing and no failures. 3. **wsl floater.** No code change. The GitHub job record shows "Set up job" and checkout passed, then the job stopped during "Install Ubuntu 24.04 in WSL 2"; no later step ran. Per the run notes, that was the 45m job cap, which is a hosted-runner infrastructure problem. 4. **Full suite** only collects the other lanes' results, so it should pass once they do. I ran nothing else locally * no-mistakes(document): Point fm-factory header at fork configuration * docs: point main's new Mothership links at the fork configuration page * no-mistakes(document): Point moved-section code comments at fork config
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
Make firstmate's crewmate/secondmate launches and pane-reading robust to Claude Code's autocomplete 'ghost text'. claude renders a predicted-next-prompt suggestion as dim/faint (ANSI SGR 2) text inside an otherwise-empty composer; a plain tmux capture cannot tell it apart from human-typed text, so firstmate misread an idle composer as holding pending input and could fire phantom Enter keys / misjudge crewmate state.
Two prongs, both intentional:
Disable at the source. The claude launch template in bin/fm-spawn.sh now prefixes CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false, covering every firstmate-launched claude crewmate AND secondmate (both use launch_template('claude',...)). Deliberate decision: I empirically verified on Claude Code v2.1.186 that the documented --prompt-suggestions CLI flag does NOT suppress the INTERACTIVE composer ghost text (it is print/SDK-mode only - it still rendered a dim prediction with the flag set), whereas the env var CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false reliably suppresses it (verified clean across many turns). So I intentionally used the env var instead of the CLI flag the task text suggested. It is a per-launch env prefix scoped to firstmate-launched agents only and never touches the captain's global config (constraint).
Make pane-reading ghost-text-aware (defense in depth, any harness). bin/fm-tmux-lib.sh gains fm_tmux_strip_ghost: it captures only the composer cursor line WITH ANSI styling (tmux capture-pane -e, bounded to a single row via -S/-E), drops dim/faint (SGR 2) runs, then strips remaining escapes, leaving only normal-intensity text. fm_tmux_composer_state now runs the captured line through it before the existing border/glyph/whitespace classification, so a composer holding only dim ghost text reads as empty/not-pending while normal-intensity typed text (incl. bold) still reads as pending. Deliberate token-safety design (captain constraint): capture-pane -e is INTERNAL to this boolean detector only and bounded to one line; raw escape bytes are never surfaced or logged; fm-peek and every other human/LLM-facing capture path stay plain capture-pane.
Docs: AGENTS.md section 4 (claude adapter) documents both the launch env var and the dim-aware reader, each sentence on its own line.
Tests: new tests/fm-composer-ghost.test.sh (dim-stripper unit cases incl. combined SGR / ESC[22m boundary / reset-then-dim; dim-ghost-only composer not-pending incl. bordered; normal text still pending; real-text-plus-trailing-ghost still pending; an escape-free fm-peek assertion). tests/fm-wake-queue.test.sh's fake tmux was updated to honor the new single-line band capture (-S N -E M) so existing composer tests still index by cursor_y. All tests pass and shellcheck is clean. Also verified end-to-end against real tmux + a live claude: the dim-aware reader returns empty/not-pending on a genuine ghost composer and pending on real typed text.
No em dashes per the captain's style preference.
What Changed
Risk Assessment
✅ Low: Captain, the change is narrow, the earlier SGR parsing regressions are addressed, and I did not find material correctness or safety issues in the diff or shared call paths.
Testing
Captain, I ran the bootstrap check, targeted ghost/composer/spawn/supervisor/secondmate tests, then captured real tmux pane evidence and claude launch-command evidence; everything passed, the worktree stayed clean, and no transient worktree artifacts were left behind.
Evidence: Real tmux ghost composer evidence
Evidence: Claude launch template evidence
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed (2) ✅
bin/fm-tmux-lib.sh:70- Captain, this treats any SGR parameter equal to2as faint, but2also appears inside normal color sequences likeESC[38;5;2mand truecolorESC[38;2;...m. A colored composer line can therefore setdim=1and strip real typed input until reset, causingfm_pane_input_pendingto report empty and allowing injection or Enter over user text. Parse SGR parameters with 38/48 color payloads skipped before applying intensity codes.🔧 Fix: Captain, preserve SGR-colored typed input
1 warning still open:
bin/fm-tmux-lib.sh:63- Captain, the SGR scanner still only consumes digits and semicolons, and the color-payload skip only covers 38/48. Valid styled output with colon subparameters or underline color, such asESC[58::5::2morESC[58;5;2m, can either leak:5::2minto the composer text or treat the payload2as faint. That can make an idle styled composer look pending, or strip real typed input in the semicolon form. Consume CSI parameters through the final byte and skip 38/48/58 color payload forms before applying intensity codes.🔧 Fix: Captain, harden SGR color parsing
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
FM_FLEET_PRUNE=0 bin/fm-bootstrap.shtests/fm-composer-ghost.test.shtests/fm-spawn-batch.test.shtests/fm-wake-queue.test.shtests/fm-afk-inject-e2e.test.shtests/fm-secondmate.test.shManual evidence capture: real tmux panes with dim SGR ghost text, normal typed text, bordered ghost text, and mixed real-plus-ghost text classified throughfm_tmux_composer_stateandfm_pane_input_pending.Manual evidence capture:fm-spawn.shwith fake tmux verified both ship and secondmate claude launch commands includeCLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.