Skip to content

fix(bin): stop provider-table lookup from writing broken-pipe errors to stderr - #6001

Merged
kunchenguid merged 3 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/fm5956-quota-sigpipe
Sep 29, 2026
Merged

kunchenguid merged 3 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/fm5956-quota-sigpipe

Conversation

@tiago-peixoto

@tiago-peixoto tiago-peixoto commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Fixes #5956

Implement ready-for-pr issue #5956: tests/fm-dispatch-resolve.test.sh fails intermittently in CI because a provider-table lookup in bin/fm-quota-axi-lib.sh writes "printf: write error: Broken pipe" to stderr. fm_quota_single_provider_for_harness reads the table from fm_quota_single_provider_table through a pipe and returns on the first match while the writer may still be printing; on GitHub Actions SIGPIPE is ignored, so bash reports the write error, which becomes a second diagnostic line. Looking up a harness in the provider table must never produce stderr output, whatever the timing and whether or not SIGPIPE is ignored, with return values and output unchanged.

What Changed

  • fm_quota_single_provider_for_harness in bin/fm-quota-axi-lib.sh now reads the whole output of fm_quota_single_provider_table before it answers. Before this change it returned on the first match, which closed the pipe while the table was still being written. Where SIGPIPE is ignored (for example on GitHub Actions), the writer then printed printf: write error: Broken pipe to stderr.
  • The first matching provider is still printed, and the function still returns 1 when the harness has no match. Output and return values are the same as before.
  • Added a comment explaining why the loop must not exit early.

Fixes #5956

Risk Assessment

✅ Low: This is a small, well-bounded change. The loop now drains the whole process-substitution table before answering, so the writer cannot hit EPIPE. First-match semantics, output and return codes are preserved for every table row (all have non-empty providers) and for harnesses not in the table, and the && chain inside the loop is safe under set -e.

Testing

I sourced the real library function and ran it in a stress loop with SIGPIPE ignored, as GitHub Actions does. This reproduced the bug on the base commit: 7 broken-pipe lines sequentially and 229, then 171, under parallel load. The target commit produced no stderr output in every run, including with default SIGPIPE handling. Output and exit codes matched the base for every harness and for the unknown and edge-case inputs. The issue's failing test, tests/fm-dispatch-resolve.test.sh, passed 3 out of 3 times with SIGPIPE ignored and printed no broken-pipe lines. Everything passed. I removed the temporary files afterwards and the worktree is clean.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Harness lookup with SIGPIPE ignored writes nothing to stderr, even under heavy concurrent load ✅ pass live quota-sigpipe-stress.txt: base produced 171 broken-pipe lines; target produced 0
Harness lookup with default SIGPIPE handling writes nothing to stderr ✅ pass live Stress driver on the target lib without the trap: 0 stderr lines
Lookup output and exit codes are unchanged for known, unknown, and edge-case harnesses ✅ pass live Parity table: all 13 inputs matched between base and target (e.g. muse→meta rc=0; omp, pi, opencode, empty and bogus → rc=1; stderr 0 bytes)
tests/fm-dispatch-resolve.test.sh passes with SIGPIPE ignored, as in CI ✅ pass live 3/3 runs: '# all fm-dispatch-resolve tests passed', 0 'Broken pipe' lines in the logs
Evidence: SIGPIPE-ignored stress transcript, base vs target

Source: SIGPIPE-ignored stress transcript, base vs target

base fa48367: stderr lines=171 (base-lib.sh: line 138: printf: write error: Broken pipe) target a1608f1: stderr lines=0 fm-dispatch-resolve.test.sh with SIGPIPE ignored: passed 3/3

# SIGPIPE-ignored stress: 4 parallel x 4000 x 3 lookups (claude, codex, muse)
base fa48367: stderr lines=171
    171 base-lib.sh: line 138: printf: write error: Broken pipe
target a1608f1: stderr lines=0

