Repository navigation
feat(bin): land fleet federation, quota-aware dispatch, and runtime handoff, restoring main CI - #8
Merged
Merged
Conversation
…omposer Main has been red on every run since 2026-08-01. Nine jobs failed on every push, so the standing rule that green must mean green has been unenforceable on this repository for two weeks and work has been merging against a signal nobody could read. Each failure below is a distinct defect; four of the five are code or wording silently lost in a merge, not a deliberate change. Lint (two SC2034 warnings): FM_COMPOSER_BARE_PROMPT_RE_DEFAULT is load-bearing, not dead. Its only consumers source it (bin/backends/orca.sh, bin/backends/cmux.sh, and the copilot harness test), so unlike every sibling constant in that file it has no reader ShellCheck can see. Marked with the repo's existing disable idiom rather than removed. tests/fm-backend.test.sh's `archive` is genuinely dead: declared once and never assigned or read anywhere in the file, so it is deleted. Spawn (muse rejected as an unknown harness): The entire muse launch path - its launch_template case, resolve_muse_binary, the credential preflight, the reasoning-effort mapping, and the __MUSEBIN__/__MUSECONFIG__/__MUSEDATA__ substitution - was dropped by the in-place runtime handoff rewrite while every other muse reference was kept: the secondmate refusal, the session binding, the model flag, and the harness validation lists all still name muse, as do AGENTS.md and the spawn header. That left muse documented and half-wired but unlaunchable. Restored verbatim, so the adapter matches what AGENTS.md section 4 already promises. Brief (missing durable-resolution wording): The --resolve-key feature updated bin/fm-brief.sh and its test together; only the test survived the merge. The generator had reverted to telling every worker to always append `resolved:` itself, which contradicts AGENTS.md section 7, where firstmate's own answer closes the decision at answer time. Restored the generator to the accepted wording: firstmate's reply normally writes the closing line, the worker self-closes only when a blocker or wait clears without a reply, and a later done or working line never closes a decision. Composer (cursor's herdr composer read unknown): Herdr hardcoded its bare-prompt glyphs to claude's and codex's only, while cmux and orca both bind to the shared fleet set. Cursor rules its composer with half-block glyphs instead of side borders, so its row is reachable only through the bare shape and classified unknown instead of pending. Bound herdr to the same shared owner the other backends already use, which is also what the harness-adapters reference already states for every backend. macOS stock Bash snapshot count: The workflow pins an exact Bearings test count as a did-everything-run tripwire. A legitimate test added by the fleet-snapshot secondmate timeout fix took the suite from 41 to 42 without updating it. Corrected the number and kept the exact-match tripwire rather than loosening it. Verified locally: bin/fm-lint.sh clean, the portable parallel and serial lanes that covered these failures green, and the stock Bash 3.2 parse sweep and both snapshot suites green at their asserted counts.
…needs fm_backend_herdr_presentation_enabled takes <config-dir> [<state-dir>] and, under the unconfigured `default` preference, falls through to fm_backend_herdr_presentation_default_supported "$state_dir" - the lookup that reads the Herdr version floor deciding whether the disposable projection is default-on. The call site had been reduced to "$CONFIG" alone, so that lookup ran against an empty state dir and the default-on decision stopped deriving from the floor. This is the same lost-in-merge class as the other repairs on this branch: the whole presentation-order lock, its release, the server-ensure, and the launcher identity binding are all still present and unchanged, so only the argument went missing rather than the mechanism. NOT verified locally. The job that covers it drives real Herdr lifecycle behavior, which this task's scaffold explicitly forbids without a guarded lab, so the fix rests on the function's own signature and fall-through rather than on an observed green run. It is reported as unverified rather than claimed.
The concurrent post-create abort case in the real-Herdr lane has failed on every run since 2026-08-01, alternating between naming fixture A and fixture B as the loser. That alternation was the tell: it is a bound, not an ordering defect. 56fdced made the TEARDOWN side's presentation-lock wait overridable and set FM_HERDR_PRESENTATION_LOCK_RETRIES=600 in that suite so the assertion measures serialization rather than machine speed. The abort fixtures race two SPAWNS, though, and the spawn side kept a hardcoded 50 attempts. On real Herdr the lock holder's critical section - workspace create, task tab create, seeded prune, two workspace moves, then abort cleanup - runs past that 5s ceiling, so the loser stopped waiting and fell back to the flat layout, contributing no create and no prune. Whichever spawn lost the race was whichever the run reported. Give the spawn side the same overridable ceiling and the same default of 50, so production behavior is unchanged and only the waiter's patience is configurable. Raising it can only make a waiter wait longer before giving up; it cannot turn a refusal into a wrong mutation. Verified against real Herdr 0.7.4 through the guarded lab helper. The focus audit for the abort window now shows each fixture completing its entire presentation critical section before the other creates anything, which is the guarantee the lock exists to provide. The sequence extraction alongside it was also measuring the wrong thing. Its comment states the emptying-close plan "emits no pane-close mutation at all", but on Herdr 0.7.4 that plan still reaches Herdr as a pane close, so each fixture contributes two pane-close mutations - the seeded prune and the task pane - while the accepted patterns allow exactly one prune apiece. A correctly serialized run could therefore never match. The task pane is now excluded by exact pane id, which is precisely what the focus assertion on the next line already does with the same two ids, and for the same reason: it is a separate expected cleanup category whose focus excursion is restored by the tab-focus trailing it. The two accepted orderings are unchanged, so interleaving is still caught exactly as before; only the volume of cleanup calls stops being counted as ordering.
bin/fm-spawn.sh has been reduced by merge resolution three times, and the tests for what it lost were kept every time. That is the whole reason nine CI jobs have been red on every push: upstream and fork-only suites both run against a spawn script that no longer contains the features they assert. The decisive one is 2d39b28 (2026-08-14), which merged upstream/main into the fork sync branch. Its second parent carried upstream's relaunch launch owner and pooled-base freshening; the resolution took the fork side for those regions wholesale, so the merge result has neither, while both suites merged cleanly as separate files and kept running. Earlier integration merges on 2026-08-06 had already dropped the machine-capacity guard and the durable treehouse lease the same way. Restored, each because a test at HEAD asserts it: Machine-capacity admission. bin/fm-capacity-lib.sh was no longer sourced and fm_capacity_guard was never called, so no spawn was admitted against machine capacity at all - the whole fleet's admission control, which AGENTS.md section 7 requires of every spawn, was absent rather than lenient. Durable treehouse lease. The script had reverted to sending `treehouse get` into the pane, which is the exact anti-pattern its own header documents: the pool HOME is then inherited by the agent and everything it runs, giving it the wrong ~/.claude, git config and gh credentials. Firstmate leases the worktree itself again, preserves the operator's real config first, sends the pane a plain cd, and returns the lease on every abort path before metadata is published. fm-teardown.sh never stopped returning the lease, so spawn and teardown had been disagreeing about whether one is taken. assert_worktree_colocated and the Orca split warning. A worktree split from its object store wedges the validation pipeline hours later. Pooled base freshening. A leased pool worktree could start a task on stale history and open a PR against a base that had moved. Per-task temp root uid. /tmp/fm-<id> is created by whichever operator spawns that id first and is then unwritable to every other one on a shared box. Two defects found while reconciling, neither a straight restoration: --relaunch was not a recognized flag at all, though bin/fm-control.sh calls it and tests/fm-control-relaunch.test.sh asserts it extensively. It is accepted again alongside --reuse-worktree; they are separate features with separate contracts, so both spellings stay. The runtime handoff's delivery-posture preservation had been spliced into a branch of the trace-context if/elif/else. The two decisions are unrelated: an explicit --traceparent skipped preservation entirely, and preservation left the trace carrier unresolved. Preservation now happens where the recorded values are read, which is also early enough for the brief's delivery-contract check and the standing-posture notice to see a real mode instead of an empty one; a relaunch reuses its recorded harness rather than the current crew default, and no longer demands flags it must not be able to change. Two test doubles for `treehouse` were written against the in-pane flow and stayed silent on stdout, so the lease read no path. They now print the leased worktree exactly as the real tool does, matching the double already in tests/fm-spawn-worktree-settle.test.sh. No assertion was changed. Verified: bin/fm-lint.sh clean, and fm-spawn-capacity, fm-treehouse-user-config, fm-spawn-pool-base-freshen, fm-spawn-worktree-settle, fm-runtime-handoff and fm-tangle-guard all green locally.
… owner The same 2026-08-14 merge that reduced bin/fm-spawn.sh also dropped upstream's composer consolidation from three backend adapters. Upstream had moved every composer shape - the bordered box, the bare agent-glyph row, opencode's left-bar, and pi's identity-gated separated pair - into one owner (bin/fm-composer-lib.sh, fm_composer_classify_screen) and deleted the per-adapter copies. The merge kept the fork's per-adapter copies. That shared owner is still present and complete at HEAD; only the wiring was lost, so three adapters went on classifying composers with their own stale rules while zellij and tmux used the shared one. Each adapter is now the thin shape upstream landed - capture, a static capability descriptor, and one delegation - which fixes the three failures directly: cmux classified plain-capture text after a bare glyph as `pending`. Its local rule had no way to express that cmux's `read-screen` is plain text by construction, so it could not tell typed input from an idle suggestion. The capability descriptor says styled=0 and the shared classifier degrades to `unknown` instead of guessing. orca promoted a stale startup banner over the live composer. It read 200 lines backwards through scrollback, where codex's bordered "permissions" box could outrank the bottom-anchored composer. The capture is now one bounded tail read. herdr's local classifier was the drift itself: the muse `⟩` glyph was missing from its bare-prompt pattern, which is exactly the class of divergence a single owner removes. Its genuinely herdr-specific primitives - the ANSI capture and the native `agent get` identity probe no other backend has - are kept, and the identity probe is still consulted only when the classifier says the verdict depends on it. Taking upstream's file wholesale would have deleted fork-only material each adapter carries (herdr's berth-aware workspace labels among it), so only the composer region was replaced in each. Two defects found while verifying, both previously hidden behind the composer failure that aborted its suite first: fm-spawn published task metadata with `mv` onto the destination. `mv` onto a DIRECTORY moves the file inside it and reports success, so a spawn whose task record could not be written reported success and launched an agent with no durable record - invisible to supervision and to teardown. The destination is now proven writable first, surfacing the operating system's own reason, and mv's own status is checked. tests/fm-backend.test.sh's pre-refactor shim walked three per-file lists that no longer exist anywhere in the tree, so it aborted on an unbound variable and compared real output against nothing. Its own note already describes the correct approach - materialize BASE_REF's complete bin/ tree and avoid a hand-maintained dependency list - so the body now does that. Verified: bin/fm-lint.sh clean, and fm-backend, fm-backend-cmux, fm-backend-orca and fm-backend-herdr all green locally.
bin/fm-control.sh's relaunch verb delegates its launch half to fm-spawn.sh, and that half was removed wholesale by the 2026-08-14 upstream merge along with the per-home task-set lock it landed with. bin/fm-control.sh, its library, and a 92-case suite all survived, so every fm-control relaunch in the fleet failed - at the worst possible moment, after the old agent had already been stopped, so the task was left running nothing at all. The flag itself was the first casualty: fm-spawn.sh accepted only --reuse-worktree, so --relaunch fell through into the positional list and PROJ became the literal string "--relaunch". --relaunch and --reuse-worktree are now both accepted and are deliberately NOT aliases. --relaunch is bin/fm-control.sh's lifecycle verb: every identity axis comes from the record and a contradicting --backend, --scout/--secondmate, --mode or --yolo refuses, because the control plane must not be able to change what a task IS while replacing its agent. --reuse-worktree is bin/fm-runtime-handoff.sh's entry point, where firstmate is deliberately choosing a new runtime for the same work and states those axes explicitly. Both refusal wordings are preserved, because both suites assert their own. Restored on top of that: Endpoint adoption. A relaunch reused the worktree but still CREATED an endpoint, which refuses because the endpoint already exists. It now adopts the recorded one - no new terminal, no second copy, uncommitted work untouched - and refuses if that endpoint's shell has drifted out of the recorded worktree. Metadata publication under the task's metadata lock. Publishing is a read-modify-write of a record other writers own: a relaunch keeps every key it does not own, so a Relay reply landing between the read and the write was dropped silently. The traceparent was worse - a bare append outside any lock. Both now run under the same lock every other metadata writer takes. Harness-wiring retirement. Without it a harness switch left the old adapter's hook files and turn-end registry entries behind, and even a same-harness relaunch orphaned the retired busy generation's token. An aborted replacement now removes its own wiring and retires its busy generation, so a task that keeps running its previous incarnation is not answered for by an agent that never started. The per-home task-set lock, on the spawn side. bin/fm-teardown.sh still took it from enumeration through cleanup, but no spawn took it, so a record published inside a forced teardown's enumerate-then-remove window was invisible to its preflight and visible to its cleanup - destructively processed while never lifecycle-locked. Both the local and the remote-secondmate publication paths take it now, before their own per-task locks, and refuse rather than wait. The lifecycle control lock, so two lifecycle actions on one task cannot interleave, adopting bin/fm-control.sh's own lock when it is the parent rather than deadlocking against it, and stamping control_relaunch_tx so the control plane can tell "the replacement published" from "the launch failed". Secondmate relaunch, which the reuse path refused outright; a secondmate's recorded home is its worktree and it relaunches in place like any other kind. Two new regression tests pin the flag defect directly: that --relaunch is parsed rather than taken as a project path, asserted through its observable consequence (the task relaunches in its own recorded project and worktree), and that the recorded delivery mode and yolo posture survive a relaunch. Also fixed here, both found by the suites this restores: tests/fm-session-start.test.sh pinned the task-inventory header as "--- <id> ---" while the digest prints the readable crew name after the id. The id is what recovery keys on and stays pinned; the crew name is presentation. tests/fm-watch-triage.test.sh reaped its own first watcher and then expected the second to absorb - but a reaped watcher is exactly what arms downtime recovery, so the second run correctly resurfaced instead. The fixture now clears the recovery state it manufactured, leaving the pause-absorption assertion intact. Verified: bin/fm-lint.sh clean; fm-control-relaunch 48/48 green including both new tests; fm-runtime-handoff, fm-secondmate-safety, fm-spawn-capacity, fm-treehouse-user-config, fm-spawn-worktree-settle, fm-spawn-pool-base-freshen, fm-tangle-guard and fm-session-start green.
Six fixtures still described the world as it was before two features this branch restores, so they failed for reasons unrelated to what they assert. Four suites stub `treehouse` as a silent exit-0 command. That modelled the old flow, where firstmate sent `treehouse get` into the pane and read the worktree back from the pane's cwd. Firstmate leases the worktree itself again and reads the path the real tool prints on stdout, so a silent double reports "no usable worktree" and refuses the spawn. Each double now prints the leased path for `get`, matching the one tests/fm-spawn-worktree-settle.test.sh already had. No assertion changed: fm-spawn-capacity still proves the capacity decision, fm-spawn-pool-base-freshen still proves the base refresh, fm-trace-context-spawn still proves the carrier, and fm-muse-harness still proves the muse adapter. Two fences asserted that each backend re-binds the shared idle default, by grepping the backend's own source for the variable that does it. Those variables are gone: every backend now reaches its verdict through the one shared owner, so a per-backend override no longer exists to grep for and could not take effect if it did. The guarantee the fence protected is still real - an idle placeholder must read as empty for every backend, so a new harness's placeholder is taught once in the shared default - and it is now asserted through the classifier the adapters actually call, which is also what this repo's own guidelines require of a test. Scoped to the plain-capture capability shape the idle default governs; under a styled capture it is the shared ghost-stripper that recognizes a placeholder, and that path has its own coverage. Verified: bin/fm-lint.sh clean, and fm-spawn-capacity, fm-spawn-pool-base-freshen, fm-trace-context-spawn, fm-muse-harness, fm-copilot-harness and fm-cline-harness all green locally.
… focus-preserving close
…fier consolidation
The metadata-lock serialization case is the one teardown in this suite
that must succeed through the worktree return. Since the per-project
treehouse pool HOME landed, that path resolves the project's git object
store before it ever invokes the treehouse binary, so the fixture's
plain directory project failed pool resolution ("cannot resolve the git
object store") before the suite's fake treehouse could intercept the
return, and teardown aborted. Every real teardown target is a git
repository, so the fixture assumption was stale, not the product code:
the case now runs `git init` on its project.
The failure was also invisible: `wait "$teardown_pid"; rc=$?` under the
suite's errexit killed the whole script on the nonzero wait before
expect_code could report, which is why CI showed exit 1 with no
diagnostic. The status is now collected with errexit off and the
teardown's stderr is included in the expect_code message, so a future
regression names itself.
Reproduced failing at e21ca1e and at the branch base 8b22be8 (exit 1
after two oks, matching the CI log); passing at 2d2be63 where teardown
still invoked `treehouse return` directly from PATH. All seven cases
pass deterministically after the fix; bin/fm-lint.sh is clean.
adibirzu
added a commit
that referenced
this pull request
Aug 16, 2026
…sed ceiling PR #8 restored this suite with the grok 0.2.99 expectation that xhigh is omitted, while this branch's ceiling change passes xhigh through on grok 1.0.4. The launch itself was never wrong - the captured command still threads --model and the typed brief - so the test now asserts the full new shape: model flag, xhigh reasoning effort, and typed brief together, with max still omitted by the sibling test and drift guarded live in tests/fm-grok-signals-live-e2e.test.sh.
adibirzu
added a commit
that referenced
this pull request
Aug 16, 2026
…g-effort ceiling (#7) * feat(cline): force act mode, register control mechanics, add a busy source Three gaps measured live while supervising real cline crewmates, all fixed by supplying verified facts rather than by loosening any refusal. Act mode: cline's TUI start mode follows the persisted planActMode in its global settings file, not the documented act-by-default, so a crewmate silently inherited the operator's plan mode and analysed without implementing. There is no --act flag, so the launch now redirects CLINE_GLOBAL_SETTINGS_PATH at a firstmate-owned copy that forces act and carries the operator's other choices over. The operator's own ~/.cline is never written. Control plane: cline was refused outright because it had no registered mechanics. It is now registered with its own verified keys - Escape cancels the turn, Ctrl+C EXITS - which is the exact inverse of grok. cline is also the first adapter with no composer exit command at all, so the exit mechanism is tabled as a key alongside the existing command table rather than overloading one string. Busy state: cline reported unknown, leaving supervision blind. It now folds cline's own per-session record, a structural source rather than a rendered tail. Two independent signals back it: the record's status field, and the turn log's last message role, which is what separates a finished turn from one that was accepted and never processed - the wedge that renders identically to a healthy idle pane. The recorded pid is deliberately unused for binding; it is the shared hub daemon's, not the pane's. Also teaches the shared composer classifier cline's plan-mode placeholder, so an operator's own plan-mode pane reads as an empty composer rather than pending input that away-mode supervision would refuse to deliver into. * fix(grok): raise the reasoning-effort ceiling to xhigh, and pin what was re-verified grok's accepted effort vocabulary moved between installed versions. 0.2.99 rejected xhigh and max alike; 1.0.4's own refusal names `xhigh, high, medium, low`, and a real single-turn prompt at xhigh answers cleanly. firstmate was still omitting xhigh, silently downgrading a task the captain asked for the strongest reasoning on. max is still rejected and stays omitted. Adds live drift guards for both adapters. They read each vocabulary from the harness's own refusal rather than a remembered list, exercise the real binary, and fail naming the harness and version. Both refuse to pass when they checked nothing. Re-verified and unchanged, now pinned rather than remembered: grok's headless single-turn surface; its no-pty failure being an OS device error that names no credential problem, so a harness artifact is never read as an auth fault; and quota-axi resolving no grok quota window at all while grok's auth reads usable. That last pairing is the trap the credit selector must not fall into, and the selector already handled it correctly - the regression pins that rather than changing it. Cursor's live catalog confirms the recorded Grok ladder, and its usage-limit behaviour is unchanged: cursor-grok-4.6-high answers, while gpt-5.3-codex-low and claude-4.5-sonnet refuse until the monthly cycle ends. * test(cline): prove the adapter's live lifecycle, and correct two guard defects The live guard now runs green end to end against cline 3.0.55 and proves every claim the adapter makes: a persisted plan mode still governs start mode (so the act-mode mechanism is still load-bearing), the settings redirect starts the real TUI in act mode, the session record structurally confirms it ran in act mode, the pane binds to exactly one of its own records, the fold reports busy in flight and leaves busy on cancel, the recorded exit key exits cleanly, the recorded interrupt key cancels the turn without polluting the composer, and the operator's own settings come out byte-identical. Two defects were in the guard rather than the adapter, and both would have reported a working mechanism as broken: Its pre-checks spent the only window in which a turn is observably in flight, so it read the fold after the turn had already settled and reported the busy source dead. Everything checkable is now checked inside the observation loop. Its composer check searched the whole pane, which also contains the conversation echo of the submitted prompt, so it reported a restored prompt that was not there. It now reads the last prompt-glyph row only. cline genuinely does not repollute its composer after an interrupt, so recording no clear key is correct. Also covers the crew-state layer, where a cline task previously read "unknown - harness state unavailable". * fix(tmux): attribute a live cline pane so lifecycle verbs can act on it Registering cline's control mechanics was necessary but not sufficient. Every lifecycle verb refuses an endpoint it cannot positively attribute, and cline runs as a bundled Node script whose reported command name is a bare `node`, so a live cline pane classified `ambiguous` and fm-control refused it a second time - now for an unattributable endpoint rather than for unverified mechanics. Its identity is its install path (.../node_modules/cline/bin/.cline), the same shape cursor-agent has, so cline joins the shared exact-executable-name list that the path rule reads. That rule matches an exact `cline` path COMPONENT rather than a substring, so an unrelated node process still matches nothing and stays unattributed rather than being claimed as an agent - callers fold that into ambiguous, never into dead. Verified against a real cline 3.0.55 worker through fm-control.sh itself: `interrupt` reported agent-alive and left the composer on its idle placeholder, and `exit` reported stopped with the pane back at its shell. * docs(cline): record the process-identity fact and the idle-composer limitation Adds the two findings the live verification turned up that are not behaviour changes: cline's install-path identity and why a bare node pane was unattributable, and the pre-existing bare-row composer read that classifies a genuinely idle cline composer as pending. The second is bounded rather than fixed: it is pre-existing on an unmodified baseline, Cursor's cursorless reclassification does not transfer because cline first resolves to the pi separated shape, and a submit that starts a turn is still confirmed by the submit core's busy fallback. Correcting it would change the one fleet-wide classifier's conservatism for every harness and backend, so it is recorded with its measurements instead of changed under this task. * test(grok): align the dispatch-profile xhigh expectation with the raised ceiling PR #8 restored this suite with the grok 0.2.99 expectation that xhigh is omitted, while this branch's ceiling change passes xhigh through on grok 1.0.4. The launch itself was never wrong - the captured command still threads --model and the typed brief - so the test now asserts the full new shape: model flag, xhigh reasoning effort, and typed brief together, with max still omitted by the sibling test and drift guarded live in tests/fm-grok-signals-live-e2e.test.sh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Restore firstmate's own CI on
main. It has been failing continuously since 1 August 2026 - of the last 18 runs on main, two passed, and the most recent success was 2026-08-01T11:12. Nine jobs fail on every run.This repository is different from the rest of the fleet: its Actions genuinely run, so the failures are real and the logs are worth reading.
Why this matters more than the individual failures
The captain's standing rule is that green must mean green, and skipped or absent checks count as unverified rather than passing. That rule has been unenforceable on this repository for two weeks, because every result is red regardless of the change. Work has been merging against a signal nobody can read. Restoring the signal is the deliverable; the individual fixes are just how you get there.
Known failures at intake
Lint: two SC2034 unused-variable warnings, in
bin/fm-composer-lib.sh(FM_COMPOSER_BARE_PROMPT_RE_DEFAULT) andtests/fm-backend.test.sh(archive). Read before deleting: FM_COMPOSER_BARE_PROMPT_RE_DEFAULT is documented as the fleet-wide bare-prompt glyph set, so if shellcheck cannot see its use the likely correct fix is marking the intent, not removing a load-bearing constant. Establish which by finding its real consumers.Behavior portable serial 1:
muse spawn from a marked backend should succeed- the test expectsmuseto spawn andfm-spawnrejects it as unknown. Determine which side is wrong (adapter registration, the spawn path's kind handling, or the test's expectation) and fix that side rather than whichever is easier to change.Also failing: Behavior portable serial 2, 3 and 4; Behavior portable parallel 1 and 2; Behavior tests (Herdr); Stock macOS Bash snapshot compatibility. Diagnose each from its own logs. Do not assume they share a cause, and do not assume they differ.
Constraints that do not bend
Never silence a check, add
continue-on-error, delete a failing test, or loosen an assertion to obtain green. A quietly disabled or skipped check is a worse outcome than a red one and will be rejected.Never weaken the "PR must be raised via no-mistakes" guard into accepting any hand-raised PR.
Each fix must address the actual defect. If a test encodes a wrong expectation, say so and correct the expectation deliberately, with the reasoning in the commit.
Anything that cannot be fixed is reported plainly, with evidence, rather than worked around.
Scope boundary
This is a repair, not a refactor. Do not restructure the CI workflow, the test runner, or the harness registry beyond what a specific failure requires. Do not fold in unrelated improvements noticed on the way.
Repo rules that bind this change
firstmate-coding-guidelinesapplies: one full sentence per line in Markdown, plain dash never an em dash, shellcheck-clean shell,bin/fm-lint.shpassing before a script change is done, tests colocated intests/as<subject>.test.shextending an existing script, tests driving behaviour through an executable interface and never asserting implementation-source bytes, and no agent name as a commit co-author.Herdr lifecycle work runs only through the guarded lab helper with a named non-
defaultsession; never hand-written Herdr lifecycle commands.Accepted scope additions
From the admiral: the "PR must be raised via no-mistakes" guard fails on every fork PR (evidence: run 31901295309). The structural cause is that this repository is registered with a fork URL, so the pipeline's
prstep targets upstream and is skipped, forcing hand-raised PRs that carry no pipeline signature. Fix by letting the pipeline target the fork, or by letting the guard verify genuine validation evidence - never by weakening the guard.From the captain:
bin/fm-control.sh:814passes--relaunchtofm-spawn.sh, which only accepted--reuse-worktree, so--relaunchfell through into the positional list and PROJ became the literal string--relaunch.fm-control relaunchis broken fleet-wide. Fix it and cover it with a test in this PR.Accepted exclusions for this pull request
Three pre-existing failures were unmasked once the failures above stopped aborting their suites first. All three are present at this branch's own starting commit and sit in subsystems unrelated to this task's cause, so the captain ruled they ship as separate follow-up work rather than expanding this change: an oversized unread status line producing no annotation (
fm-wake-queue), a completed one-shot process source that stays owned so a second start refuses (fm-procevent), and a duplicate captain answer that names a different case on each run (fm-calm-pi-extension).Two further reds are environmental and explicitly out of scope, with the evidence for each recorded in this pull request rather than worked around: one
fm-watch-triagecase fails only on macOS and passes on Linux, so it never blocks CI; and the three remote-secondmate suites decline because machine capacity is measured on the real machine and the pinned test measurements cannot cross the remote job worker'senv -iboundary, so they pass on a runner with memory headroom.Definition of done
maingoes green, or every remaining red is a genuine unfixable-here environmental limit named explicitly, with evidence, in the pull request.bin/fm-lint.shclean, and the full portable behaviour suite passing locally.What Changed
fm-fleet*,fm-accounts*, andfm-capacitylibraries, thefm-dispatch-select.mjsselector, Copilot and Cursor quota sources, a quota statusline, andfm-model-refresh, all covered by the newtests/federation/suites and golden files.fm-runtime-handoff.sh,fm-handoff-doc.sh) that preserves mode and yolo posture, plus verification docs for the agy, cline, copilot, and cursor-agent harness adapters.fm-spawn.shto accept fm-control's--relaunchverb (fixingfm-control relaunchfleet-wide, with tests), routes the cmux/orca/herdr backends through the shared composer owner, reaps herdr worktree processes on teardown, and makes the no-mistakes-required guard re-read the live PR body so signed PRs no longer fail on stale event-payload snapshots.Risk Assessment
Testing
Re-ran the required herdr presentation e2e lane end-to-end against the real pinned herdr 0.7.4: the round-1 deterministic focus failure is fixed by df5389d's teardown reorder and the suite now passes 23/23 (transcript archived as evidence). Targeted suites for the intent's named defects - muse marked-backend spawn, fm-control relaunch (both new suites), and teardown's own regression suite - all pass. Verified round 1's composer-fence auto-fix is retained, found the same fail-closed tripwire shape on the branch-added bin/fm-statusline-quota.sh, applied the analogous one-case mapping fix, and re-verified
--changedexits 0 and the runner's own suite stays green. No lint or broad suite runs (CI owns those); worktree left clean apart from the intentional runner fix.Evidence: Herdr presentation e2e transcript (round 2, real herdr 0.7.4) - 23/23 ok
Source: Herdr presentation e2e transcript (round 2, real herdr 0.7.4) - 23/23 ok
Evidence: Formerly-failing herdr teardown/focus cases now passing
Evidence: muse marked-backend spawn case (Behavior portable serial 1 intake failure) passing
Evidence: fm-control relaunch coverage (captain's scope addition) passing
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-spawn.sh:3069- Herdr relaunch still fails, in the same feature this change claims to durably fix. The new adoption branch at bin/fm-spawn.sh:2127 sets only T/WT_TARGET/SES and skips thecase "$BACKEND"block that is the sole assigner of HERDR_SES, HERDR_WORKSPACE_ID, HERDR_TAB_ID and HERDR_PANE_ID (bin/fm-spawn.sh:2186-2320). spawn_write_meta_locked then dereferences all four at lines 3069-3072 underset -eu(bin/fm-spawn.sh:192). Concrete sequence: a task with backend=herdr, whose meta carrieswindow=<session>:<pane>, is relaunched viabin/fm-control.sh <id> relaunch(fm_control_backend_state_verified admits tmux and herdr, bin/fm-control-lib.sh:190). fm-control stops the agent, then fm-spawn runs--relaunch; fm_backend_target_of_meta returns the recorded window so REUSE_OLD_TARGET is non-empty and the adoption branch is taken; clear_relaunch_harness_wiring has already retired the previous incarnation's hooks and turn-end token; the script then aborts withHERDR_SES: unbound variablebefore publishing any record. The task is left stopped, with stale meta and no wiring - precisely the "task left running nothing at all" outcome the commit message says it is eliminating. The upstream implementation of this same feature (2d2be63, bin/fm-spawn.sh:1007-1012) repopulated those four variables from the task record before adopting the endpoint; that block was not carried over. Fix at that shared boundary rather than by guarding each echo: on the adoption path, read the recorded backend endpoint keys back into the variables (or exclude them fromdrop_reso the recorded values survive the rewrite). Defaulting them to empty would not be enough - an empty herdr_session=/herdr_pane_id= record breaks fm_backend_validate_task_endpoint for teardown. Note the same block reads ZELLIJ_* and CMUX_* (lines 3075-3085); those backends are currently saved only by the endpoint-state refusal above, because unlike upstream this path never calls fm_control_backend_state_verified..github/workflows/no-mistakes-required.yml:25- The intent lists an accepted scope addition that this change does not appear to satisfy: "From the admiral: the 'PR must be raised via no-mistakes' guard fails on every fork PR (evidence: run 31901295309). The structural cause is that this repository is registered with a fork URL, so the pipeline'sprstep targets upstream and is skipped, forcing hand-raised PRs that carry no pipeline signature. Fix by letting the pipeline target the fork, or by letting the guard verify genuine validation evidence - never by weakening the guard." Neither named fix path is present in the diff: .github/workflows/no-mistakes-required.yml is untouched between 8b22be8 and 55a2b51 (it still accepts only the literalUpdates from [git push no-mistakes]body marker and has gained no validation-evidence path), and no in-repo registration or remote-targeting change accompanies it. The other named option - retargeting the pipeline at the fork - is a no-mistakes registration outside this repository, so it cannot be confirmed from source here. Flagging rather than resolving: choosing between amending the guard to verify genuine validation evidence and treating the registration retarget as already done externally is the author's call, and the intent explicitly forbids weakening the guard, so this must not be auto-fixed. Please confirm which path was taken and, if it was the registration retarget, record that evidence in the pull request as the intent's "Definition of done" requires.docs/configuration.md:599- Ten documented per-backend composer knobs became silent no-ops in commit 2a09a2d but are still documented as live configuration. bin/backends/herdr.sh dropped FM_BACKEND_HERDR_COMPOSER_LINES, FM_BACKEND_HERDR_IDLE_RE, FM_BACKEND_HERDR_BARE_PROMPT_RE and FM_BACKEND_HERDR_PI_COMPOSER_MAX_LINES; bin/backends/orca.sh dropped FM_BACKEND_ORCA_COMPOSER_LINES/IDLE_RE/BARE_PROMPT_RE; bin/backends/cmux.sh dropped FM_BACKEND_CMUX_COMPOSER_LINES/IDLE_RE/BARE_PROMPT_RE. A repo-wide grep finds no remaining reader for any of them outside docs/. The shared owner now uses FM_COMPOSER_CAPTURE_LINES, FM_COMPOSER_IDLE_RE and FM_COMPOSER_PI_MAX_LINES instead. docs/configuration.md:599-611 still describes all ten, including per-backend override semantics and default values (e.g. FM_BACKEND_ORCA_COMPOSER_LINES=200, which the adapter deliberately abandoned for a 20-row tail). No test cross-checks docs/configuration.md against defined variables, so CI will not catch this. Update those entries to point at the shared FM_COMPOSER_* knobs, and mention the same for the FM_BACKEND_HERDR_BARE_PROMPT_RE reference in docs/herdr-backend.md if it carries one.bin/fm-composer-lib.sh:342- The SC2034 suppression added in d2875dd justifies itself with consumers that a later commit on this same branch deleted. The comment reads# shellcheck disable=SC2034 # Read by sourcing callers (bin/backends/{orca,cmux}.sh)., and the two lines above assert "its only consumers source it". That was accurate when d2875dd landed, but 2a09a2d rewrote both adapters to delegate to fm_composer_classify_screen and removed FM_BACKEND_ORCA_BARE_PROMPT_RE and FM_BACKEND_CMUX_BARE_PROMPT_RE. At the branch tip FM_COMPOSER_BARE_PROMPT_RE_DEFAULT has no production reader at all - the shared classifier uses FM_COMPOSER_AGENT_PROMPT_GLYPHS (bin/fm-composer-lib.sh:396) instead - and its only remaining reference in the tree is tests/fm-copilot-harness.test.sh:157. The intent asked to "Establish which by finding its real consumers"; that answer changed inside the branch and the justification was not revisited. Correct the comment so it names the real remaining reader rather than two files that no longer reference it. Whether the constant itself should now be retired or re-wired into the shared glyph set is an intent-bearing call that should not be made mechanically - the fleet-wide glyph documentation in .agents/skills/harness-adapters/SKILL.md:526 still treats it as the canonical bare-prompt set.bin/backends/orca.sh:248- fm_backend_orca_read_text_paged was the only consumer of the 200-line backward-paged scrollback read, and the composer rewrite replaced it with a bounded tail capture. A repo-wide grep now finds the definition at bin/backends/orca.sh:248 and zero call sites in bin/, tests/ or docs/. ShellCheck does not flag unused functions, so nothing will surface it. Either delete it or add a one-line note recording why it is retained, so the next reader does not treat it as a live paging primitive that the tail capture is expected to fall back to.bin/fm-spawn.sh:3027- The new writability probeif ! : >> "$meta"creates state/<id>.meta as a side effect on a fresh spawn, before the replacement record is built. If any later step in spawn_write_meta_locked fails - themktempat line 3037 returning non-zero, or the{ ... } >> "$tmp"block failing - the function returns 1 and the caller exits, but the zero-byte state/<id>.meta the probe created is left behind. Before this change no file was created on that path. Every field-reader (fm_meta_get, fm_backend_of_meta, fm_backend_target_of_meta) returns empty for it, so the empty file reads as a malformed task rather than as an absent one to state/ scanners. Track whether the probe created the file and remove it on the failure paths, or run the probe against a sibling temp path instead.tests/fm-copilot-harness.test.sh:157- This change correctly replaced the two source-grep fences in test_backend_idle_re_defaults_cover_copilot and test_shared_idle_default_covers_cline with assertions driven through fm_composer_classify_screen. One same-pattern assertion survives inside the very function that was edited: line 157 pipes a bare glyph throughgrep -qE "$FM_COMPOSER_BARE_PROMPT_RE_DEFAULT", which proves only that a constant holds a particular regex, not that copilot's bare-glyph composer row classifies correctly. It is now also the only remaining reference to that constant in the tree, which is what keeps a production-dead constant looking alive. Express it the same way the two rewritten fences were: feed a bare❯composer row plus a styled=0/cursor=0/identity=0 capability descriptor to fm_composer_classify_screen and assert the verdict, so the test exercises the classifier every adapter actually calls. Scoped to this function only - not a repository-wide test sweep.🔧 Fix: restore relaunch endpoint identity from the task record
3 infos still open:
tests/fm-spawn-relaunch-endpoint.test.sh:106- The positive half of the new suite proves nothing on its own, so the actual fix has no assertion that can fail. test_complete_herdr_endpoint_identity_passes_the_adoption_gate runsrun_relaunch ... || trueand then only checks that the output does NOT contain "herdr endpoint identity" or "unbound variable". Any earlier exit satisfies both: if the herdr stub'sstatus --jsonshape stops satisfying spawn_validate_backend (bin/fm-spawn.sh:1176), or thepane get/agent getpair stops mapping to dead|missing so the endpoint-state case at bin/fm-spawn.sh:1186-1196 refuses, the spawn exits before spawn_adopt_endpoint_ids is ever called and the test still reports pass. Nothing anywhere asserts the positive outcome the fix exists for - that the four recorded ids are read back and republished into state/<id>.meta. The refusal test does pin the guard, but if spawn_adopt_endpoint_ids were reduced to only the missing-key check with the four assignments deleted, the refusal test would still pass and the complete-record test would then fail on "unbound variable" only by luck of ordering. Give the complete case a positive marker: assert the run reached a stage past the adoption gate (a later-stage message unique to the launch path), or - better - assert the republished record still carries herdr_tab_id=w1:t2 and herdr_pane_id=w1:p2 after the run, which is the property teardown depends on.tests/composer-fence.sh:26- The shared fence narrowed the backend set from herdr+cmux+orca to cmux+orca, dropping the one backend this branch actually rewired. The greps it replaced (tests/fm-cline-harness.test.sh at 8b22be8, lines 136-141) looped overherdr cmux orca; FM_TEST_COMPOSER_PLAIN_BACKENDS is now "orca cmux". herdr is excluded because it builds its capability descriptor inline (bin/backends/herdr.sh:2686-2688: styled=1/0, cursor=0, identity=1) instead of publishing a fm_backend_herdr_composer_caps like its two siblings, so the fence's stated principle - descriptors come from each backend's own function so drift is still exercised - cannot reach it. That matters here specifically: d2875dd's whole composer fix was binding herdr to the shared bare-prompt set, and herdr's descriptor is also the only plain-capture one with identity=1, a shape neither remaining backend covers. The fence header still frames the guarantee as holding "under EVERY backend's declared capabilities" (line 26) and the copied comment at tests/fm-cline-harness.test.sh:136 repeats it, so the narrowing is not recorded anywhere a reader would see it. Either extract fm_backend_herdr_composer_caps so herdr can join the loop the same way, or state in the fence header which backends are absent and why.bin/fm-composer-lib.sh:346- FM_COMPOSER_BARE_PROMPT_RE_DEFAULT now has zero readers anywhere in the tree - the copilot test's grep was the last one and this round replaced it - and it duplicates a glyph set that lives in a second spelling ten lines above, with nothing checking the two agree. The regex is '^(❯|›|→|⟩)'; the list the classifier actually consults is FM_COMPOSER_AGENT_PROMPT_GLYPHS='❯ › ⟩ →' (bin/fm-composer-lib.sh:381). They match today. The new comment (correctly, per the author's decision to keep the constant) promotes it to the published fleet-wide contract, and docs/configuration.md:675 now directs adapter authors at both names as "the one shared set", while .agents/skills/harness-adapters/SKILL.md:526 and docs/verification/cursor-agent-adapter.md:51 cite the regex alone as the promotion set. Concrete drift: a newly verified harness glyph is added to FM_COMPOSER_AGENT_PROMPT_GLYPHS - the only one classification reads - and the published regex silently stops describing the set every one of those documents points at, with no test and no ShellCheck signal. One equivalence assertion in tests/fm-composer-lib.test.sh (every glyph in the list matches the regex, and the regex matches nothing outside it), or deriving the regex from the list, closes it without touching the constant.tests/fm-backend-herdr-presentation-e2e.test.sh:914- tests/fm-backend-herdr-presentation-e2e.test.sh - part of the required "Behavior tests (Herdr)" job the PR must turn green - fails deterministically atprojected teardown changed active workspace/tab from w3/w3:t1 to w8/w8:t2(tests/fm-backend-herdr-presentation-e2e.test.sh:914, via assert_focus_is at :348). Two consecutive runs against the real pinned herdr (0.7.4, protocol 16 - the exact CI pin) failed identically. The merge-base run of the same script aborts earlier, at the abort-cleanup case this branch fixed, so this is a later failure newly reachable rather than one the branch introduced: the failing case is untouched by the diff, and the branch's bin/backends/herdr.sh edits are confined to capture/composer classification, not the teardown/close/focus path. It is the same "unmasked once the earlier failure stopped aborting the suite" shape as the three exclusions the captain already accepted, except this one sits inside a required lane and is not on the accepted list. I could not determine from macOS whether the Linux runner that actually hosts this job is affected - the workflow's own comment anticipates focus/cleanup invariants being platform-sensitive. The captain needs to decide: fix it, or name it explicitly as a remaining red with this evidence.bin/fm-test-run.sh:1015- Applied a one-line test-infrastructure fix: the new shared helper tests/composer-fence.sh had no entry in bin/fm-test-run.sh's changed-path map, sobin/fm-test-run.sh --changed- the local workflow CONTRIBUTING.md:79 documents - died on this branch withno changed-test mapping for source path: tests/composer-fence.sh(exit 2, its fail-closed tripwire). Added it to the existing shared-helper case (tests/lib.sh|tests/*-helpers.sh), which resolves its consuming suites by reference scan exactly as tests/cmux-test-safety.sh and tests/capacity-pin.sh already do.--changednow exits 0 and selects 96 scripts, and the runner's own suite (tests/fm-test-run.test.sh, 18 cases) still passes. No CI job consumes --changed, so this was not one of the nine reds.bash tests/fm-muse-harness.test.sh- 25/25 ok, including the intake failuremuse spawn from a marked backend should succeedRegression reproduction: same script run against a merge-base tree (git archive of 8b22be8 + this branch's test file) -not ok - muse spawn from a marked backend should succeed: error: unknown harness 'muse'bin/fm-test-run.shover 15 scripts: fm-control-relaunch, fm-spawn-relaunch-endpoint, fm-backend, fm-backend-orca, fm-backend-cmux, fm-cline-harness, fm-copilot-harness, fm-session-start, fm-spawn-capacity, fm-spawn-pool-base-freshen, fm-trace-context-spawn, fm-composer-lib, fm-composer-ghost, fm-backend-herdr, fm-brief -FM_TEST_SUMMARY total=15 failed=0Regression reproduction:tests/fm-control-relaunch.test.sh(48 cases) against the merge-base tree - fails on the first case; passes fully on this branchManual CLI transcript, base vs branch:fm-spawn.sh rl-demo --relaunch --harness claude [--mode direct-PR --yolo off]- base consumes--relaunchas the project path (cd: --: invalid option), branch reaches the record-driven relaunch pathCI jobStock macOS Bash snapshot compatibilityreplayed verbatim on macOS under/bin/bash3.2.57: parse sweep overbin/fm-lint.sh --list-files, thentests/fm-fleet-snapshot-view.test.sh(15 ok) andtests/fm-bearings-snapshot.test.sh(42 ok, the count the workflow bumped) - PASSCI jobTest coverage guard:bin/fm-test-run.sh --check-coverage-FM_TEST_COVERAGE ok total=168 parallel=24 serial=133 serial_shards=4 herdr=11bash tests/fm-watch-triage.test.shon macOS - 50 ok, exit 0 (the case the PR records as a macOS-only environmental red passes on this machine)bin/fm-test-run.sh tests/fm-backend-herdr-presentation-e2e.test.sh --fail-on-gate-skip 'herdr not found'against real herdr 0.7.4/protocol 16 - run twice, both fail identically atprojected teardown changed active workspace/tab from w3/w3:t1 to w8/w8:t2Same Herdr E2E against the merge-base tree - aborts earlier, atconcurrent post-create abort cleanup interleaved outside the presentation lock, the case this branch fixedbash tests/fm-test-run.test.sh- 18 ok, after my one-line changed-path map fixbin/fm-test-run.sh --list --changed --base <merge-base>- exit 0 and 96 scripts selected after the fix (exit 2 before it)🔧 Fix: fix(teardown): reap worktree processes after herdr focus-preserving close
1 info still open:
bin/fm-test-run.sh:1031- Applied a one-case test-infrastructure fix, the same shape as round 1's accepted composer-fence mapping:bin/fm-test-run.sh --changed(the local workflow CONTRIBUTING.md documents) failed closed with exit 2 onno changed-test mapping for source path: bin/fm-statusline-quota.sh. The branch-added statusline entrypoint is named by no test - only its parsing core bin/fm-statusline-quota-lib.sh is (tests/fm-runtime-handoff.test.sh:27), and the fixed-string reference scan for the entrypoint basename cannot match the lib's longer filename. Added a case resolving the entrypoint through the lib's consuming suites via the existing families_for_test_reference scan.--changednow exits 0 selecting 168 scripts, and the runner's own suite (tests/fm-test-run.test.sh) still passes. No CI job consumes --changed, so this was never one of the nine reds.bash tests/fm-backend-herdr-presentation-e2e.test.shagainst real pinned herdr 0.7.4 + treehouse v2.1.1 - 23/23 ok, exit 0, including the projected-teardown focus assertion (tests/fm-backend-herdr-presentation-e2e.test.sh:914) that failed in round 1bash tests/fm-muse-harness.test.sh- 25/25 ok, including the intake failure casemuse spawn from a marked backend should succeedbash tests/fm-control-relaunch.test.sh- all ok, covering the captain's fm-control --relaunch scope additionbash tests/fm-spawn-relaunch-endpoint.test.sh- ALL PASS, herdr endpoint-adoption gate on relaunchbash tests/fm-teardown.test.sh- all ok, regression guard on the df5389d teardown reorder (run-abort and reap both complete before the destructive worktree return)bash bin/fm-test-run.sh --list --changed- reproduced exit-2 fail-closed tripwire on bin/fm-statusline-quota.sh, then exit 0 with 168 scripts after the mapping fixbash tests/fm-test-run.test.sh- runner's own suite passes with the new mapping casebin/fm-test-run.sh:1031- Pre-existing uncommitted modification to bin/fm-test-run.sh (adds a families_for_changed_path mapping for bin/fm-statusline-quota.sh) was already present in the phase worktree before this documentation phase started. It is an executable change, so this phase neither reverted nor committed it; the outer executor should attribute it to its originating phase so it is not folded into the documentation commit.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.