Skip to content

fix(bin): stop tmux target checks reporting gone windows as alive - #7409

Merged
kunchenguid merged 5 commits into
kunchenguid:mainfrom
LiamSarsfield:fix/contrib-target-exists-1130-f72
Oct 16, 2026
Merged

kunchenguid merged 5 commits into
kunchenguid:mainfrom
LiamSarsfield:fix/contrib-target-exists-1130-f72

Conversation

@LiamSarsfield

@LiamSarsfield LiamSarsfield commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #1130.

The tmux presence check now answers from exact membership instead of trusting display-message, which can silently fall back to another window after the requested one disappears. Every documented target form is defined once in the fm_backend_target_exists header and docs/configuration.md. The key-send path now refuses a gone window rather than typing into a prefix-named neighbour. Test fakes now model the windows they create, kill, and respawn. PR #2903 took the same exact-membership approach but went stale against main.

tests/fm-live-lab.test.sh also gains a one-line cleanup guard, so running it on a machine with a live default tmux server no longer kills that server after the private lab directory is removed. This overlaps #6902 and can be dropped if #6902 lands first.

Not changed here

fm_backend_tmux_agent_state still reads a bare session without exact anchoring; later tmux commands can still misaddress dotted window names; the typed-text send path is not gated; and fm-teardown's no-lsof #{pane_pid} fallback still reads without a membership check, tracked in #5806.

Validation

No-mistakes completed Review, Test, Document, Lint, Push, and PR creation; CI was intentionally skipped for this run. Review required one fix for dotted task ids, which was applied and re-reviewed. Live validation exercised 11 of 13 product scenarios on a private tmux 3.7b lab, including killed windows, missing sessions, prefix neighbours, dotted task ids, daemon checks, session-start, fleet snapshots, crew state, key delivery, and a real Claude interrupt. The real-tmux smoke test also passed.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 3 warnings
  • ⚠️ bin/backends/tmux.sh:215 - The .pane fallback added to fm_backend_tmux_target_exists brings back the issue-1130 false positive for task ids that contain a dot. fm_task_id_path_safe (bin/fm-pr-lib.sh:104) allows ., so v1.0 is a valid id and its window is fm-v1.0. Failing sequence: firstmate:fm-v1.0 is gone while task v1's window fm-v1 is alive. The whole-name inventory misses fm-v1.0, the *.* branch splits on the last dot into base fm-v1 and pane 0, finds pane 0 of the live fm-v1, and reports the target present. I reproduced this on a private tmux 3.7b socket: fm_backend_target_exists tmux s:fm-v1.0 returned present after fm-v1.0 was killed, and fm_backend_tmux_send_key s:fm-v1.0 x passed its guard while tmux routed the key to fm-v1. Every consumer of the predicate sees the same wrong answer:
  • bin/backends/tmux.sh:56: the send_key guard passes, so the key reaches the neighbor.
  • bin/fm-crew-state.sh:322: pane_readable reports readable, so the missing/dead classifier is skipped.
  • bin/fm-fleet-snapshot.sh:662: endpoint_exists=true.
  • bin/fm-busy-lib.sh:1184: no dead endpoint-gone.
  • bin/fm-session-start.sh:592: endpoint: alive.
  • bin/fm-supervise-daemon.sh:1470, 1896 and 1964.
  • bin/fm-send.sh:426: the explicit-target check.
  • bin/fm-control.sh:552: the post-interrupt check.
    By contrast, fm_backend_tmux_agent_state (bin/backends/tmux.sh:418) does a whole-line match with no pane fallback and correctly reports missing. No in-repo producer builds a session:window.pane target: meta window= is session:name, the supervisor default is firstmate:0, and TMUX_PANE is %N. Only a hand-written FM_SUPERVISOR_TARGET or an explicit fm-send target can use it. The smallest honest remedy is to remove the .pane fallback component. That drops a spelling users could previously pass, so the user should decide. Related pre-existing issue for a follow-up: tmux's own grammar splits at the first dot, so kill-window -t =s:=fm-v1.0 in fm_backend_tmux_kill (bin/backends/tmux.sh:267) kills fm-v1 when both windows exist (verified).
  • ⚠️ bin/backends/tmux.sh:56 - The change turns fm_backend_tmux_send_key's ignored display-message preflight into a hard exact-membership gate. That changes the tmux write path, which the intent says is not where the defect is: "send-keys ... fail on those targets, so the defect is in presence and read paths only". It now gates every tmux key send: fm-send --key and the post-interrupt clear (bin/fm-send.sh:286, 785), fm-control's interrupt, hazard and clear keys (bin/fm-control.sh:443, 477, 488), task-inbox Enter (bin/fm-task-inbox-lib.sh:370, 373) and fm-spawn's launch Enter (bin/fm-spawn.sh:4321). The justification is the prefix-neighbor case: I confirmed on tmux 3.7b that send-keys/capture-pane -t s:fm-t1 reach a live fm-t10. But the guard covers only key sends. Text steers (fm_tmux_submit_core send-keys -l, bin/fm-tmux-lib.sh:315), fm_backend_tmux_send_text_line and fm_backend_tmux_send_literal (bin/backends/tmux.sh:118, 126) and capture reads (bin/backends/tmux.sh:41, 49) still resolve to the neighbor. The guarded send itself still uses the non-exact -t "$1". No intent requirement needs this component. Per the scope rule the remedy is to remove it; the alternative is that the user explicitly widens the scope to cover prefix-neighbor writes.
  • ⚠️ bin/backends/tmux.sh:190 - Commit d40ae86 added grammar arms that no in-repo producer reaches:
  • bare @window (line 190)
  • session:@window (line 204)
  • the bare exact session (lines 227-231)
  • the =session/=window marker stripping (lines 199-200)
    These forms are documented in bin/fm-backend.sh:955 and docs/configuration.md:532. The producers that actually feed fm_backend_target_exists and send_key are meta session:name, %N from TMUX_PANE, and session:index from FM_SUPERVISOR_TARGET_DEFAULT=firstmate:0. spawn_send_key uses $T, not $WID. The extra arms are reachable only through a hand-written FM_SUPERVISOR_TARGET or an explicit fm-send *:* target. Tradeoff: they keep spellings that display-message accepted before. Removing them narrows a user-facing override, which then fails loudly at daemon startup. The intent does not require them, so the user should either confirm keeping them for compatibility or remove them, leaving the strictly required set of session:name, session:index and %pane.
  • ⚠️ bin/fm-teardown.sh:2233 - A sibling read path still has the issue-1130 display-message fallback, and the change does not cover it. reap_task_backend_process_group reads tmux display-message -p -t "$T" '#{pane_pid}' with no membership check. It runs when lsof is unavailable, before the endpoint kill at line 3635. If the task window is already gone (a closed window, or a retried teardown), tmux answers with the session's current window. I verified on 3.7b that display-message on a gone target exits 0 and reports main. Teardown then sends TERM, then KILL, to that pane's process group, which could be firstmate's own pane shell or another crew. This code predates the change and is not in the intent's caller list. Fixing it extends scope, so it needs the user's decision; it can be a follow-up. The natural fix is to gate the read on fm_backend_tmux_target_exists. A lower-likelihood sibling: fm_backend_tmux_agent_state reads the inventory with an unanchored session (bin/backends/tmux.sh:408), so a gone session can prefix-match a live one that has a window of the same name.