# tests/fm-dispatch-resolve.test.sh with SIGPIPE ignored (target)
# all fm-dispatch-resolve tests passed
# all fm-dispatch-resolve tests passed
# all fm-dispatch-resolve tests passed

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ℹ️ bin/fm-quota-axi-lib.sh:151 - No regression test accompanies the fix. The original failure depends on timing (the writer is still printing after the reader has returned) and on SIGPIPE being ignored, which makes a deterministic test hard to build against a 7-row table. The existing tests/fm-dispatch-resolve.test.sh paths still exercise the behavior: return values and output are unchanged for every table row and for a harness that is not in the table. No action needed.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Harness lookup with SIGPIPE ignored writes nothing to stderr, even under heavy concurrent load ✅ pass live quota-sigpipe-stress.txt: base produced 171 broken-pipe lines; target produced 0
Harness lookup with default SIGPIPE handling writes nothing to stderr ✅ pass live Stress driver on the target lib without the trap: 0 stderr lines
Lookup output and exit codes are unchanged for known, unknown, and edge-case harnesses ✅ pass live Parity table: all 13 inputs matched between base and target (e.g. muse→meta rc=0; omp, pi, opencode, empty and bogus → rc=1; stderr 0 bytes)
tests/fm-dispatch-resolve.test.sh passes with SIGPIPE ignored, as in CI ✅ pass live 3/3 runs: '# all fm-dispatch-resolve tests passed', 0 'Broken pipe' lines in the logs
  • trap '' PIPE stress driver sourcing the base fa48367 lib versus the target lib: 3000×3 lookups sequentially, then 4 parallel runs of 4000×3 lookups
  • Stress driver on the target lib with default SIGPIPE handling (3000×3 lookups)
  • Parity check of base versus target output and exit code for claude, codex, grok, kimi, cursor, agy, muse, omp, pi, opencode, the empty string, bogus, and 'claude claude', with SIGPIPE ignored
  • bash -c "trap '' PIPE; exec bash tests/fm-dispatch-resolve.test.sh" run 3 times
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Fixes kunchenguid#5956

fm_quota_single_provider_for_harness returned from its while read loop
as soon as it found a match, closing the pipe while
fm_quota_single_provider_table's printf could still be writing.
Where SIGPIPE is ignored, as on GitHub Actions runners, bash then
prints "printf: write error: Broken pipe" on the resolver's stderr,
which intermittently broke the one-diagnostic-line assertions in
tests/fm-dispatch-resolve.test.sh.

Read the whole table before answering, the way
fm_control_harness_supported already does, so the writer always
finishes. Return values and output are unchanged.

Reproduced by running tests/fm-dispatch-resolve.test.sh with SIGPIPE
ignored on a single pinned core under CPU contention: 30 of 30 runs
failed before the fix, 0 of 30 after. Note: reproducing requires
setting the trap inside the tested shell because nice(1) resets an
inherited SIGPIPE ignore to SIG_DFL. tests/fm-quota-choose.test.sh
passes and bin/fm-lint.sh is clean.
@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Low risk] Fixes stderr noise in a shell utility function.

The PR appears safe to merge; no outstanding finding or new actionable issue remains.

Reviews (3) · Last reviewed commit: "no-mistakes(ci): Fixed both Greptile fin..."