🔧 Fix applied.
3 warnings still open:

  • ⚠️ bin/backends/tmux.sh:56 - The change turns fm_backend_tmux_send_key's ignored display-message preflight into a hard exact-membership gate. That changes the tmux write path, which the intent says is not where the defect is: "send-keys ... fail on those targets, so the defect is in presence and read paths only". It now gates every tmux key send: fm-send --key and the post-interrupt clear (bin/fm-send.sh:286, 785), fm-control's interrupt, hazard and clear keys (bin/fm-control.sh:443, 477, 488), task-inbox Enter (bin/fm-task-inbox-lib.sh:370, 373) and fm-spawn's launch Enter (bin/fm-spawn.sh:4321). The justification is the prefix-neighbor case: I confirmed on tmux 3.7b that send-keys/capture-pane -t s:fm-t1 reach a live fm-t10. But the guard covers only key sends. Text steers (fm_tmux_submit_core send-keys -l, bin/fm-tmux-lib.sh:315), fm_backend_tmux_send_text_line and fm_backend_tmux_send_literal (bin/backends/tmux.sh:118, 126) and capture reads (bin/backends/tmux.sh:41, 49) still resolve to the neighbor. The guarded send itself still uses the non-exact -t "$1". No intent requirement needs this component. Per the scope rule the remedy is to remove it; the alternative is that the user explicitly widens the scope to cover prefix-neighbor writes.
  • ⚠️ bin/backends/tmux.sh:190 - Commit d40ae86 added grammar arms that no in-repo producer reaches:
  • bare @window (line 190)
  • session:@window (line 204)
  • the bare exact session (lines 227-231)
  • the =session/=window marker stripping (lines 199-200)
    These forms are documented in bin/fm-backend.sh:955 and docs/configuration.md:532. The producers that actually feed fm_backend_target_exists and send_key are meta session:name, %N from TMUX_PANE, and session:index from FM_SUPERVISOR_TARGET_DEFAULT=firstmate:0. spawn_send_key uses $T, not $WID. The extra arms are reachable only through a hand-written FM_SUPERVISOR_TARGET or an explicit fm-send *:* target. Tradeoff: they keep spellings that display-message accepted before. Removing them narrows a user-facing override, which then fails loudly at daemon startup. The intent does not require them, so the user should either confirm keeping them for compatibility or remove them, leaving the strictly required set of session:name, session:index and %pane.
  • ⚠️ bin/fm-teardown.sh:2233 - A sibling read path still has the issue-1130 display-message fallback, and the change does not cover it. reap_task_backend_process_group reads tmux display-message -p -t "$T" '#{pane_pid}' with no membership check. It runs when lsof is unavailable, before the endpoint kill at line 3635. If the task window is already gone (a closed window, or a retried teardown), tmux answers with the session's current window. I verified on 3.7b that display-message on a gone target exits 0 and reports main. Teardown then sends TERM, then KILL, to that pane's process group, which could be firstmate's own pane shell or another crew. This code predates the change and is not in the intent's caller list. Fixing it extends scope, so it needs the user's decision; it can be a follow-up. The natural fix is to gate the read on fm_backend_tmux_target_exists. A lower-likelihood sibling: fm_backend_tmux_agent_state reads the inventory with an unanchored session (bin/backends/tmux.sh:408), so a gone session can prefix-match a live one that has a window of the same name.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 11 of 13 scenarios driven live against the product
Scenario Result Live Evidence
Session-start digest reports a killed task window as endpoint: dead while other windows in its session stay alive ✅ pass live session-start-endpoint-digest.txt: base prints endpoint: alive for lab:fm-gone; new prints endpoint: dead, while lab:fm-live/fm-t10/fm-v1 stay endpoint: alive
Session-start digest reports a task whose whole tmux session is missing as dead while another server session is reachable ✅ pass live session-start-endpoint-digest.txt: ghost:fm-ghostsess is alive on base and dead on new
Fleet snapshot marks gone endpoints exists:false, status:absent and live ones exists:true ✅ pass live fleet-snapshot-endpoint-exists.txt: base all seven exists:true; new gone/t1/v1.0/ghostsess exists:false absent, live/t10/v1 exists:true
fm-crew-state reports a gone window as backend target gone instead of reading another window's pane ✅ pass live crew-state-gone-window.txt: base source: pane for all gone ids; new source: none · backend target gone: <target>; live stays source: pane
fm_busy_classify_live classifies gone tmux targets as dead endpoint-gone (sourced library entry, no bin/ caller) ✅ pass live busy-classify-live.txt: base unknown missing for gone targets; new dead endpoint-gone; live target unchanged
Adversarial: fm-send --key or text to a gone target whose name prefixes a live window never reaches the neighbor ✅ pass live fm-send-prefix-neighbor-keys.txt: new refuses t1 --key Enter and lab:fm-x1 (key and text) with rc=1, and no capture file appears. Base returns rc=0 and writes delivered-to-fm-t10 and `delivered-…
Adversarial (round-1 dotted fix): a gone fm-v1.0 beside a live fm-v1 reads absent and refuses keys, while session:index.pane still works ✅ pass live v1.0 reads dead/absent/target gone/dead endpoint-gone in session-start, snapshot, crew-state and busy classify. fm-send v1.0 --key Enter is refused on new (base delivered it to fm-v1). Daemon refuse…
Away daemon refuses to start on a gone, missing-session, stale %pane or stale @window supervisor target, and still starts on firstmate:0, %0, session:index.pane and session:name ✅ pass live supervise-daemon-startup-target.txt: new rc=1 startup failed for six gone targets (base started on all of them); new daemon starting for all four live targets
Away daemon's runtime loop backs off when the supervisor window is killed while another window in the session lives ✅ pass live supervise-daemon-runtime-target-gone.txt: new logs supervisor target 'firstmate:sup' gone; backing off 1s; base logs no gone line
Every documented live tmux target form still reads present (regression) ✅ pass live target-exists-grammar-table.txt: lab:fm-live, @1, %1, lab:@1, lab, =lab:=fm-live, lab:0, lab:0.0 and firstmate:0 present on new; all gone, stale, missing, session-prefix and malformed forms flip from…
fm-control interrupt on a live tmux task with a real claude agent still delivers its key and passes the post-interrupt existence check ✅ pass live fm-control-interrupt-real-claude.txt: interrupt-delivered cl harness=claude backend=tmux verified=agent-alive rc=0. The Escape reached claude, which then exited at its trust dialog
fm-control's post-interrupt check fails loudly when the endpoint disappears between the interrupt key and the check ⏸️ untested no Needs a deterministic way to make the window vanish between the key send and the check: a timing hook in fm-control, or a stub harness, which the runbook forbids. The check uses the same fm_backend_ta…
Away daemon's inject_msg refuses to inject into a gone supervisor target ⏸️ untested no inject_msg runs only during a live away-mode (state/.afk) escalation flush with a wake worth escalating. Driving it needs a full /afk escalation flow in the lab: an afk contract, a watcher wake and th…
  • Marked lab home via bin/fm-lab-home.sh create, with a tmux shim pinning every bare tmux call to -f /dev/null -L fm-lab and TMUX_TMPDIR=$LAB/tmux. Env scrubbed of NO_MISTAKES_GATE and FM_*_OVERRIDE. Base 5f2b81bc extracted read-only with git archive | tar -x into /tmp for before/after runs
  • Raw root cause on lab tmux 3.7b: tmux display-message -p -t lab:fm-gone|=lab:=fm-gone|lab:fm-t1|lab:fm-v1.0|ghost:fm-ghostsess all exit 0 and report a live window
  • bin/fm-session-start.sh (NEW and BASE) with seven task metas: live, gone, prefix-neighbor t1/t10, dotted v1.0/v1, missing session
  • bin/fm-fleet-snapshot.sh --json (NEW and BASE), extracting endpoint.exists/endpoint.status per task
  • FM_CREW_STATE_NO_FORGE=1 bin/fm-crew-state.sh <id> for live/gone/t1/v1.0/ghostsess (NEW and BASE)
  • fm_busy_classify_live tmux <target> via sourced bin/fm-backend.sh and bin/fm-busy-lib.sh against the lab server (NEW and BASE)
  • bin/fm-send.sh t1 --key Enter, v1.0 --key Enter, lab:fm-x1 --key Enter, lab:fm-x1 <text> with read -r capture readers armed in the live neighbors (NEW and BASE). Positive controls: t10 --key Enter, lab:fm-x10 --key Enter, lab:4.0 --key Enter
  • FM_SUPERVISOR_BACKEND=tmux FM_SUPERVISOR_TARGET=<t> timeout -s TERM 5 bin/fm-supervise-daemon.sh for lab:fm-gone, ghost:fm-x, %2, @2, lab:fm-t1, lab:fm-v1.0, firstmate:0, %0, lab:0.0, firstmate:primary (NEW and BASE)
  • Daemon runtime guard: started with FM_SUPERVISOR_TARGET=firstmate:sup FM_INJECT_FAIL_SLEEP=1, killed =firstmate:=sup, read state/.supervise-daemon.log (NEW and BASE, fresh lab)
  • bin/fm-control.sh cl interrupt against a real claude CLI running in lab window fm-cl (trust dialog never accepted)
  • fm_backend_target_exists tmux <target> grammar table over 21 live/gone/stale/malformed targets (NEW vs BASE)
  • bash tests/fm-backend-tmux-smoke.test.sh (existing real-tmux private-socket test)
  • Teardown: tmux kill-server through the shim, process check, rm -rf of lab, shim and base dirs; git status clean
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid
kunchenguid merged commit aa9ab04 into kunchenguid:main Oct 16, 2026
20 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @LiamSarsfield — really appreciate you taking the time on this.

witt3rd added a commit to witt3rd/firstmate that referenced this pull request Oct 21, 2026
* feat: let a home declare authoritative external memory tiers (#6608)

* docs: let a home declare authoritative external memory tiers

AGENTS.md section 6 routed durable knowledge only to firstmate-local files,
so a home whose captain keeps reasoning and facts in external stores had no
tracked rule keeping those stores authoritative over the per-machine data/
cache. Add a generic home-declared Memory layering contract (schema in
docs/configuration.md), make firstmate the capture path for workers whose
harness cannot reach a declared tier, and teach the stow skill to route to
declared tiers first and never prune a tier-owned entry without capturing it.

* no-mistakes(review): Report missing memory-layering declaration and index tier docs

* no-mistakes(document): Narrow memory-tier re-seed step to captain re-declaration

* no-mistakes(ci): Environment: 2026-10-05, host wildrobot, Linux 7.0.0-34. Finding ci-1 (Greptile): a tier-owned fact could be lost when its declared tier was unreachable from the session. - The invariant that was broken: until the declared tier holds a tier-owned fact, that fact must stay in a memory file loaded at startup. - Where it could be broken: the declared-tier guard, which said to archive the entry to the never-loaded cold tier; the routing step for new findings, which only mentioned the receipt; and the budget-eviction and offload eligibility rules. Fix, made only in .agents/skills/stow/SKILL.md: - **New marker.** Added `<!--t:NAME-->` to the existing compact marker list, so its meaning lives in one place. It marks a tier-owned entry that tier NAME does not hold yet. Stow never prunes, ages out, evicts, offloads, consolidates away, or archives an entry carrying it, whatever its tier clock says. A later pass that can reach NAME captures the entry there and removes the marker. - **Declared-tier guard.** "still archive rather than delete" now says to leave the entry in place with its pending-capture marker, and the receipt still names it. - **Routing step 2.** When the tier is unreachable, a new finding is written to the startup-loaded local file its class would otherwise use, or kept where it already lives, with the marker. It is still reported as an exception in the receipt. - **Budget eviction and offload eligibility.** Both now exclude entries pending capture, so the convergence pool is counted correctly. - **Receipt bullet.** Changed "finding or pruned entry" to entries left carrying the pending-capture marker, because those entries are no longer pruned. docs/configuration.md ("protects tier-owned entries from pruning") and AGENTS.md section 6 are still accurate, so I left them unchanged. No new file, queue, script, or digest section. One sentence per line, plain dashes. Verification: tests/fm-stow-cascade.test.sh, tests/fm-documentation-audiences.test.sh, and tests/fm-lint.test.sh all pass

* docs: keep undeclared memory-tier path silent and close stuck tier markers

Drop the stow receipt line reporting a missing Memory layering declaration
(AGENTS.md section 6, the stow skill, docs/configuration.md) so a home with
no declaration behaves exactly as before. Name pending-capture entries in the
exempt floor wording, and say how stow retargets or clears a pending-capture
marker whose tier was renamed or retired.

* fix: keep unsupported contribution URLs unmeasured (#7233)

* fix: keep unsupported contributions unmeasured during polling

* no-mistakes(document): Clarify unsupported contribution polling documentation

* no-mistakes(review): Match literal GitHub hostname and cover unsupported lookalikes

* no-mistakes(review): Separate durable ownership compatibility from GitHub observation eligibility

* no-mistakes(document): Clarify unsupported contribution coverage and ownership compatibility

* fix(bin): keep inherited Git config entries when installing the trailer-strip hooks path (#6341)

* fix(bin): keep inherited Git credential helpers when installing the trailer hooks path

Problem:
Every fleet launch prefixed the worker command with `export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=...`.
That replaced any `GIT_CONFIG_*` entries the pane already carried, so a scoped HTTPS credential setup such as `credential.helper=` followed by `credential.helper=!gh auth git-credential` was silently dropped.
Git then fell back to the system or global helper (for example `osxkeychain` from the system gitconfig on macOS), so a worker meant to use a scoped token pushed with the user's personal credentials.

Reproduction on main:
GIT_CONFIG_COUNT=2 GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= GIT_CONFIG_KEY_1=credential.helper GIT_CONFIG_VALUE_1='!gh auth git-credential' sh -c "<emitted launch>; git config --get-all credential.helper" prints none of the inherited entries, only the system helper (`osxkeychain` from Homebrew's system gitconfig on the reporting machine).

Fix:
The launch prefix now appends `core.hooksPath` at index `GIT_CONFIG_COUNT` and increments the count, resolved in the destination shell after any `config/launch-env-allowlist` filtering.
The inherited count is validated as decimal before shell arithmetic, leading zeros are normalized (Git accepts `02`), and a count that cannot be extended within Git's signed int refuses.
A refusal uses `return 1 2>/dev/null || exit 1`, so when the pane sources the launch file the error stays visible and the interactive shell survives instead of the pane dying with the message.

Tests:
`tests/fm-spawn-dispatch-profile.test.sh` gains a behavior test that runs the real emitted launch under sh, bash, and zsh with inherited credential-helper entries and counts `2` and `02`, then asks Git for `credential.helper` and `core.hooksPath`.
The same test checks that an invalid or overflowing count refuses, and that sourcing the launch file from an interactive shell keeps that shell alive with the error visible.
The exact-launch assertions in the dispatch-profile and Kimi suites now extract the emitted prefix through one `fm_test_launch_git_prefix` helper in `tests/lib.sh` instead of two hand-copied strings, whose content the behavior test covers.

Risk:
Top-level `return` outside a sourced file is unspecified by POSIX; verified on macOS sh (bash 3.2 in POSIX mode), bash, and zsh, and every path still ends nonzero before the worker command runs.
The hook wrapper still unsets only `GIT_CONFIG_COUNT` and index 0, which is sufficient because Git ignores indexed entries once the count is unset.
A launch that forwards `GIT_CONFIG_COUNT` without all of its indexed keys now fails in Git instead of being masked by the overwrite.

* no-mistakes(review): Keep inherited Git config in hooks and fish-safe launch

* no-mistakes(document): docs: describe appended hooksPath keeping inherited Git config

* test: run the fish pane launch cases in CI

Install fish in the portable serial lane and run the credential-append
and invalid-count refusal cases under fish. Under CI the spawn test
fails instead of falling back to the static syntax check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: strip the Git config launch prefix before reading the Claude doorbell

The trust suite evaluated the whole launch command to find the final prompt
argument, so it now also sourced the per-spawn git-config env file that the
fake pane never writes. Drop that prefix the same way the dispatch suite does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: share the launch command parser across the spawn suites

The trust suite failed in CI because its copy of the launch parser missed
the Git configuration prefix the dispatch suite's copies already stripped.
Move the prefix and export stripping into tests/lib.sh next to
fm_test_launch_git_prefix so the three parsers cannot drift again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(bin): canonicalize env-file hooks path and tighten launch-config tests

env-file now writes the canonical (pwd -P) spelling of the hooks directory, matching what install records, so a symlinked path no longer makes the hook wrapper miss its own entry and silently skip the repository's hook.
A new strip test passes a symlinked hooks path through env-file and fails without this change.

The launch-env-allowlist test now also asserts the appended core.hooksPath, so a regression that drops the strip-hook entry only on the env -i path is caught.

Without fish installed locally, the launch test now prints an explicit fish skip line and limits its pass message to sh, bash and zsh, instead of claiming every pane shell after only a static token check.

* no-mistakes(review): Drop CI fish install and CI-only fish refusal

* no-mistakes(document): Document GIT_CONFIG_COUNT overflow refusal in configuration docs

* test: prove a refused Git config count never starts the worker

The invalid-count refusal checks only asserted a nonzero status and the helper's own error text.
If the launch line kept going after the refusal, the worker probe's final `git config` also failed under the bad count, so the checks still passed.
The probe now prints a marker on stderr, and every refusal case in sh, bash, zsh and fish asserts the marker never appears.
Dropping the `|| return 1 2>/dev/null || exit 1` guard from the launch line now fails the test.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(bin): name the failing step when a contribution observation is unavailable (#6810)

* fix(bin): name the failing read when a contribution observation is unavailable

An unavailable contribution observation recorded one constant error and
discarded the failing read's exit status and error output on cleanup, so a
network failure, a forge refusal and a structural check failure all looked
the same and left nothing to diagnose once the next good read cleared it.

The record's error and the unavailable line now name the first failing step:
the read's label, exit status, budget seconds left and the first line of its
error output, or the structural check that refused the observation. Budget
refusal stays silent and unmeasured as before.

* no-mistakes(review): Label closing head read's structural failure as its own cause

* no-mistakes(document): Note structural refusals record contribution errors too

* fix(spawn): scope Orca worker launch env to an opt-in tmux session (#6365)

* fix(spawn): give Orca workers an opt-in scoped environment source

Fixes #6339

On the Orca backend, `config/launch-env-allowlist` expands each allowlisted name in the destination pane, and that pane is an Orca terminal whose environment comes from the Orca app and the user's shell startup files.
Allowlisted credentials therefore resolve to the user's personal values or to nothing, with no warning, while the same allowlist scopes tmux workers correctly.

Add an opt-in `config/launch-env-tmux-session` naming one tmux session.
On a fresh Orca spawn, before the worktree or terminal is allocated, fm-spawn reads each allowlisted name from that session's local environment with `tmux -u show-environment -t =<session> <name>`.
The worker launches with the existing `env -i` boundary and operational floor, the snapshotted values in place of destination expansion, and `GIT_CONFIG_NOSYSTEM=1` so a system credential helper cannot answer for the worker.
The source requires an allowlist, so tmux's automatic update-environment names such as `SSH_AUTH_SOCK` are never forwarded unless listed.
A listed name missing from the session, an unreadable session, or a malformed selector refuses before allocation; an explicit `-NAME` record stays a deliberate unset.
Values are shell-quoted only in the existing owner-only staged launch file, never terminal input, and the pane deletes that file as sourcing starts; a deletion failure refuses the worker launch and keeps the interactive shell.
`-u` is required because tmux's non-UTF-8 client output replaces newlines and non-ASCII bytes in values with underscores.

The source is opt-in and nothing changes for homes that do not create the file.
When `config/backend` is orca, the allowlist is nonempty, and no source is configured, fm-spawn now prints a stderr warning that allowlisted names resolve from the Orca terminal, so the mismatch is no longer silent.
It warns rather than refuses because refusing would stop every existing Orca home that uses an allowlist, which the triage asked not to assume.
Other backends, relaunch (already refused on Orca), and secondmate inheritance are unchanged; the selector is not in the inherited configuration list.

The scoped Git credential helper case also needs #6341, which stops fm-spawn's `core.hooksPath` entry from overwriting inherited `GIT_CONFIG_*` entries; this change does not depend on it.

Tests in `tests/fm-spawn-orca-worktree.test.sh`:

- A real-tmux regression on a private socket checks exact multiline UTF-8 values under absent and C locales through sh, Bash, and zsh, refusal of names that exist only server-globally or only inside another value, and exclusion of the automatic `SSH_AUTH_SOCK`.
- Fake-Orca spawns execute the real staged launch file under synthetic personal credentials and cover the configured source, an empty allowlist, refusal before allocation for each invalid setting, file privacy and deletion before the worker runs, and the deletion-failure path.
- The warning appears for a nonempty allowlist without a source and not for an empty allowlist or a configured source.

Risk: the source keeps tmux and the named session as dependencies of Orca spawns, and secret values sit in a 0600 file under a 0700 directory until the pane sources it.
It is not a filesystem sandbox; a worker can still read the user's credential files unless the harness restricts that.
The hardened path was verified with the regressions above, not with a live Orca spawn.

* no-mistakes(review): Harden Orca launch-file cleanup, floor unsets, and stat portability

* no-mistakes(review): Scope Orca abort cleanup to the staged launch file

* docs: scope Orca source to fresh spawns and qualify pane values

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: state that Orca relaunch is refused

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* no-mistakes: apply CI fixes

* no-mistakes(review): Keep Orca launch file while delivered terminal stays open

* no-mistakes(document): Qualify fm-spawn help's destination-pane expansion claim for Orca

* fix(spawn): keep launch-send failures fatal and compare tmux bytes per version

The Orca launch-file cleanup wrapped both launch sends in a condition, which runs outside errexit.
A failed send on tmux and every other non-Orca backend then continued as success, so a post-publication relaunch failure no longer failed closed.
Each send failure now exits again, and Orca source mode removes its staged file first.

The real-tmux regression asserted that invalid UTF-8 bytes survive tmux itself, which holds on tmux 3.6a but not on the CI runner's tmux.
It now asserts that the snapshot reproduces exactly the bytes the installed tmux reports for that name.

* fix(spawn): reclaim an Orca launch file the pane never runs

In Orca source mode the pane unlinks the credential-bearing launch file as it starts sourcing it.
A pane that accepted the source command but never ran it left the file on disk until teardown, because the abort cleanup keeps the file for a delivered, still-open terminal.
After delivery, fm-spawn now waits up to 30 seconds for the pane to consume the file; if it has not, fm-spawn removes it and fails the spawn with a status line naming the unrun command.

The snapshot already reads and writes tmux output as latin1, so bytes that are not valid UTF-8 reach the launch file unchanged.
A deterministic fake-tmux regression now pins that, independent of how the installed tmux stores such values.

The live-terminal test now drives a slow pane and fails unless the spawn waits for it, and the controlled-source test reads the file the fake pane consumed.

* no-mistakes(review): Keep Orca terminal open when launch file is unconsumed

* no-mistakes(review): Refuse Orca worker when launch file already reclaimed

* no-mistakes(review): Make Orca spawn's deadline launch-file reclaim exclusive

* no-mistakes(document): Document Orca launch-file reclaim keeping the terminal open

* fix(spawn): reclaim an interrupted Orca launch file and keep errexit panes open

An HUP, INT or TERM after the source command reached the Orca terminal left
the credential-bearing launch file on disk: bash ran the EXIT trap with status
0 and abort cleanup kept a delivered file for the pane. Source mode now traps
those signals until the pane consumes the file, and abort cleanup reclaims it
with the same non-forced unlink arbitration as the consume deadline, refusing
the worker when the spawn wins and leaving the terminal open.

The delivered source line now keeps a pane shell with errexit set open when
the launch is refused, including when the file was already reclaimed.

* no-mistakes(review): Trap signals as soon as Orca launch file is published

* no-mistakes(document): Record pre-send interrupt coverage in Orca verification notes

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(bin): treat OpenCode's right-aligned cwd rail as composer furniture, including absolute paths (#7307)

* fix(composer): treat OpenCode >= 1.18 right-aligned cwd:branch as furniture

OpenCode 1.18.31 draws the worker pane's working directory and branch
right-aligned inside the left-bar composer rows above the Build footer,
wrapped over up to three rail-width fragments whose final fragment
continues onto the footer row's right end. The fragments are RGB 128
grey with luminance exactly on the ghost-luma ceiling, so they survive
ghost stripping, and the left-bar classifier read them as unsent typed
text: every idle 1.18.31 pane answered pending, which skipped the
steering doorbell, the watcher's re-ring ladder, and /exit typing.

_fm_composer_leftbar_cwd_start recognises the run structurally and
position-gated: contiguous single-token rows immediately above the
footer row whose gap after the bar exceeds half the row, whose
fragments plus the footer row's gap-separated right-hand tail
concatenate to a path, optionally followed by :<branch>. A path-shaped
string typed at the composer's left edge is still typed text, so a
wrong call can only defer, never inject. Extraction shares the same
rule so extracted composer content stays user-scoped.

* no-mistakes(review): drop dead footer-tail concat, add live short-cwd fixture

* no-mistakes(review): accept only ~/ cwd rail; lone slash stays pending

* no-mistakes(review): require footer row for leftbar cwd furniture walk

* no-mistakes(review): Require topmost cwd fragment to carry ~/ prefix

* no-mistakes(document): Correct cwd furniture recognition doc to topmost-fragment check

* fix(composer): gate cwd rail on region width; correct version story

Review round on the independent PR review: the position gate now measures
the gap against the region's width (the widest trimmed plain row across
first..last), so a short space-prefixed home path typed into an otherwise
empty composer no longer reads empty; the right-half lone-token residual
is pinned explicitly. The cwd:branch furniture is documented as present
since OpenCode 1.18.0 (upstream anomalyco/opencode#36457, merged
2026-07-11), not a 1.18.31 layout change. The 1.18.30 capture comment
notes it omits the directory footer, and a cropped-composer extraction
assertion scopes user content to the typed row above the rail.

* no-mistakes(document): correct OpenCode cwd-furniture version framing and doc typos

* fix(composer): accept an absolute cwd rail outside $HOME as OpenCode furniture

Refs #4632, builds on #5030.

* no-mistakes(review): Harden live abs-cwd check waits and qualify rail comment

* no-mistakes(review): Fix composer-lib relative path in OpenCode harness doc

* no-mistakes(test): Relax live check's DONE wait for wide OpenCode panes

* no-mistakes(document): Separate absolute-cwd verification output block from following prose

---------

Co-authored-by: Konrad Heimel <[email protected]>

* fix(bin): report a worker parked on the exit picker as blocked-on-prompt (#6682)

* fix: name the Claude exit picker on existing stale wakes

A pane parked on that picker still read as healthy quiet after Enter was refused. The existing stale and wedge reports now carry the dialog name, including through away-mode escalation.

Refs #4754

* no-mistakes(review): fix: report exit picker on terminal-status away stales

* no-mistakes(document): docs: describe exit-picker reporting in stale supervision

* no-mistakes(review): fix: drop away stale marker when second-mate picker closes

* fix: keep the exit-picker name off paths main does not already run

A second mate stays exempt from stale capture, and a finished worker in away mode no longer ages into a wedge. The name remains on the stale and wedge wakes a worker already raises.

* no-mistakes(review): name the exit picker on wedge deferral reasons

* no-mistakes(review): limit exit-picker name to plain stale and wedge escalation

* feat: set afk spend cap from live ordinary workers at entry (#7308)

* feat(afk): Spend-Obergrenze beim Eintritt aus der lebenden Worker-Zahl

Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der
gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus
laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze,
0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin.

Die Zählung bekommt mit `live-workers` genau eine Implementierung in
bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen
Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können.

* no-mistakes(document): Remove misplaced afk spend-cap plan

---------

Co-authored-by: ladwein <[email protected]>

* fix(bin): guide completed-scout cleanup and permit stock lab supervision paths (#6965)

* fix(bin): guide supervision through completed-scout cleanup

* no-mistakes(document): Document completed-scout cleanup ownership and regression coverage

* no-mistakes(test): Allow confined lab overrides and verify live scout cleanup

* no-mistakes(test): Clarify per-task cleanup reporting and verify live outcomes

* ci: let a fork skip the push run and the macOS job by repository variable (#7260)

* fix(bin): have workers paused on their own background job set until to the job's timeout (#7240)

* fix: recheck a worker paused on its own background job

A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended.
The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes.
The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy.

Fixes #7239

* test: give the background-job until test headroom over its quiet round

The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner.
With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly.
Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows.

* chore: retrigger CI

* chore: retrigger CI

* no-mistakes(review): Rebuild bg-job until test with passed until, no sleep

* no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker

---------

Co-authored-by: pedromuller-del <[email protected]>

* feat(bin): add a verified Command Code (commandcode) crewmate/scout adapter (#6679)

* feat: add Command Code crewmate and scout adapter

Add `commandcode` as a verified worker runtime for crewmate and scout work
only, so Firstmate can dispatch workers on Command Code models such as
deepseek/deepseek-v4.1-flash.

- Detection: the anchored `command-code` process title identifies the
  adapter in fm-harness.sh and the shared liveness classifier.
- Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an
  effort only where the model's accepted set is verified, and the typed
  launch brief after --; taste-learning state is kept out of git.
- Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per
  process with --mod and --mod-option, writing run_start/run_end/session
  end through fm-busy-event.sh; no user or project settings are edited
  (Command Code's --config persists globally, so it is never used).
- Control: one Escape interrupts; the idle double-Escape Rewind picker is a
  recognized hazard that exit refuses and interrupt dismisses; /quit exits.
- Composer: the bright truecolor placeholder is read with an
  identity-scoped ghost ceiling, and the tmux adapter supplies the identity
  for a cursor parked below the footer; Herdr reports it natively as `cmd`.
- Attribution: the fleet commit-msg strip removes the CommandCodeBot
  trailer.
- Docs, harness reference, verification record, portable regressions, and
  the FM_COMMANDCODE_SIGNALS_LIVE live guard.

* no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments

* no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone

* no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed

* no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160

* no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop

* no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs

* fix: put a read cue at the head of a context re-emit (#7298)

Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs #6303

* fix(bin): retry transient contribution forge reads once before waking (#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for #7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete #7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation (#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract

* fix: parse list-form Lavish results without dropping answers (#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs #4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture

* fix: correct Pi wake ownership and processing-turn handling (#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation

* feat(bin): add a forge=external review rail that never pushes task branches (#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition

* test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <[email protected]>

* fix(bin): stop tmux target checks reporting gone windows as alive (#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes

* fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer

* test(send): codex im Tuerklingel-Test hook-frei starten (#7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <[email protected]>

* fix(bin): store only classified review fields in contribution records (#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header

* fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments

* fix(bin): verify cursor launch binaries with a bounded probe (#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <[email protected]>

* fix: require actual PR references in CI-ready ship notes (#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs

* feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <[email protected]>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447)

* fix(bin): ignore crew state overrides for other tasks (#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes #6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes #5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab042), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e1 added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/f…
andrewkimcanidium added a commit to andrewkimcanidium/firstmate that referenced this pull request Oct 22, 2026
…1630), as the maintainer asked. It already includes kunchenguid#7248, the fm-pi-primary-types fix behind the "parallel 1" failure. All six PR commits are kept with no scope change. The PR's own diff is still 10 files, 1498 insertions and 4 deletions. Three conflicts came up, each just two changes landing on the same lines, and I kept both sides: - bin/fm-spawn.sh: main's Herdr project-groups hook and this PR's footprint record. - docs/configuration.md: main's paseo FM_BACKEND line and this PR's FM_SPAWN_IGNORE_HEADROOM line. - docs/scripts.md: main's updated trailer-strip and push-guard rows and this PR's fm-host-headroom row. After the rebase, the spawn case "a spawn with headroom was refused" in tests/fm-host-headroom.test.sh failed. The cause is upstream aa9ab04 (kunchenguid#7409): before sending keys, the tmux backend now runs `tmux list-windows` to check that the window exists. The fake tmux in this test answered list-windows with nothing, so the spawn rolled back and exited 1. This test also failed the same way locally on the pre-rebase head (with a different error from an unrelated preflight); it is not a defect in the gate. I made one small change, in the test only: the fake tmux now remembers the window names it creates with new-window and lists them back. That is the same pattern tests/fm-project-capacity.test.sh already uses. Results: - tests/fm-host-headroom.test.sh: exit 0, all cases ok. - tests/fm-project-capacity.test.sh: exit 0. - tests/fm-pi-primary-types.test.sh: exit 0 (Pi 1.2.0). - shellcheck on the changed test: clean. The "serial 2" failure was a timeout cancel during fm-busy-adapter-wiring.test.sh, not a test failure, so it needs no code change; it will re-run when CI runs on the new head. I did not push; the outer executor still has to commit the test change and push the rebased head
Pibomeister added a commit to Pibomeister/firstmate that referenced this pull request Oct 22, 2026