Comment thread bin/fm-quota-axi-lib.sh Resolved
Comment thread bin/fm-quota-axi-lib.sh Resolved
…ss. ci-1 (bin/fm-quota-axi-lib.sh:154). Invariant: looking up a harness must always end with status 0 and print the provider, even when the caller runs under `set -e`. The loop body `[ -z "$found" ] && [ "$harness" = "$1" ] && found=$provider` now ends in `|| :`. Every iteration succeeds and the whole table is still read. Only `fm_quota_single_provider_for_harness` loops over the table this way, so this is the one place the fix was needed. One caveat: on bash 5.3 the old code did not actually exit under `set -e`, because the `while` loop is not the function's last command, so the new `set -e` test would have passed before this fix too. The change makes the loop's success explicit, as the user asked. ci-2 (regression coverage). I added three cases to the existing `tests/fm-quota-choose.test.sh`, all calling the public lookup function after sourcing the library: 1. With SIGPIPE ignored (`trap "" PIPE`), it looks up every harness 200 times and checks that nothing reaches stderr. 2. A deterministic version of the race: the table function is wrapped so it writes the first row, pauses 0.2 s, then writes the rest. With SIGPIPE ignored, it checks that looking up `claude` prints `claude` and writes nothing to stderr. The stress loop alone reproduced the bug in only about 1 of 5 local runs, which is why this case exists. 3. A direct call under `set -e` prints `claude`. Verification: - `bash tests/fm-quota-choose.test.sh`: all pass. - Same test against the pre-PR library (fa48367, via `FM_ROOT_OVERRIDE`): fails with `printf: write error: Broken pipe`. The deterministic case failed in one run and the stress loop caught it in another. - `shellcheck` on both files: clean. - `tests/fm-dispatch-resolve.test.sh`: passes
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: whole thread read (body + Greptile; linked #5956 OPEN ready-for-pr). Diff reviewed against main tip 6b0f5a07fee0ac336332ccab2caa0bd07a5cf113.

Verdict: waiting-ci · contract-class: restore · Firstmate flag: no · closes #5956: yes

Tip vs main: fm_quota_single_provider_for_harness on main still returns on first match inside while read over <(fm_quota_single_provider_table), closing the pipe mid-write. Where SIGPIPE is ignored (GHA), that yields printf: write error: Broken pipe on stderr — the flaky second diagnostic line in #5956 / tests/fm-dispatch-resolve.test.sh. Diff drains the whole table before answering (same pattern as fm_control_harness_supported), keeps first-match output/rc, adds || : for set -e, and adds three regressions in tests/fm-quota-choose.test.sh (SIGPIPE-ignored stress, slow-writer race, set -e). Files: bin/fm-quota-axi-lib.sh, tests/fm-quota-choose.test.sh only — workflow-zero yes.

Attestation: MATCH — body no-mistakes-pipeline-attestation head_sha 4852855313b45fc24b0fa9624083479a4922ce33 == PR head.

CI / NM: Require no-mistakes SUCCESS (run 36413510896). CI 36413510766: Behavior portable serial 5 FAILURE (job 108899064696 — not ok - the header-collision line was not captured, unrelated to this quota stderr fix); all other Behavior/Lint/Repo/Herdr/macOS checks SUCCESS. Greptile alone does not block.

VISION.md per-rule:

  • One captain, one interface: aligns — removes intermittent stderr noise that muddies diagnostics; honesty under load.
  • Authority explicit: aligns — no new autonomy or default grant.
  • Scripts own mechanics: aligns — exact pipe-drain fix in deterministic shell lib + regression tests.
  • Restart is a non-event: aligns — no durability/session change.
  • Delegation with a spine: aligns — no new task shape; field flake → regression coverage.
  • Fleet outlives vendor: aligns — bash/SIGPIPE mechanics, not a vendor harness coupling.
  • Scope: aligns — quota axi lib + tests; not workshop growth.
  • Align/resist: aligns — restores the already-promised silent lookup path that was broken under ignored SIGPIPE.

Next: waiting on green CI (serial 5). Do not merge while CI red. No Firstmate flag. No workflow approvals this pass (runs already executing on head).

@tiago-peixoto

Copy link
Copy Markdown
Contributor Author

Friendly nudge: head 48528553 is mergeable and all 20 checks are green now, including Behavior portable serial 5, which passed on the re-run. The earlier triage was waiting on that. Happy to adjust anything.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: whole thread re-read (body + Greptile + prior waiting-ci stamp + author nudge that serial 5 re-ran green). Diff re-reviewed vs main 1f2c9548f468.

HEAD 4852855313b45fc24b0fa9624083479a4922ce33. MERGEABLE/CLEAN. Attestation MATCH. All tip checks SUCCESS (lint, coverage, portable serial 1–9 including serial 5, Herdr, macOS, invariants, timing, Greptile, NM). No workflow files. Author tiago-peixoto not blocked. Closes #5956: yes.

contract-class: restore — fm_quota_single_provider_for_harness already promised a quiet first-match lookup; early return closed the pipe mid-write and, where SIGPIPE is ignored, printed broken-pipe to stderr. Draining the whole table restores that quiet contract with unchanged output/return values. Not a new default (FM-LEARN-4627 / FM-LEARN-CLAIMS).

VISION.md (each rule):

  • One captain, one interface: Aligns — removes flaky stderr noise from CI/diagnostics.
  • Authority is explicit and never inferred: n/a / aligns.
  • Scripts own the mechanics, agents own the judgment: Aligns — exact pipe-drain mechanics.
  • A restart is a non-event: Aligns — deterministic lookup under SIGPIPE-ignored hosts.
  • Delegation with a spine: Aligns — quota/harness resolve stays reliable.
  • The fleet outlives any vendor: Aligns — bash/SIGPIPE host variance.
  • Scope: Aligns — tiny lib + test; not workshop growth.

Auto-merging (restore + otherwise ready).

@kunchenguid
kunchenguid merged commit a774c44 into kunchenguid:main Sep 29, 2026
38 of 39 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

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

ironerumi added a commit to ironerumi/firstmate that referenced this pull request Oct 2, 2026
* fix: grant Claude workers access to Firstmate task channels (#5884)

* fix(bin): grant Claude workers their task-channel dirs via --add-dir

Since Claude Code 2.1.257, a file-tool read (Read/Glob/Grep, and an
Edit's mandatory prior read) of a path outside the working directories
parks --permission-mode auto panes on a one-time interactive question,
and a "Block" answer lands permissions.blockReadsOutsideWorkingDirectories
in user settings, refusing the same reads even under bypass. Firstmate
launches Claude with no --add-dir, so a secondmate's parent-home steering
inbox and a ship or scout worker's launch record, steering inbox, brief
dir, and code-root .agents/skills were all outside: workers wedged on
the question the first time they read a steer.

Every Claude launch, spawn and relaunch, in both permission modes, now
grants exactly the task's channel directories: state/<id>.inbox for a
secondmate (in the parent home), or state/operational-inbox,
state/<id>.inbox, data/<id>, and the code root's .agents/skills for a
ship or scout. Paths resolve to real paths and lazily created channel
dirs are made before launch so the grant never names a not-yet-existing
directory; the whole state/ is deliberately never granted.

The grant keeps the bypass-mode launch argv changed on purpose: it also
protects bypass workers against a machine-recorded Block answer.

* no-mistakes(document): Consolidate Claude launch guidance in configuration reference

* no-mistakes(document): Clarify Claude permission documentation reference

* fix(bin): prevent idle recovery loops without stranding wakes (#4819)

* fix(supervision): prevent idle recovery loops without stranding wakes

* no-mistakes(review): Remove unused wake-append rollback helper

* fix: reduce remote worker and polling helper process churn (#5889)

* fix(bin): stop the remote-job worker busy-polling an idle queue

The serving loop slept 50ms between passes and re-ran state preparation
(chmod on every queue directory), the heartbeat publish, and the stale sweep
on every pass. It now blocks on a worker.wake FIFO that staging,
cancellation, and lane exit nudge, keeps a short fast-poll window after
activity, refreshes the heartbeat at most once a second, and runs the sweep
(which re-applies the queue directories' 0700 modes) at startup and then on
a bounded interval. Lane-owned records are no longer re-read every pass.

Measured with a fork/execve-interposing counter on a --serve worker in a
disposable HOME and queue, bash 3.2, 20-second windows (the counter slows
the old loop to about 5 passes a second, so real-host rates were higher):
  idle worker             146 forks/s, 61 execs/s -> 4.8 forks/s, 3.1 execs/s
  one running long job    232 forks/s, 100 execs/s -> 15 forks/s, 11 execs/s
Stage-to-result latency for a no-op job, idle and back to back, stayed at
about 0.8-1.2s in both versions (dominated by job execution, not pickup).

* perf(bin): drop per-cycle forks from watcher, drain, and lock helpers

The watcher, drain, inactive-reconcile scan, and branch-outcome reads forked
small external commands on every cycle where bash can do the same work.

- fm-wake-lib.sh gains fm_dirname_to, fm_basename_to, and
  fm_epoch_seconds_to, exact stand-ins for $(dirname --), $(basename --),
  and $(date +%s); the clock uses printf %(%s)T on bash 4.2+ and still forks
  date exactly once on stock macOS bash 3.2.
- fm_lock_abs_path, fm_wake_signal_seen_path, fm_path_age, the watcher's
  age_of and wedge timer, and the recovery-marker line count use them or
  plain reads instead of dirname/basename/tr/date/wc.
- window_to_task reads a meta file once instead of two
  grep | tail -1 | cut -d= -f2- pipelines per file per call.
- fm-classify-lib.sh reads uname -s once at source time instead of in every
  status stat helper.
- Libraries sourced every cycle derive their own directory without forking
  dirname, including the backend adapter siblings a subshell re-sources on
  each probe.

tests/fm-fork-free-helpers.test.sh pins each replacement against the command
it replaces on edge-case inputs, under every available bash and both the C
and a UTF-8 locale; CI's stock macOS bash lane runs it under /bin/bash 3.2.

Measured with a fork/execve-interposing counter in a disposable home, one
tmux crew task, FM_POLL=1 (forks and execs per watcher cycle, per run
otherwise):
  watcher cycle      bash 5.3  299/138 -> 199/66   bash 3.2  341/146 -> 224/80
  drain              bash 5.3  492/238 -> 430/200  bash 3.2  567/250 -> 491/212
  inactive scan      bash 5.3   27/14  ->  17/4    bash 3.2   37/14  ->  17/4
  branch-outcome     bash 5.3   40/21  ->  35/16   bash 3.2   48/24  ->  38/19

* test: note the interpreter-expanded version probe for shellcheck

* no-mistakes(review): Fix worker idle bounds and fork-free contributions snapshot

* no-mistakes(review): Coalesce buffered worker wake nudges into one wake

* no-mistakes(review): Coalesce wake nudges via pending marker so publishers never block

* no-mistakes(review): Claim wake nudges atomically via noclobber pending marker

* no-mistakes(review): Release abandoned wake claims only after a 30-second bound

* no-mistakes(review): Drop worker wake FIFO; load path helpers side-effect free

* no-mistakes(document): Document remote worker polling and preemption cadence

* no-mistakes(ci): Fixed both failing CI shards: isolated remote and teardown test fixtures now include fm-path-lib.sh, which fm-wake-lib.sh requires. The three affected tests, fm-lint.sh, and git diff --check pass locally

* fix: keep remote reply listeners and watcher cycles running (#5941)

* fix: keep a successor watcher and remote-reply listeners across the gaps that dropped them

A main-only supervision pass-through exited without leaving a watcher, and each remote-reply poll released its claim until the next cycle, so short-lived listeners stayed down.

* no-mistakes(document): Clarify listener and supervision continuity documentation

* no-mistakes(ci): Fixed the three Greptile findings: failed ingestion leaves one durable capture, failed reads exit instead of relistening, and the disposable-checkout guard rejects state paths outside the marked lab. Added behavioral tests; the remote-reply and watcher-lock suites, shell syntax checks, and git diff checks passed

* no-mistakes(ci): Fixed a race in the wake-queue interruption test: it now waits for the drain to own the lock and enter handling before signaling it. The wake-queue suite, shell syntax check, and diff check pass

* fix: make attended cutover outcome re-presentation check-first (#5925)

* fix: date replayed branch outcomes and ask main to check current state first

A captain outcome main never acknowledged is presented again, which after a
harness or posture switch, or the first drain after the upgrade whose earlier
presenter never advanced the read cursor, can be days after its situation
settled. The replay read as fresh news, so a PR since merged looked ready.

bin/fm-branch-outcome.sh now adds a "recordedAgo" age (minutes, hours, then
days) to present and unprocessed rows, one owner of that wording for both
presenters. The drain's BRANCH OUTCOMES captain lines and the Pi branch's
processing request name that age and ask main to check the task's current
state first; an outcome already settled needs only the acknowledgement, with
nothing relayed to the captain. Nothing is adopted as processed, so a fresh
home's first outcome is still presented until acknowledged.

* no-mistakes(review): Absent processed marker reads 0; never adopt read cursor

* no-mistakes(review): Require recordedAgo in Pi requests; report undated rows to main

* no-mistakes(review): Keep recordedAgo on captain rows only in present output

* no-mistakes(document): Correct cutover documentation and retire stale migration guidance

* fix: keep settled branch outcomes out of main's reply to the captain

A live Pi primary that took over a host-drain home received the carried-over
outcomes dated and check-first, but its processing reply still told the
captain about an outcome whose decision had since been answered. The request
also claimed every outcome was already shown as an anchor entry in this
transcript, which is false for an outcome carried over from before a restart
or a switch of primary.

The Pi processing request now says each outcome was recorded earlier and may
already have been seen or handled, and that a settled outcome gets no
captain-facing mention at all in the reply or any recap, not even that it is
settled. The drain's BRANCH OUTCOMES header and the supervision docs state the
same rule, and the tests check both delivered texts.

* fix: scope main's outcome reply to what is still open

Telling main what not to say about a settled outcome was not enough: in two
live Pi trials the processing reply still told the captain that an answered
decision was settled. Main now sorts the outcomes by current state first, and
its reply to the captain covers only the still-open ones, written as if the
settled ones had never been listed. With that framing three live Pi trials
kept the settled outcome out of the reply and relayed the open one each time.

The drain's BRANCH OUTCOMES header and the supervision docs use the same
framing, and the tests check both delivered texts.

* no-mistakes(review): Clarify that main acknowledges every presented captain outcome

* no-mistakes(document): Clarify outcome cursor ownership across Pi and host

* no-mistakes(ci): Fixed Pi replay by batching unprocessed captain outcomes oldest-first and acknowledging only through each batch. Verified a marker-less backlog over 1 MiB replays through all batches. A real-drain regression confirms an older keyed decision remains under OPEN DECISIONS after a newer branch row is acknowledged; the check-first instruction now names those decisions. Relevant targeted tests and branch-supervision tests passed; the full host suite timed out

* no-mistakes(ci): Fixed the host drain’s check-first wording in bin/fm-wake-drain.sh; the CI fixture now passes. The full host suite passed the affected fixtures but timed out later. Syntax and diff checks passed

* no-mistakes(ci): Fixed ci-1: abbreviated Pi outcome summaries now stay within 1,024 characters and include a row-specific full-outcome lookup command. The delivered instruction requires reading the full outcome before acting, relaying, or acknowledging it. The new extension-driver regression failed before the fix and passes now; the Pi and supervision-host suites pass

* no-mistakes(ci): Corrected the batching sentence in docs/pi-supervision-branch.md. The cancelled CI check needs no code fix; its clean rerun passed. The Pi branch extension suite and git diff check passed

* fix: restore primary rewakes after attended main-only closes (#5961)

* fix: wake an idle Claude primary for attended main-only hand-backs

An attended main-only pass-through confirmed a handling handoff for the
successor it leaves running, which flipped the recovery marker to handling.
The Claude Stop hook only rewakes main while that marker reads downtime, so
the close reached no one and an idle primary slept with wakes queued.

The pass-through now leaves the marker at downtime, and a close that turns
main-only at its turn hands the consumed handoff back to downtime before it
reaches main. Regression tests drive the real Stop hook around the real host
on both paths and for the successor's own later close, and a new opt-in live
guard proves it against an idle interactive Claude primary with a pre-fix
negative control.

* no-mistakes(review): Assert live lab Stop-hook registration via parsed settings JSON

* no-mistakes(document): Correct supervision hand-back documentation

* no-mistakes(ci): Fixed the failed downtime-write path so the Stop hook notifies main instead of silently dropping the close. Corrected the live guard’s tracked-hook check and added the requested at-turn main-only scenario. The new regression failed before the fix and passed after it; the host suite, syntax checks, and diff check pass. The credentialed live guard was not run in this CI phase because it writes outside the worktree

* no-mistakes(ci): Fixed the Stop hook’s retry ordering: a crashed host gets its bounded retry before a non-crash hand-back failure is reported. The Stop-hook suite passes, including the crash regression. The host suite passed the failed-marker-write regression but timed out before completing; syntax and diff checks pass

* Clarify live Claude login for opted-in tests (#5975)

* fix(bin): ensure resumed worker launches enter their recorded worktree (#5916)

* Fix worker launches to enter recorded worktrees

* no-mistakes(review): placeholder

* no-mistakes(document): Update agent-control.md worktree-refusal note to match new universal cd+assert

* no-mistakes(review): Add regression tests for Orca spawn/relaunch worktree carve-outs

* Fix PR relaunch and prelaunch cwd verification

* no-mistakes(document): Fix docs/agent-control.md: worktree cwd check is pre-launch, not post-launch

* fix: slim worktree launch change onto upstream main

* fix(bin): retire task-keyed watcher markers and orphan journals at teardown (#5997)

* WIP: retire task-keyed watcher markers and orphan journals at teardown

Re-applies old PR #5584 on current main: teardown retires the
turn-ended .seen-* signature and an orphaned Herdr presentation
journal whose workspace is already gone, and the wake-drain rotates
its own dead scratch files. Not yet validated through no-mistakes.

* no-mistakes(ci): Fixed the Greptile P1 finding in bin/backends/herdr.sh. fm_backend_herdr_projection_token_workspace_gone used `! ... jq -e ... 2>&1`, which swallowed a jq runtime error (thrown when a non-object workspace entry, e.g. a number before a live token-bearing workspace, hits `.label`) and flipped it to a "gone" verdict, causing teardown to delete a still-live v1 presentation journal. Invariant: a workspace-query error/ambiguity must never be read as token absence; only a cleanly-parsed list with no token-bearing label is "gone". Replaced the body with a single jq verdict (unknown/present/gone): a non-array list or any non-object/non-string-label entry yields "unknown", jq errors/empty output fall through `|| return 1` to unknown, and only "gone" returns 0. Sibling fm_backend_herdr_projection_endpoint_matches_journal already fails safe on jq error (empty match -> journal kept), so it needed no change, matching the author's scoping. Added test_teardown_retains_v1_journal_when_workspace_query_ambiguous driving real teardown with a malformed workspace-list entry, proving the journal is kept and no workspace close occurs. Verified the old logic returns GONE on that input (test fails before, passes after); full tests/fm-teardown.test.sh suite passes (exit 0) and shellcheck is clean. Marker-naming finding left untouched per explicit out-of-scope instruction

* test: guard the live harness gate against Claude Code's auto-updater (#6002)

* fix(tests): disable Claude Code's auto-updater during live harness runs

fm_live_gate let a live run proceed without ever setting
DISABLE_AUTOUPDATER, so a live Claude test could let the real updater
repoint ~/.local/bin/claude into a temporary directory and stop every
Claude process on the machine from starting. Export
DISABLE_AUTOUPDATER=1 on every path where the gate lets a live run
proceed, and assert the export in tests/fm-live-gate.test.sh, including
that it reaches a child process the same way a real harness pane would
inherit it.

* no-mistakes(ci): Greptile flagged that the PR's DISABLE_AUTOUPDATER inheritance test only checked a `bash -c` direct child, not the fm-spawn.sh launch path. The user chose to fix it with a regression on that path. In tests/fm-live-gate.test.sh I replaced the generic child test with test_disable_autoupdater_reaches_the_claude_pane_on_the_fm_spawn_launch_path: it drives the real fm-spawn claude launch through the spawn fixtures, captures the exact staged launch command, and runs it as a synthetic pane whose only `claude` is a stub recording the inherited DISABLE_AUTOUPDATER, asserting it saw 1. Switched the file to source fixtures.sh (pulls in lib.sh, guarded) for the spawn helpers. Verified it is a real guard: the stub records `1` when the ambient var is set and `unset` when absent, so it fails if fm-spawn ever scrubbed the variable (e.g. env -i or -u). This confirms fm-spawn's launch construction never references the name and passes it through via ordinary ambient inheritance with no allowlist. Full suite passes (12 tests ok), shellcheck clean. Note for the outer executor: I embedded the daemon caveat as a code comment in the test, but the finding also asks the PR body to state that a backend daemon already running before the gate exported the variable does not inherit it and fully covering that would need launcher support - that forge-side PR-body sentence is outside this CI phase's scope

* no-mistakes(ci): Fixed Greptile finding ci-1. Root cause: fm-spawn.sh handed its launch command to an already-running backend daemon that never inherited the test process's exported DISABLE_AUTOUPDATER, so ambient inheritance dropped it and Claude's auto-updater could still run. Fix (bin/fm-spawn.sh): when DISABLE_AUTOUPDATER is set in the spawn's own environment, embed `export DISABLE_AUTOUPDATER=<value>;` into the LAUNCH command text (same idiom as the adjacent COMPACT_ADVISER_DISABLE export), so it survives a daemon-built pane, the env -i allowlist path, and relaunch alike; gated on presence so ordinary spawns are unchanged. Added regression test test_disable_autoupdater_survives_a_daemon_pane_that_never_inherited_it in tests/fm-live-gate.test.sh: stages a real claude launch with DISABLE_AUTOUPDATER set in the spawn env, then runs that exact command in a synthetic pane with `env -u DISABLE_AUTOUPDATER` and asserts the claude stub still recorded autoupdater=1. Verified the test fails (autoupdater=unset) without the fix and passes with it; the round-1 ambient test stays green either way. Full suite passes (13 ok); test file and isolated snippet shellcheck-clean (full fm-spawn.sh shellcheck kept getting terminated by the memory-constrained host, not by findings). Forge-side note for the outer executor: the PR-body caveat that fully covering the daemon case would need launcher support no longer applies to the Claude launch path and should be corrected

* fix(bin): ring the worker inbox doorbell only for a newly written procevent record (#6010)

* fix(bin): ring the inbox doorbell only for a newly published procevent result

publish_result rewrote a worker's captured Lavish round idempotently on
every reconcile, unconditionally moved an already-acknowledged inbox
record back out of handled/, and rang the doorbell every time - so an
already-processed round rang the owning worker on every cycle. Snapshot
the existing active and handled records before the idempotent write and
ring, or move anything, only when the write actually created a fresh
record; re-delivery of a still-open round is left to the inbox's own
re-ring ladder.

* no-mistakes(document): docs: reflect worker-board doorbell rings only on fresh inbox record

* no-mistakes(ci): Fixed Greptile finding ci-1 in tests/fm-procevent.test.sh (test-only change). The redelivery regression previously moved the delivered note into handled/ before any repeated reconciles, so it only proved an acknowledged note stays quiet and would still pass if an unchanged active note rang every cycle. Per the user's instruction, I inserted (before the mv into handled/) five repeated `pe reconcile` runs with the note still in the active inbox and asserted the ring log holds exactly one line and 001.msg remains active; the existing acknowledged-note assertion after the move is kept unchanged. No product code changed. bash -n confirms syntax is valid; the block mirrors the already-passing post-move reconcile/ring-count assertion directly below it

* fix: prevent manual Claude Stop hook calls from arming supervision (#6032)

* fix(bin): make the Claude Stop auto-arm refuse arguments before arming

A model running bin/fm-claude-stop-autoarm.sh --help mid-turn armed a real
supervision-host park owned by its short-lived tool process, leaving
supervision down once that process exited. The Stop hook passes no
arguments, so -h/--help now prints usage and any other argument is refused
before anything is sourced, read, or armed.

* no-mistakes(document): Clarify Claude Stop hook documentation for manual invocations

* no-mistakes(ci): Updated the argument-run regression test to compare checksums of state files as well as entry names. The Stop auto-arm test suite passes, and git diff --check is clean

* d