Skip to content

feat(bin): merge upstream firstmate main into fork - #55

Merged
clarsen merged 327 commits into
mainfrom
fm/fm-upstream-merge-1122
Nov 23, 2026
Merged

clarsen merged 327 commits into
mainfrom
fm/fm-upstream-merge-1122

Conversation

@clarsen

@clarsen clarsen commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Intent

pull in upstream firstmate changes from kunchenguid/firstmate and

  1. identify any local changes or additions that are better implemented by upstream
  2. propose useful changes or additions as PRs to upstream

Context: this home runs from the fork github.com/clarsen/firstmate (origin). Upstream is https://github.com/kunchenguid/firstmate.git. The last upstream merge into the fork was PR 44 (feat: merge upstream firstmate main and repair fork CI, 2026-10-31). Open fork PRs: #49 and #50 (Wake). This task covers only the first part: pulling upstream into the fork. Parts 1 and 2 are handled by a separate review.

What Changed

  • Merges the latest kunchenguid/firstmate main into the fork, about 300 upstream commits. Upstream adds:
    • a Hermes harness adapter (fm-hermes-*)
    • the Lavish URL snapshot skill and tool (fm-lavish-url)
    • parking for ship lanes and Codex Stop (fm-park.sh, fm-codex-stop-park.sh)
    • adaptive lane capacity from host vitals (fm-lane-vitals-lib.sh)
    • a Claude account quota check, a /stow guard before compaction, hc lab and installer scripts, and a Linux Docker test runner
    • fixes to watcher, supervision, herdr/rex/tmux backends, remote secondmates, captain holds and PR merge watching
    • matching docs, skills and tests
  • Fixes fork code and tests that the merge broke:
    • puts back the upstream single-attempt budget lock acquire and the upstream autoarm wake banner block
    • removes a duplicated watcher cleanup and member env loop, and unifies how claude-accounts lists are detected
    • restores test fixtures the merge dropped: the FM_HOME export in the spawn-dispatch-profile helper, and watch_window_key-based state file names in watch-triage
    • holds the alarm-test arm claim until the guard charges the budget, and adds a SC2016 suppression for the deliberate hold_claim quoting
  • Restores docs the merge dropped (auto-arm and session-lock facts, account docs), removes a stale shard doc, and makes CONTRIBUTING require serial shard 13 in its checks.

Merge ancestry

The previous upstream sync was squash merged in the fork. This branch first records its original upstream parent (30d6d15e) in an ancestry-only merge commit, then merges upstream main (427056c4) with a normal merge commit. The ancestry commit changes no files.

Conflicts and resolutions

Conflicted path Resolution
.agents/skills/bootstrap-diagnostics/SKILL.md Kept fork diagnostic triggers and added upstream RECORD_HYGIENE.
.agents/skills/harness-adapters/references/harness/claude.md Kept fork Keychain account slot behavior and documented upstream worker account selection as a separate mode.
.agents/skills/operational-home-layout/SKILL.md Kept fork home paths and added the upstream account, branch prompt, and Lavish URL paths.
.agents/skills/ship-landing/SKILL.md Kept fork landing controls and incorporated upstream parked lane handling.
.claude/settings.json Kept fork portal capture hooks and added upstream stow guard and StopFailure auto-arm.
.github/workflows/ci.yml Kept GitHub-hosted macOS runner variable and dedicated serial shard; added a shared shard to stay under the test packing budget.
README.md Kept fork Bearings sections and added upstream /lavish-url.
bin/fm-bearings-snapshot.sh Kept fork project issue and separate captain question projections; added upstream full hold question text.
bin/fm-busy-event.sh Kept fork atomic lock acquisition and added upstream stale lock timeout retry.
bin/fm-captain-hold.sh Kept fork separate captain question ownership and upstream attended-only release handling.
bin/fm-claude-stop-autoarm.sh Kept fork renewal and moved-session ownership proof; incorporated upstream interruption identity and StopFailure behavior.
bin/fm-crew-state.sh Kept fork watcher ledger label and upstream run identity/parked lane details.
bin/fm-dod-lib.sh Kept fork edit member definition of done and upstream excluded-ref handling for containment checks.
bin/fm-lock.sh Kept fork background Claude move-to-self proof and used upstream shared PID reclaim verdict.
bin/fm-pr-check.sh Kept fork multi-repository PR handling and added upstream scan interface and timeout source.
bin/fm-session-lock-lib.sh Kept fork moved-session proof and upstream conservative live-owner reclaim predicate.
bin/fm-spawn.sh Kept fork task members, setup hooks, and clean stale-submodule realignment; added upstream lane capacity, Herdr lease, relaunch isolation, Hermes metadata, and explicit worker account selection. Keychain slots remain in their existing format.
bin/fm-teardown.sh Kept fork member cleanup and added upstream GitLab MR opt-in and exclusion of no-mistakes remote refs from unpushed-work checks.
bin/fm-test-run.sh Kept dedicated final shard and incorporated upstream test families and duration hints; used 13 serial shards for the enlarged inventory.
bin/fm-watch.sh Kept fork supervision flow and upstream PR degraded-watch and process-event behavior.
docs/architecture.md Kept fork supervision architecture and added upstream timeout and paused lane details.
docs/configuration.md Kept fork Keychain slot instructions without conversion and documented the upstream config-directory account mode, branch prompt, and Lavish URL settings.
docs/fm-test-portable-shards.md Kept dedicated shard explanation and updated the shared count and packing rationale.
docs/scripts.md Kept fork project issue and captain question script entries and added upstream Lavish URL, procinfo, and StopFailure entries.
docs/turnend-guard.md Kept fork renewal and host guards; documented upstream StopFailure and interrupted-session identity checks.
docs/verification/process-event-sources.md Kept fork Lavish process-event verification and added upstream detached startup owner proof.
docs/verification/supervision.md Kept fork supervision checks and restored upstream StopFailure verification.
docs/watcher-continuity.md Kept fork moved-session continuity and added upstream reclaim verdict details.
tests/assets/board-render-harness.mjs Kept fork board question and issue fixtures alongside upstream rendering fixtures.
tests/fm-backlog-atomicity.test.sh Kept fork GitLab close replay and restored upstream discarded scout close replay.
tests/fm-bearings-board-render.test.sh Kept fork board rendering checks and restored upstream full decision question case.
tests/fm-bearings-snapshot.test.sh Kept fork Bearings cases and restored upstream full local/secondmate question cases.
tests/fm-claude-stop-autoarm.test.sh Kept fork moved-session tests and restored upstream interrupted-session cases.
tests/fm-extension-binding.test.sh Kept fork binding tests and upstream extension cases.
tests/fm-procevent.test.sh Kept fork Lavish process-event cases and upstream source cases.
tests/fm-spawn-dispatch-profile.test.sh Kept fork dispatch profile cases and upstream profile cases.
tests/fm-turnend-guard.test.sh Kept fork host guard cases and upstream StopFailure cases.

Fork main catch-up conflict

While the upstream merge was being validated, fork main landed the Wake and fleet ledger changes. A second normal merge brings those commits into this branch.

Conflicted path Resolution
tests/fm-control-relaunch.test.sh Kept the fork's recorded-PR relaunch regression and the newly landed fleet ledger relaunch cases; extended the pre-publication fixture wait to cover the merged safety checks and supplied a fake Pi executable for the Herdr launch proof.

Validation rebase conflicts

When no-mistakes replayed the merge branch onto the newer fork main, it reported two more conflicts. The resulting merge commit (dfc93097) has no net change to either path relative to the upstream merge branch; the combined content from the upstream merge was kept.

Conflicted path Resolution
.agents/skills/operational-home-layout/SKILL.md Kept the merge branch's combined fork Keychain account behavior and upstream account, branch prompt, and Lavish URL paths.
docs/scripts.md Kept the merge branch's fork project issue and captain question entries together with upstream Lavish URL, process-event, and StopFailure entries.

Risk Assessment

⚠️ Medium: The latest commits put bin/fm-turnend-guard.sh's budget-lock acquire back to a single attempt, as upstream has it, which is what the user asked for. The test fix replaces a timing sleep with a bounded handshake and can't deadlock. But this is a 340-file upstream merge, and this pass judged only the files the latest fix commits changed. Merging still needs a green CI run of the flaky auto-arm suites.

Testing

I minted a disposable lab FM_HOME and ran a real Claude Code primary in it on a private tmux socket. It completed a prompted turn with the merged hook set (session start, pretool checks, host mirror, turn-end guard and Stop auto-arm), resolved FM_HOME to the lab, and ended without a spurious guard block. I also armed a real fm-watch.sh in the lab and sent its exact PID SIGTERM. Its cleanup released .watch.lock and the owner directory and published .watcher-down, leaving no stale or .steal locks; fm-watch-arm reported the exit honestly. The targeted suites all passed on a moderately loaded host: turn-end guard (including all attended-alarm variants that were flaky in earlier rounds), watcher-lock, both wake-daily collectors, and spawn-dispatch-profile. On this host, tmux capture-pane crashes the tmux server even for a trivial pane, so I captured the lab pane with pipe-pane instead. That is an environment quirk, not a product issue. I tore the lab down and the worktree is clean. This change has no UI surface, so the evidence is CLI transcripts and logs.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Real Claude primary in a lab home runs a turn with the merged hook set: FM_HOME resolves to the lab and every hook (SessionStart, PreToolUse, PostToolUse, Stop) completes without blocking or erroring ✅ pass live lab-primary-transcript.txt: 'FM_HOME=~/tmp/fm-lab.ML6El2', 'running PreToolUse hooks… 0/6', 'running Stop hooks… 1/7', 'Baked for 7s · done' with no guard block
Adversarial: SIGTERM a real lab watcher while it holds its lock; the single surviving watcher_cleanup releases .watch.lock, its owner directory and any .steal lock, and publishes the downtime marker ✅ pass live lab-watcher-term.log: before, .watch.lock -> owner.ra0sGR owned by pid 3478101; after TERM, the pid is gone, no .watch.lock, owner or .steal entries remain, .watcher-down is present; lab-watch-arm.log…
The turn-end guard with upstream's single-attempt budget lock still reaches the attended alarm exactly once in every auto-arm variant (arm, signal, alarm-signal, lost hand-back) ✅ pass live bash tests/fm-turnend-guard.test.sh exit 0 (96 ok), including 'the exhausted auto-arm commits the attended alarm once…' and 'interruption reaches the attended alarm…'
Watcher lock and startup-interruption recovery (upstream fix #8025, which the merge's duplicate block had dropped) behaves correctly ✅ pass live bash tests/fm-watcher-lock.test.sh exit 0 (72 ok)
Wake daily collector, including the rework pipeline from the fork-main merge, produces the expected report from pipeline fixtures ✅ pass live bash tests/fm-wake-daily.test.sh and bash tests/fm-wake-daily-rework.test.sh exit 0
Ship and scout spawn launches carry FM_HOME after the merge (CI shard repair) ✅ pass live bash tests/fm-spawn-dispatch-profile.test.sh exit 0, 'all fm-spawn-dispatch-profile tests passed' (114 ok)
Evidence: Lab Claude primary transcript (ANSI-stripped)
�7�8 ▐▛███▛█Claude Codev2.1.330▝▜██████▀Opus 5.5 · Claude Ultra ▝▝   ▝▝ ~/.no-mistakes/worktrees/6442e268076a/01M82VFKJKQ9SMEZE16XSS5JKA◐ medium · /effort────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────❯ Try "fix typecheck errors"────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────⏵⏵ auto mode on (shift+tab to cycle) · ← for agentsctlarsen@ctlarsen {run-worktree} (HEAD) | Opus 5.5�(B�Run exactly this shell commandandshowitsoutput,nothingelse:printf'FM_HOME=%s\n'"$FM_HOME";bin/fm-crew-state.sh2>&1|head-5❯  · esc to interrupt❯ Run exactly this shell command and show its output, nothing else: printf 'FM_HOME=%s\n' "$FM_HOME"; bin/fm-crew-state.sh 2>&1 | head -5                                                               ✽Reticulating… (running UserPromptSubmit hooks… 0/3 · 0s)12❯ Run exactly this shell command and show its output, nothing else: printf 'FM_HOME=%s\n' "$FM_HOME"; bin/fm-crew-state.sh 2>&1 | head -5                                                               ✻✶*✢· 7d:51%✢*✶✻✽✻✶*●Running1shellcommand…✢…·g n✢i…  ⎿  $ printf 'FM_HOME=%s\n' "$FM_HOME"; bin/fm-crew-state.sh 2>&1 | head -5(running PreToolUse hooks… 0/6 · 3s)5*tg3s · ↓ 11 tokens)●✶8✻an234ctx:6 7d:51%Priting FM_HOME and firstlinesofcrewstateReticulng…✽Reticulating…4497499 ✻Reticulating…108 tokens)15✶6running PosToolUse hook · 4s · ↓116 tokens)4s · ↓ 116 okens)*9✢20●Reticulating…2·535Reticulating…7✢830 *1✶✻✽Reticulating…6 · thinking)●thinking✻thinking✶54*62✢6thinking·7770 Ran 1 shell command ●FM_HOME=~/tmp/fm-lab.ML6El2usage: fm-crew-state.sh <id>Reticulating…running Stop hooks…1/7 · 7s · ↓170 tokens · thinking)295thinking56✻Baked for 7s · done 4:13 PM❯ 
Evidence: Lab watcher arm output

watcher: started pid=3478101 (beacon fresh) watcher: FAILED - watcher cycle exited 143 without an actionable reason ARM_EXIT=143

watcher: started pid=3478101 (beacon fresh)
watcher: FAILED - watcher cycle exited 143 without an actionable reason
ARM_EXIT=143
Evidence: Watcher state before/after SIGTERM
== before TERM
    PID COMMAND
3478101 bash {run-worktree}/bin/fm-watch.sh
lrwxrwxrwx. 1 ctlarsen   63 Nov 22 16:14 .watch.lock -> ~/tmp/fm-lab.ML6El2/state/.watch.lock.owner.ra0sGR/
drwx------. 2 ctlarsen 4096 Nov 22 16:14 .watch.lock.owner.ra0sGR/
~/tmp/fm-lab.ML6El2
3478101
linux-starttime=165419079 cmdline-hex=62617368002f686f6d652f63746c617273656e2f2e6e6f2d6d697374616b65732f776f726b74726565732f3634343265323638303736612f30314d383256464b4a4b5139534d455a453136585353354a4b412f62696e2f666d2d77617463682e736800
proc-starttime=165419079
{run-worktree}/bin/fm-watch.sh
== after TERM
    PID COMMAND
watcher 3478101 gone
-rw-r--r--. 1 ctlarsen    0 Nov 22 16:15 .last-watcher-beat
-rw-------. 1 ctlarsen   43 Nov 22 16:15 .watcher-down
-- state files
crew-ledger.json	     .last-heartbeat		.watch-cycle-exits.log
home-summary.json	     .last-watcher-beat		.watcher-down
.inactive-outcome-reconcile  .secondmate-liveness-tick
.last-check		     terminal-outcomes/
Evidence: turn-end guard suite log
ok - fm_supervision_unhealthy: false with no state/*.meta at all
ok - fm_supervision_unhealthy: true with in-flight task and no beacon ever
ok - fm_supervision_unhealthy: true with in-flight task and a beacon far outside the grace window
ok - fm_supervision_unhealthy: false with in-flight task and a fresh beacon
ok - fm_supervision_status: FM_SUP_QUEUE_PENDING tracks state/.wake-queue
ok - fm_supervision_needed: X-mode relay poll needs supervision
ok - fm_supervision_unhealthy: source-only home needs supervision
ok - fm_supervision_needed: a registered custom check needs supervision with no task in flight
ok - fm_supervision_needed: a registered check whose bytes drifted still needs supervision
ok - fm_supervision_needed: false for a check.sh with no registration binding
ok - fm_supervision_needed: a task PR poll without a trust binding is not a registered custom check
ok - fm_supervision_status: the relay shim is not counted as a registered custom check
ok - fm-turnend-guard: silent no-op with nothing in flight
ok - fm-turnend-guard: blocks when a fresh beacon has no live watcher lock
ok - fm-turnend-guard: non-Claude path blocks a source-only home
ok - fm-turnend-guard: blocks on a dead watcher lock even when the beacon is fresh
ok - fm-turnend-guard: silent no-op with a live watcher lock and fresh beacon
ok - fm-turnend-guard: healthy non-Claude harness paths ignore Claude episode contention
ok - fm-turnend-guard: blocks on a live watcher lock with an ancient beacon
ok - fm-turnend-guard: blocks with the exact required reason in the primary when unhealthy
ok - fm-turnend-guard: blocks from active FM_HOME state, not only repo-root state
ok - fm-turnend-guard: X-mode repair reason sources the cadence config
ok - fm-turnend-guard: X-mode-only supervision remains guarded in default mode
ok - fm-turnend-guard: registered-check-only supervision is named in the block banner
ok - fm-turnend-guard: ignores stale repo-root state when FM_HOME is set
ok - fm-turnend-guard: uses FM_STATE_OVERRIDE ahead of FM_HOME/state
ok - fm-turnend-guard: stop_hook_active=true always allows the stop (never blocks twice in one turn)
ok - fm-turnend-guard: blocks a blind turn end in a secondmate's own home (.fm-secondmate-home no longer excludes it)
ok - fm-turnend-guard: idle-by-default - silent in a secondmate home with nothing in flight
ok - fm-turnend-guard: stop_hook_active=true allows the stop in a secondmate home (never blocks twice in one turn)
ok - fm-turnend-guard: secondmate deferred-death recovery - silent while watched, forces re-arm once the watcher exits
ok - fm-turnend-guard: inert in a secondmate's own child worktree (linked git worktree) even when unhealthy
ok - fm-turnend-guard: blocks a blind turn end in a treehouse-leased LINKED secondmate home (marker force-include)
ok - fm-turnend-guard: an invalid (empty) marker cannot spoof inclusion; linked worktree stays exempt
ok - fm-turnend-guard: a non-ASCII marker cannot spoof inclusion; linked worktree stays exempt
ok - fm-turnend-guard: inert in a crewmate/scout task worktree (linked git worktree) even when unhealthy
ok - fm-turnend-guard: fails open (never blocks) when jq is missing
ok - fm-turnend-guard: silent no-op on empty stdin
ok - fm-turnend-guard: runs well under the generous timing margin (0s)
ok - fm-turnend-guard-grok: forces one explicitly marked same-session resume when the shared predicate blocks
ok - fm-turnend-guard-grok: legacy environment loop guard prevents a nested resume loop
ok - fm-turnend-guard-grok: native false delegates blocking feedback with zero resume processes
ok - fm-turnend-guard-grok: native true remains bounded and starts no resume process
ok - fm-turnend-guard-grok: both spellings are typed and camelCase has deterministic precedence
ok - fm-turnend-guard-grok: malformed, invalidly typed, and missing-prerequisite payloads start neither path
ok - fm-turnend-guard-grok: missing jq and no-supervision-needed stops stay silent and bounded
ok - tracked .claude/settings.json entries: 10 inert under grok, the documented subagent exception still armed, all live under Claude
ok - .codex/hooks.json: Stop hook uses hook process root when payload cwd is outside
ok - .codex/hooks.json: Stop hook ignores nested git root guard scripts
ok - .codex Stop wrapper: clean success JSON, inherited PATH, unchanged errors and continuation without logout output
ok - .opencode primary plugin: guard path is anchored to worktree, not directory
ok - .pi primary extension: no-tool and multi-tool runs each inject exactly one guard follow-up
ok - .pi primary extension: delivery failure resets the logical-run latch
ok - .pi primary extension: a nested load keeps the live session's turn-end marker
ok - .pi primary extension: the turn-end guard reads a Windows-tagged session lock only on Windows
ok - fm-turnend-guard --claude: re-blocks a loop-guarded stop while unhealthy and unclaimed (incident regression)
ok - fm-turnend-guard --claude: X-mode-only homes re-block when auto-arm recovery is absent
ok - fm-turnend-guard --claude: a live arming epoch advances once and repeated observation is idempotent
ok - fm-turnend-guard --claude: repeated failed-to-arming races make bounded monotonic progress
ok - fm-turnend-guard --claude: terminal owner boundary excludes a concurrent start without deadlock
ok - fm-turnend-guard --claude: fresh rewake epoch prevents a duplicate continuation for the same event
ok - fm-turnend-guard --claude: a fresh renew epoch prevents a duplicate continuation; a stale one re-blocks
ok - fm-turnend-guard --claude: an abandoned auto-arm claim no longer allows a blind stop (incident regression)
ok - fm-turnend-guard --claude: a claim whose pid was reused stops counting as recovery even while its entry reads arming
ok - fm-turnend-guard --claude: a hung owner frozen at arming with no watcher beat no longer allows a blind stop
ok - fm-turnend-guard --claude: a live open generation claim owns recovery with no lock held
ok - fm-turnend-guard --claude: a stuck generation claim no longer allows a blind stop
ok - fm-turnend-guard --claude: the terminal path clears an abandoned claim instead of stepping aside silently
ok - fm-turnend-guard --claude: fresh failed epochs preserve and advance monotonic fail-open progression
ok - fm-turnend-guard --claude: integrated fresh failures reach one bounded fail-open, stop continuation, and reset on recovery
ok - fm-turnend-guard --claude: an inert auto-arm's frozen epoch reaches one bounded fail-open and resets on recovery
ok - fm-turnend-guard --claude: a frozen unverified epoch spends the budget yet still blocks
ok - fm-turnend-guard --claude: reset contention preserves all episode state until retry
ok - fm-turnend-guard --claude: concurrent auto-arm and guard resets are idempotent and deadlock-free
ok - fm-turnend-guard --claude: the exhausted auto-arm commits the attended alarm once, then stays suppressed until recovery
ok - fm-turnend-guard --claude: a repeatedly lost host hand-back on a pending or announced handling marker reaches the attended alarm
ok - fm-turnend-guard --claude: interruption reaches the attended alarm and preserves its final rewake after commit
ok - fm-turnend-guard --claude: stale rewake epoch does not allow a blind stop
ok - fm-turnend-guard --claude: budget exhaustion alone cannot permit a blind stop
ok - fm-turnend-guard --claude: verified fail-open is loud, bounded, attended, and non-repeating
ok - fm-turnend-guard --claude: fail-open requires both exhausted retries and consumed notice
ok - fm-turnend-guard --claude: away ownership excludes the Stop-autoarm fail-open
ok - fm-turnend-guard --claude: positive watcher recovery resets failure episode state
ok - fm-turnend-guard --claude: bounded claim wait avoids a token-consuming forced continuation
ok - fm-turnend-guard --claude: secondmate home re-blocks unclaimed and allows auto-arm-claimed stops
ok - fm-turnend-guard: a live away-mode daemon satisfies supervision with no watcher holding the lock
ok - fm-turnend-guard: away-mode daemon ownership survives a leftover dead watcher lock
ok - fm-turnend-guard: away mode with no daemon and no watcher still blocks
ok - fm-turnend-guard: away mode blocks on a dead away-mode daemon
ok - fm-turnend-guard: away mode blocks on a pid-reused away-mode daemon lock
ok - fm-turnend-guard: away-mode daemon ownership never substitutes for a fresh beacon
ok - fm-turnend-guard: a daemon lock proves nothing while away mode is off
ok - fm-turnend-guard: away-mode beacon freshness uses the poll-derived grace, not the flat default
ok - fm-turnend-guard: a dead away-mode daemon still blocks under the poll-derived grace
ok - fm-turnend-guard: the poll-derived grace is bounded, not unlimited
ok - fm-turnend-guard: with away mode off, the poll-derived grace never applies
EXIT=0
Evidence: watcher-lock suite log
ok - disposable watcher refuses inherited state outside its marked lab
ok - tombstone cleanup respects a live reaper and recovers a recycled reaper pid
ok - wait deadline diagnoses and reaps a stopped test child without hanging
ok - simultaneous watcher starts leave exactly one live process
ok - fm_pid_identity real ps fallback is locale-invariant
ok - fm_pid_identity is locale-invariant across LC_ALL/LC_TIME
ok - fm_pid_identity ps fallback is terminal-width-invariant
ok - /proc process identity ignores simulated btime changes
ok - /proc process identity detects pid reuse
ok - MSYS /proc process identity regression skipped on non-Windows host
ok - killed watcher stale lock is reclaimed
ok - dead watcher reclaim fails promptly when downtime marker cannot be published
tests/fm-watcher-lock.test.sh: line 2737: 2977509 Killed                  FM_STATE_OVERRIDE="$state" bash -c '
    . "$1"
    fm_lock_remove_path() {
      if [ "$1" = "$STATE/.watch.lock" ]; then
        kill -KILL "${BASHPID:-$$}"
      fi
      return 1
    }
    fm_lock_try_acquire "$2"
  ' _ "$LIB" "$lockdir" > /dev/null 2>&1
ok - stale watcher reclaim publishes durable recovery evidence before clear
ok - live watcher lock with stale heartbeat is actionable
ok - live watcher lock with a beacon past the hard bound is replaced, under it is still refused
ok - a fresh watcher replaces a live holder whose pre-UTC-pin identity no longer recomputes, and the old holder stands down unsignalled
ok - a replaced holder stands down cleanly even when its successor has already exited and released the lock
ok - guard banner leads when down with pending wakes (repair-after-drain) and stays silent when live and fresh
ok - concurrent fm_lock_try_acquire yields exactly one winner
ok - dead-pid stale lock is reclaimed by a single acquirer
ok - concurrent stale-lock steal yields exactly one winner
ok - dead steal owner is reclaimed once without a nested steal marker
ok - dead nested steal chain from an interrupted reclaim is recovered
ok - a competing link reaper cannot remove the successor's steal mutex
ok - a competing directory reaper cannot remove the successor's steal mutex
ok - a steal mutex abandoned by this process does not block its own reclaim
ok - a steal reap interrupted in this process is resumed from its own tombstone
ok - live steal mutex is not reclaimed
ok - live-held lock is not stolen
ok - lock whose recorded holder pid was reused by a live process is reclaimed
ok - live holder matching its recorded start time keeps its lock
ok - lock whose recorded identity no longer recomputes is reclaimed without signalling its pid; a matching or unrecorded identity stays held
ok - live supervise-daemon lock with a stale local-time identity and no start time is not reclaimed
ok - dead real-directory primary and steal locks recover without leaked owners
ok - a live nested owner blocks reclamation even in an old directory
ok - unreapable real-directory locks refuse promptly naming the wedged path
ok - inaccessible primary and steal directories refuse by name on both session claim paths
ok - failed directory entry stays retriable after concurrent removal or replacement
ok - ordinary wait keeps waiting until directory residue can be reclaimed
ok - failed owner publication discards the staging directory
ok - session-lock acquisition recovers directory residue and honors named refusal on both claim paths
ok - empty mid-acquire lock keeps a minimum grace
ok - late original claimant cannot claim a recreated lock
ok - bounded wait earns one grace window for an unpublished-pid lock, still bounds a live holder
ok - bounded deadline with an unpublished holder is retriable
ok - bounded deadline with an exited holder is retriable
ok - bounded deadline with a released lock is retriable
ok - bounded deadline preserves the live holder advisory
ok - bounded deadline rejects malformed pid data and non-directory locks
ok - paused mid-acquire claimant backs off to active stealer
ok - watch restart preserves recovery without signaling a reused pid
ok - watch restart attaches to a verified healthy peer and later surfaces a successor gap
ok - watcher self-evicts when the lock pid no longer names it
ok - watcher exits 1 with its reason when its state directory is torn down and recreated during startup
ok - arm turns clean self-eviction without a successor into a typed failure
ok - arm attaches to a live fresh watcher and fails loudly when that cycle has no successor
ok - attached arm signals record a classified lifecycle entry
ok - arm starts cleanly and resurfaces recovery after a dead-pid lock
ok - arm cleans child watcher and temp output on HUP
ok - arm defers TERM until startup watcher can run its lock cleanup
ok - arm TERM waits out a stalled singleton claim past the deadline and leaves no lock evidence
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 3093105.1795392591.Vf6bxM
WARNING: queued wakes pending - drain them with bin/fm-wake-drain.sh before anything else.
ok - arm propagates an immediate watcher wake before confirmation
ok - arm attaches to a peer watcher after child stands down and surfaces a missing successor
watcher: lock held by live pid 3114921 but heartbeat is stale for 848679007s (>300s); inspect or stop that watcher before re-arming.
ok - arm reports FAILED and exits non-zero when no fresh watcher can be confirmed
ok - cycle-exit ledger links a verified successor and remains size-capped
ok - arm confirms a watcher whose post-claim startup exceeds the legacy budget
watcher: FAILED - startup lock ~/tmp/fm-watcher-lock-tests.zx7c0R/arm-startup-lock-held/state/.wake-queue.lock held by live pid 3183617
ok - arm relays a live-holder startup-lock refusal and keeps the downtime drainable
ok - staged-owner cleanup removes only unpublished empty or self-owned staging
ok - startup cleanup waits for in-flight staging and publication, preserving foreign owners
ok - a stop forced before the safe point waits for it and leaves no lock evidence
ok - a watcher that cannot publish its identity exits through its cleanup
ok - SIGSTOP distinguishes live PID from stale beacon and termination records the exit class
EXIT=0
Evidence: wake-daily suite log
ok: Wake daily collector
EXIT=0
Evidence: wake-daily rework suite log
ok: Wake daily rework collector
EXIT=0
Evidence: spawn-dispatch-profile suite log
ok - allowlist=absent preserves the operational floor and filters only when opted in
ok - allowlist=missing-config preserves the operational floor and filters only when opted in
ok - allowlist=enabled preserves the operational floor and filters only when opted in
ok - allowlist=empty preserves the operational floor and filters only when opted in
ok - invalid allowlist names refuse before launch or task publication
ok - inaccessible config with present allowlist refuses before launch or task publication
ok - inaccessible config with absent allowlist refuses before launch or task publication
ok - inaccessible ancestor with present allowlist refuses before launch or task publication
ok - inaccessible ancestor with absent allowlist refuses before launch or task publication
ok - secondmate launch inherits the allowlist for subsequent worker launches
ok - local inheritance preserves the allowlist on source errors and mirrors proven absence
ok - remote inheritance preserves the allowlist on source errors and mirrors proven absence
ok - Codex absent, bypass, and restricted modes preserve flags for ships, scouts, and secondmates
ok - invalid Codex permission files refuse spawns and relaunches before mutation
ok - Codex restricted mode leaves other harness launch flags unchanged
WORKER-RAN
WORKER-RAN
WORKER-RAN
WORKER-RAN
WORKER-RAN
WORKER-RAN
skip: fish not found (fish pane launch); only a static syntax check ran
ok - launch appends the hooks config while preserving inherited Git credentials in sh, bash and zsh
ok - fm-spawn: actual ship/scout launch commands deliver the worker role contract
ok - no --model/--effort records defaults and types the claude launch instructions
ok - a claude launch publishes the brief as an operational-inbox record and passes only the doorbell
ok - a secondmate claude launch publishes its brief record into the secondmate's own home
ok - a claude spawn whose launch-brief record cannot publish stops with a clear error and sends no launch
ok - non-cursor launches clear inherited Cursor identity markers
ok - relative home overrides ignore CDPATH and become absolute before spawn launch construction
ok - FM_HOME defaults resolve relative paths and preserve absolute spellings
ok - absolute override spellings are preserved in spawn launch paths
ok - unresolvable relative spawn overrides fail with named diagnostics
ok - active crew-dispatch profile requires an explicit harness for ship spawns
ok - active crew-dispatch profile requires an explicit harness for scout spawns
ok - a non-clear dispatch record accepts the explicit flags of the manual intake
ok - a recorded dispatch selection refuses conflicting explicit launch flags
ok - a recorded dispatch selection allows the matching launch flags
ok - a task override with its reason permits a different launch and is recorded
ok - an effort the clear selection leaves unset is not bound
ok - a clear dispatch selection refuses a raw launch command unless a task override is recorded
ok - active dispatch refuses a spawn whose task has no recorded resolution
ok - batch dispatch checks each task against its own recorded selection
ok - active crew-dispatch profile allows the legacy positional harness form
ok - active crew-dispatch profile allows the raw launch-command escape hatch
ok - a raw launch ending in a separator or a comment still runs the worker, its disarm, and config warnings
ok - a raw launch keeps a reporter only for an established agent below its native floor
ok - a chained raw launch commits through the AI-trailer strip in every step
ok - claude receives --model and --effort profile flags
ok - codex receives --model and model_reasoning_effort profile flags
ok - codex Luna receives --model and model_reasoning_effort max profile flags
ok - codex omits max for models without the catalog capability
ok - a codex crewmate requests no hook layer and keeps its turn-end signal
ok - a codex secondmate keeps its project hooks and uses automatic approval review
ok - Codex defaults remain bypass; persistent fallback is direct and invalid values refuse
ok - grok receives --model and --reasoning-effort profile flags
ok - grok omits unsupported max reasoning effort
ok - grok omits unsupported xhigh reasoning effort
ok - cursor receives its model-qualified reasoning class and exact task workspace
ok - cursor refuses model ids absent from its resolved binary's live catalog
ok - cursor preserves the requested model when its live catalog is unreachable
ok - opencode receives the model and effort through its config
ok - opencode without an effort keeps the model pin and omits variant
ok - opencode emits the variant for an effort the openai family exposes
ok - opencode omits the variant for an effort outside the model family's list
ok - opencode 1.x keeps the --model flag and the variant-only config
ok - opencode 1.x without an effort keeps its permission-only launch config
ok - opencode probe and launch share the same resolved executable path
ok - opencode with an unparseable version falls back to the 1.x launch path
ok - opencode 2 delivery gate accepts an auto-submitted brief without pressing Enter
ok - opencode 2 delivery gate sends exactly one Enter for a brief left in the composer
ok - opencode 2 delivery gate keeps polling an unknown composer and sends one Enter once it reads pending
ok - opencode 2 delivery gate sends its one Enter at the deadline when the composer only reads unknown
ok - opencode 2 delivery gate fails the spawn when the brief turn never starts
ok - opencode 1.x launches keep their pre-gate delivery
ok - opencode provisions a busy-state plugin for every detected major, including the 1.x fallback
ok - native effort validator checks harness and model as separate axes
ok - Ultra is explicit for native Pi and Pi-signed, including direct-PR, and refuses unsupported profiles before provisioning
ok - batch dispatch preserves native Ultra in metadata and launch flags
ok - Pi scout spawn enters the recorded worktree before launch
ok - pi receives --model and --thinking max profile flags
ok - Pi launch probing omits --tui-mode on older Pi and preserves it on supporting Pi
ok - pi-signed shares Pi launch semantics while preserving its configured and recorded identity
ok - pi-signed refuses safely and actionably when the selected executable is unavailable
ok - pi-signed is a distinct persistent secondmate runtime with shared Pi supervision semantics
ok - seeded Pi/pi-signed secondmate launches carry session --approve when advertised
ok - ordinary Pi worker launches omit --approve
ok - Pi approve probing omits --approve when help does not advertise it
ok - Pi and pi-signed ship and scout launches carry the configured tool exclusions
ok - Claude ship and scout launches carry the configured tool exclusions ahead of the prompt
ok - a Claude exclusion list adds only its own flag to the launch
ok - Pi worker registries report unmatched and unverified exclusions without reporting exact matches
ok - an absent or empty exclusion list leaves every runtime unaffected
ok - a runtime that cannot hide tools, or a raw launch, refuses a non-empty exclusion list
ok - a malformed exclusion entry refuses the spawn before any launch or record
ok - Pi and pi-signed ship and scout launches refuse when the exclusion file disappears after its checks
ok - exclusions stay in the home that configured them and skip secondmate agents
ok - batch dispatch forwards shared --harness, --model, and --effort to every pair
ok - claude forwards firstmate's CLAUDE_CONFIG_DIR so the crewmate uses the same credential store
ok - the primary-owned Lavish server address reaches every worker launch
cat: ~/tmp/fm-spawn-dispatch-profile.NoGQWY/profile-lavish-ambient/pane.log: No such file or directory
ok - absent Lavish configuration preserves the destination environment
ok - the primary-owned Lavish server port reaches every worker launch
cat: ~/tmp/fm-spawn-dispatch-profile.NoGQWY/profile-lavish-port-ambient/pane.log: No such file or directory
ok - absent Lavish port configuration preserves the destination environment
ok - a malformed Lavish server port refuses the spawn before the worker starts
ok - claude omits the config-dir prefix when firstmate runs with the single-store default
ok - absent config/claude-permission-mode defaults to --dangerously-skip-permissions
ok - config/claude-permission-mode=auto opts into the model-reviewed launch
ok - explicit config/claude-permission-mode=bypass uses --dangerously-skip-permissions
ok - config/claude-permission-mode=auto reaches scout launches too
ok - claude worker launches cover the task-channel directories in bypass and auto modes
ok - an unrecognized config/claude-permission-mode token refuses before any endpoint or metadata
ok - config/claude-permission-mode changes claude launches only
ok - non-claude harnesses do not receive the claude CLAUDE_CONFIG_DIR prefix
ok - a claude task launch establishes only Firstmate's task control channels through the system prompt
ok - a persistent claude secondmate keeps its supervisor contract without a task-worker authority overlay
ok - fm-spawn: a Claude launch longer than 1024 bytes is delivered intact through the staging path
ok - a claude crewmate launch carries the attribution-off policy in its own settings
ok - keep-ai-trailers omits Claude attribution settings and the pane strip hooks
ok - keep-ai-trailers is inherited so a secondmate's crew launch keeps AI trailers
ok - a claude secondmate launch carries the attribution-off policy too
ok - active crew-dispatch profile does not block secondmate launches
# all fm-spawn-dispatch-profile tests passed
EXIT=0

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ℹ️ tests/fm-turnend-guard.test.sh:2212 - The stop-driver comment still says "the fixture still runs for ~1s". After f0ed5d7 the arm and host fixtures no longer sleep for 1s. They now hold the claim until $FM_HOME/guard-done appears, or for up to 30s. The comment now gives the wrong reason the guard sees an open claim. Change it to say that the fixture holds the claim until this Stop's guard writes guard-done.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Real Claude primary in a lab home runs a turn with the merged hook set: FM_HOME resolves to the lab and every hook (SessionStart, PreToolUse, PostToolUse, Stop) completes without blocking or erroring ✅ pass live lab-primary-transcript.txt: 'FM_HOME=~/tmp/fm-lab.ML6El2', 'running PreToolUse hooks… 0/6', 'running Stop hooks… 1/7', 'Baked for 7s · done' with no guard block
Adversarial: SIGTERM a real lab watcher while it holds its lock; the single surviving watcher_cleanup releases .watch.lock, its owner directory and any .steal lock, and publishes the downtime marker ✅ pass live lab-watcher-term.log: before, .watch.lock -> owner.ra0sGR owned by pid 3478101; after TERM, the pid is gone, no .watch.lock, owner or .steal entries remain, .watcher-down is present; lab-watch-arm.log…
The turn-end guard with upstream's single-attempt budget lock still reaches the attended alarm exactly once in every auto-arm variant (arm, signal, alarm-signal, lost hand-back) ✅ pass live bash tests/fm-turnend-guard.test.sh exit 0 (96 ok), including 'the exhausted auto-arm commits the attended alarm once…' and 'interruption reaches the attended alarm…'
Watcher lock and startup-interruption recovery (upstream fix #8025, which the merge's duplicate block had dropped) behaves correctly ✅ pass live bash tests/fm-watcher-lock.test.sh exit 0 (72 ok)
Wake daily collector, including the rework pipeline from the fork-main merge, produces the expected report from pipeline fixtures ✅ pass live bash tests/fm-wake-daily.test.sh and bash tests/fm-wake-daily-rework.test.sh exit 0
Ship and scout spawn launches carry FM_HOME after the merge (CI shard repair) ✅ pass live bash tests/fm-spawn-dispatch-profile.test.sh exit 0, 'all fm-spawn-dispatch-profile tests passed' (114 ok)
  • bin/fm-lab-home.sh create $LAB then tmux -L fm-lab new-session ... -e FM_HOME=$LAB claude (real Claude Code 2.1.330 primary on the lab's private socket, output logged with pipe-pane, driven with send-keys)
  • Prompted the lab primary to run printf FM_HOME; bin/fm-crew-state.sh, then watched the UserPromptSubmit, PreToolUse, PostToolUse and Stop hooks run and the turn end cleanly
  • FM_HOME=$LAB bin/fm-watch-arm.sh as a tracked background task, then kill -TERM &lt;exact watcher pid&gt;, then checked the lab state/ for leftover locks
  • bash tests/fm-turnend-guard.test.sh (96 ok, exit 0)
  • bash tests/fm-watcher-lock.test.sh (72 ok, exit 0)
  • bash tests/fm-wake-daily.test.sh and bash tests/fm-wake-daily-rework.test.sh (exit 0)
  • bash tests/fm-spawn-dispatch-profile.test.sh (114 ok, exit 0)
  • Teardown: tmux -L fm-lab kill-server and rm -rf $LAB
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

tiago-peixoto and others added 30 commits October 19, 2026 23:12
…henguid#7451)

* fix(tests): tolerate slow orphan-storm source launches

* no-mistakes(document): docs: pin orphan-storm row to pacing, not lease expiry
* fix: respect gh-resolved base in publication target selection

* no-mistakes(document): Document gh-resolved publication target selection
…4728)

* feat(bin): add Paseo as an experimental session backend

Modeled on the cmux adapter, with Herdr's one-workspace-per-task UX:
terminal NAME is the routing authority, workspace title is decoration
only. tmux stays the default; Paseo is opt-in via config/backend,
FM_BACKEND=paseo, or PASEO_AGENT_ID/bundle-id auto-detection.

* no-mistakes(document): docs(paseo): register Paseo across backend inventories and lists

* no-mistakes(document): docs(paseo): list paseo in AGENTS.md config/backend entry

* fix(bin): give Paseo one shared workspace per project with a tab per task

Paseo's sidebar is project > workspace > terminal tab. The adapter used
to create one workspace per task, so a fleet showed up as a pile of
sidebar entries. It now mirrors Herdr's container shape: one shared
`firstmate` (or `2ndmate-<id>`) workspace per project, adopted by cwd
and title or created once, with each task as a terminal tab inside it.
Kill closes only the task's tab; the shared workspace is never archived
and the adapter never runs a `paseo project` command, so Paseo reuses
the project registered for the path instead of multiplying projects.

Live findings folded in: the CLI prints an Electron warning on stderr
when firstmate itself runs inside a Paseo agent, so parsed `--json`
calls no longer merge stderr into stdout; `workspace ls` reports the
cwd normalized but not symlink-resolved, so adoption matches the raw,
logical, and physical path; a bare Escape stays pending in zsh's emacs
keymap and fuses with the next key, so the smoke test verifies labels
with Enter and sends Escape last.

The smoke test now owns a throwaway project directory and deletes the
project it registered, so a captain's real sidebar is never touched.
Both paseo suites get a portable-serial duration hint and a `paseo`
family so the coverage guard stays under its unhinted cap.

* test(bin): teach the backend-list suites about paseo

CI serial shard 5 failed because tests/fm-bootstrap.test.sh still
expected the known-backend list to end at cmux. Add paseo to that
expectation and to the sibling lists in the control, trace-context, and
teardown-safety suites (with a valid paseo endpoint record), and scrub
PASEO_AGENT_ID and __CFBundleIdentifier in the bootstrap suite's hermetic
unset so running the tests from inside a Paseo agent cannot flip a
default-backend case onto paseo the way $TMUX or HERDR_ENV would.

* no-mistakes(review): Fix paseo control keys, secondmate fallback, docs, and tests

* no-mistakes(review): Send paseo C-u as raw byte, refuse untokenized keys

* no-mistakes(document): Sync Paseo docs for key tokens, secondmate fallback

* no-mistakes(lint): Use prefix-form PATH in paseo autodetect tests

* fix(bin): make paseo explicit-only and adopt the tab's own workspace

Paseo stamps its markers into every descendant process: an agent exports
PASEO_AGENT_ID, a terminal tab exports PASEO_TERMINAL_ID and
PASEO_WORKSPACE_ID, and both carry __CFBundleIdentifier=sh.paseo.desktop.
A tmux server started from a Paseo tab inherits all of them, so their
presence never proves the captain chose Paseo (the same finding recorded
on kunchenguid#4484 and kunchenguid#3884). fm_backend_detect now ignores every Paseo marker;
paseo is reachable only through config/backend, FM_BACKEND=paseo, or
--backend paseo, exactly like zellij and orca. That also retires the
auto-detected-paseo secondmate fallback to tmux, which only existed
because of auto-detection: an explicit paseo still refuses --secondmate,
and an unconfigured home inside Paseo stays on tmux silently.

Once Paseo has been selected explicitly, PASEO_WORKSPACE_ID is still
useful: a firstmate running inside a Paseo tab adopts that tab's own
workspace as the project's shared workspace when its cwd is the project,
before falling back to the firstmate-title lookup (herdr's
launcher-identity rule). Verified live that CLI-created tabs export
PASEO_WORKSPACE_ID and no PASEO_AGENT_ID.

Docs also note that `paseo run --cwd` is ignored when PASEO_AGENT_ID is
set; the adapter never uses `paseo run`.

* no-mistakes(test): Drop stale Paseo auto-detect mention from fm-spawn help

* no-mistakes(document): Document Paseo own-workspace adoption order

* no-mistakes(ci): Fixed ci-3 with a test-only change. The unconfigured-spawn case in test_secondmate_spawn_refuses_explicit_paseo_only failed on CI with "error: no launch template for harness unknown". CI runners have no agent process above the test, so harness detection returned unknown before the spawn reached the home check. The fix pins the harness with `printf claude > "$dir/config/secondmate-harness"` just before that spawn call, with a two-line comment explaining why (tests/fm-backend-paseo.test.sh). I verified locally that tests/fm-backend-paseo.test.sh passes, including the secondmate test, and that shellcheck is clean on the file. I did not rerun it detached from the agent process chain; your earlier report of it failing without the pin and passing with it is the evidence for that part. As you instructed, I made no change for ci-1 or ci-2 (the fork approval gate) or for the Lint 2 runner shutdown, which was infrastructure

* fix(bin): let the adapter precheck load paseo

Main now checks that a backend's adapter and its sibling libraries are
readable before sourcing it, and refuses any backend it has no sibling
list for. Paseo had no entry, so every paseo call failed to load the
adapter and fell back to 'unknown'. Paseo sources the same siblings as
cmux, so it shares that entry and sources through the checked path.

* no-mistakes(document): Make fm_backend_source adapter-count comment count-free

* test(bin): prove the Pi branch claims paseo stale wakes

The watcher keys a non-Orca stale wake by the task's window= value, and
the Pi supervision branch resolves a stale row to its task only through
window= (Orca's terminal= key is not indexed, which is how Orca stale
wakes ended up waking main). Paseo records
window=<terminal-uuid>:<workspace-uuid>, so pin that a stale row keyed
by that value is claimed by the branch for the right task.

* no-mistakes(document): Note Paseo adapter in composer capture-window config doc

* fix(bin): refuse a paseo spawn when its inventory is unreadable

Paseo allows duplicate workspaces and terminal names, so the adapter
looks up the project's shared workspace and checks the task's terminal
name before creating either. Both lookups treated a failed or unreadable
listing as empty, so a transient daemon error during spawn created a
second workspace for the project or a duplicate task terminal. The spawn
now refuses instead, and creates nothing, when either inventory cannot be
read.

* docs(paseo): note why capture reads the whole scrollback

Paseo caps terminal scrollback at 1024 lines, so reading all of it and
trimming locally stays bounded however long a task runs. A bounded
`--start -<n>` read is not a drop-in replacement: it counts the blank
screen rows below the prompt as the tail, so a quiet terminal captures
as empty.

* no-mistakes(document): Document Paseo spawn refusal on unreadable inventory

* no-mistakes(lint): Rewrite paseo workspace inventory check as explicit if-block

* feat(bin): keep paseo tasks from cluttering the sidebar

Every project a firstmate worked in got its own "firstmate" workspace in
Paseo, and those workspaces and their projects stayed in the sidebar
after the work was done.

When firstmate itself runs inside Paseo, task tabs now go into its own
workspace, whatever the project. A terminal tab names that workspace
through PASEO_WORKSPACE_ID; an agent session only has PASEO_AGENT_ID, so
its workspace is the one live workspace whose folder is the firstmate
home.

Otherwise the per-project shared workspace is still used, and closing
its last task tab archives it and deletes its project when the folder is
one of the home's own clones. Archiving a workspace also archives its
agents and leaves the project listed, so cleanup skips firstmate's own
workspace, workspaces titled by someone else, workspaces with an agent
in their folder, and projects outside the home, and does nothing when an
inventory cannot be read.

* no-mistakes(review): Retire paseo workspace when tab already gone; rename spawn vars

* no-mistakes(document): Align Paseo doc workspace wording with own-workspace placement

* fix(bin): serialize paseo spawns with workspace cleanup

Cleanup checked that a per-project workspace had no tabs, made more
Paseo calls, and then archived it. A spawn could open a tab in that
workspace in between, and the archive would then take a live task's tab
with it.

Spawning (choosing or creating the workspace and opening the tab) and
cleanup now share one home-wide lock, the stale-owner lock from
fm-wake-lib.sh that herdr already uses. A spawn that cannot get it
refuses and cleanup skips. Cleanup now only archives a workspace for one
of the home's own clones, which only this home spawns into, so a
per-home lock covers every spawn that could use it.

* no-mistakes(document): Scope Paseo workspace retirement to home clones in architecture

* test(paseo): fix shellcheck SC2031 lint warning in fm-backend-paseo test

The workspace-lock holder helper read $! after backgrounding the holder,
which ShellCheck's dataflow analysis flags as SC2031 because the helper
only runs inside command substitution. The holder now records its own
PID ($$, the same process $! named) before signalling readiness, and the
helper returns that. No behavior change.

* test(paseo): keep the smoke test from archiving a workspace it did not create

Run from a Paseo tab or agent, PASEO_WORKSPACE_ID/PASEO_AGENT_ID steered
create_task into the caller's own workspace, which cleanup then archived.
The smoke test now unsets both before sourcing the adapter, archives the
workspace create_task returned only while its cwd is the test's own temp
dir, and runs cleanup once. Test-only; assertions are unchanged.

* no-mistakes(document): List paseo in FM_BACKEND and README backend lists

* no-mistakes(document): Add paseo to backend dependency docs and lists

* no-mistakes(document): docs: list paseo among Command Code refused backends

* no-mistakes(document): Note Paseo as unstyled in opencode footer record
…g budget (kunchenguid#7545) (kunchenguid#7558)

Claude Code lists skill descriptions within a budget of 1% of the context
window and drops the least-invoked skills' descriptions first, which are
the rarely-loaded recovery skills whose descriptions AGENTS.md section 13
uses as the trigger index.

- Remove the decision-hold-lifecycle redirect stub; nothing on main
  points briefs at it any more (captain-hold-lifecycle owns the policy and
  docs/captain-hold-lifecycle.md still documents the fm-decision-hold.sh
  shim).
- Tighten the longest skill descriptions to their load triggers, keeping
  every trigger. Total description size drops from 11312 to 6142
  characters across the listing.
- Document /doctor, /skill-doctor, skillListingBudgetFraction, and
  skillOverrides "name-only" in the Claude harness adapter notes as
  opt-in, home-local vendor settings.

No session-start budget warning or other default-on surface is added.
…enguid#7563)

* fix(extension): launch lifecycle helpers through verified Bash

The extension host spawned bin/fm-procevent.sh directly with
shell:false, which native Windows Node rejects with spawn EFTYPE because
it cannot run a script through its shebang. Resolve an absolute Bash
from $BASH or PATH, verify it with a short probe (on Windows it must
report an MSYS or Cygwin OSTYPE, so WSL bash.exe is skipped), and pass
the script as its first argument. The child keeps shell:false, the
sanitized environment, literal argv, and the existing failure mapping.

Fixes kunchenguid#7559

* no-mistakes(review): Harden lifecycle Bash interpreter verification

* no-mistakes(document): Document lifecycle Bash verification contract

* fix(extension): try exported BASH only on Windows for lifecycle helpers
…nchenguid#7348)

Sites that run one no-mistakes daemon per isolated workspace keep each
task's runs in a per-workspace NM_HOME that cannot be derived from the
shared gate remote, so crew state, pipeline spend, and teardown read the
wrong home.

When NM_HOME is unset and config/nm-home-resolver names a site-provided
executable, fm-nm-run-lib.sh now calls it with the task copy path and
exports the printed home for that one call. Only host reads (axi status,
the axi overview, axi logs, runs, daemon status, the state database) and
axi abort --run use it. An explicit NM_HOME always wins, and with no file
behaviour is unchanged.

Fixes kunchenguid#7309
…ds-decision line (kunchenguid#7361)

* feat(bin): let a worker's own open blocked: or needs-decision: line defer wedge escalation behind config/wedge-defer-worker-wait

Opt-in only: absent the flag the wedge ladder is unchanged. Counts only the worker's own newest line (reserved keys excluded via status_own_open_decisions), defers onto the existing bounded recheck with a verb-specific clearing action and no escalation-count increase, and ends on any newer status line or a newer acknowledged inbox record. The away daemon honors the same evidence before escalating an enriched wedge.

Refs kunchenguid#6899

* no-mistakes(document): Document worker-wait deferral in wait-evidence lists
* feat(bin): pin per-mate secondmate runtime overrides in config/secondmate-harness

A single default pin line gives every secondmate one runtime, so raising the
default pin silently migrates a mate the captain ruled onto its own runtime.
config/secondmate-harness now accepts optional
"mate <secondmate-id>: <harness> [<model>] [<effort>]" override lines, and
fm-harness.sh secondmate, secondmate-model, and secondmate-effort take the
secondmate id as an optional second argument that selects that line.

Spawn, the control-plane relaunch, and the secondmate restart each pass the
mate id they already know, so all three resolve one decision. A malformed pin
file is refused with its line number and prints no token instead of resolving
around it to the default runtime.

* no-mistakes(review): Bypass unused pins during explicit secondmate relaunch

* no-mistakes(document): Correct and consolidate per-mate runtime pin documentation

* fix: preserve legacy secondmate pin parsing without overrides

* fix(bin): keep legacy secondmate pin files opt-in

config/secondmate-harness is documented as "the first non-empty, non-comment
line is parsed". The per-mate override grammar made the whole file strict, so
a second default line or a fourth token started refusing every secondmate
spawn, relaunch, and restart - even in a home that never wrote a mate line.
That changed how an existing, already-valid file is read, so the feature was
not opt-in.

Scope the strict whole-file parse to files that declare at least one
"mate <secondmate-id>:" line. A file with no mate line parses exactly as
before: first non-empty, non-comment line, the rest ignored, a fourth token
ignored, nothing refused. A file that does declare a mate line keeps the
strict parsing, so a duplicate override, a malformed entry, or an extra token
still refuses loudly with its line number.

Coverage: a legacy file with a second default line and a fourth token now
spawns, relaunches, and restarts a mate onto its first line; a declaring file
that is malformed refuses each of those paths with the offending line; and an
explicit --harness/--model/--effort relaunch succeeds whatever the pin file
holds, because the config read stays behind the explicit-harness guard.

* no-mistakes(document): Document per-mate secondmate runtime pins

* no-mistakes(ci): Fixed `tests/fm-backend-herdr-presentation-e2e.test.sh` teardown to restore write permission on fixture directories before removal. This addresses the read-only git-hook cleanup errors in the failed Herdr check. The real-Herdr presentation E2E test passed locally (exit 0)
…unchenguid#6973)

Adds bin/fm-capacity.sh, a read-only, network-free report of open ship/scout lanes against an optional config/lane-capacity target plus host load, memory and disk headroom. Without config/lane-capacity it reports counts only and gives no dispatch-hold advice. Docs, operational-home-layout skill entry, a gated AGENTS.md pointer, and tests/fm-capacity.test.sh.
… panes (kunchenguid#7437)

* fix: bound unknown-live watcher alarms

* no-mistakes(review): Gate unknown-alive stale bound on progress; fix arm CONFIG

* no-mistakes(review): Keep watch.env loading only in the watcher arm

* no-mistakes(review): Seed worktree progress before first unknown-alive alarm in test

* no-mistakes(document): List config/watch.env in operational home layout

* no-mistakes(review): Narrow watch.env docs to arm-launched watchers

---------

Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>
* fix(bin): honour the no-run verdict from axi status in crew-state

* no-mistakes(review): Honor authoritative no-run verdict across fallbacks

* no-mistakes(lint): Quote no-run sentinel to satisfy ShellCheck

* no-mistakes(document): document authoritative no-run verdict in crew-state attribution
* fix(composer): accept Grok 1.0.44 approval-titled bottom border as empty composer

* no-mistakes(document): Document Grok’s aligned approval title

* no-mistakes(ci): Captain, removed the unused test variable that failed Lint 1. ShellCheck, the composer suite, and the remote provisioning test pass locally. Behavior portable serial 9 failed during fixture cloning in an unchanged test, before composer behavior was exercised; no further code change is warranted for that failure

* no-mistakes(review): drop dead approval guard, make Grok fixtures locale-independent widths

* fix(bin): stop shellcheck re-expanding fm-wake-lib in teardown

Lint 1 dies when ShellCheck expands bin/fm-wake-lib.sh twice from
bin/fm-teardown.sh. The top-level source already names that file. Point
the second directive at /dev/null and leave the runtime source unchanged.

* docs: record Grok 1.0.44's approval-titled composer border

The verification record scoped its titled-bottom-border note to the Grok
1.0.5 three-column overhang but never recorded the newer shape this branch
accepts, so a maintainer could not tell the two cases apart or know what a
Grok upgrade re-verifies.

Add a dated record of the 1.0.44 shape - the typed model/effort title plus
its ` · always-approve` suffix, drawn inside a rounded bottom border at the
aligned width - with the live verdicts that prove it, the portable test that
owns it, and the fail-safe verdict every neighbouring title keeps.

* no-mistakes(review): Narrow Grok composer coverage claims to verified matrix

* no-mistakes(document): Correct stale Grok verification notes

* docs: trigger CI re-run for flaky shard 4

Behavior portable serial 4 failed on the previous head with one assertion
only, `not ok - the NUL-bearing line was not captured`, in the unchanged
remote-reply and relay path; its fixture hardcodes /bin/sleep, direct NUL
ingestion passes, and the other 19 checks were green. GitHub refused a job
re-run for this fork PR, so this empty commit is the re-trigger. No content
change.

* no-mistakes(document): Clarify Grok live guard verification scope

* fix(composer): restrict Grok approval titles to rounded borders

Reject light, heavy, double, and ASCII approval-title boxes at the shared
classifier boundary. Only the rounded family has recorded live evidence,
and an empty verdict grants permission to type into the pane.

Cover denied families through tmux and cursorless backend profiles while
preserving rounded idle, draft, malformed-title, and legacy behavior.

* no-mistakes(document): Refresh Grok composer verification evidence

* no-mistakes(ci): Fixed the stale local link in `docs/verification/runtime-backends.md`; the section heading’s anchor had changed. `tests/fm-documentation-audiences.test.sh` passes
…henguid#7155)

* fix(omp): point non-checkout homes at fm <project> relaunch and name why the extension is not loaded

* no-mistakes(review): Remove unset-FM_HOME omp watch cause line
…cap (kunchenguid#7552)

* feat(fm-watch): bound consecutive wedge escalations per worker window

An unattended watcher escalation loop once burned ~359M tokens in a day: the
watcher keeps re-escalating a pane it believes is wedged, and nothing bounded
how many times it did that for one worker window.

Add an opt-in ceiling on consecutive wedge escalations for a single window.
At FM_WEDGE_MAX_ESCALATIONS the watcher publishes one terminal
PERMANENTLY-WEDGED wake and writes both cap markers, after which the wedge
path short-circuits for that window until FM_CAP_HORIZON_SECS elapses or an
operator removes both markers. A pane hash change alone does not re-engage
while the window-scoped marker stands, so a pane that re-renders on every poll
cannot rebuild the counter and re-fire every bound. A failed marker write rolls
the cap state back rather than amplifying one write failure into a wake-queue
flood, and a rollback that itself fails leaves a transient sentinel that holds
the wedge path quiet for FM_ROLLBACK_SENTINEL_TTL_SECS.

FM_WEDGE_MAX_ESCALATIONS defaults to 0, so the unconfigured path keeps today's
behavior exactly. Each setting is validated the way the rest of the file
validates its environment settings and falls back to its default on a
non-numeric value; a zero horizon or sentinel TTL falls back too rather than
degrading into a re-fire loop.

Tests drive the watcher as a real process through its public environment
surface, and a separate opt-in live guard exercises a real tmux pane holding a
wedged process in a disposable lab home built by bin/fm-lab-home.sh, covering
both halves of the contract: the cap engaging, and the cap releasing itself on
the horizon with no operator action.

* no-mistakes(review): fix(fm-watch): bound the wedge cap honestly

* test(fm-watch): make the wedge-cap live guard a falsifiable comparison

The live guard demonstrated the ceiling but could not falsify it, and it
advertised evidence that did not survive its own run.

Register both new suites in bin/fm-test-run.sh. Unregistered they fell into
the unclassified catch-all, which put the live guard outside the repo-wide
live-gate sweep at tests/fm-live-gate.test.sh - the sweep that proves every
live guard refuses together on FM_LIVE=0. The wedge-cap suite joins
watcher-wake-lock and the live guard joins live-harness-optin; the serial
lane passes no live-capability --fail-on-gate-skip token, so CI gating is
unchanged.

Run the unceiled baseline and the ceiled arm back to back on the same
workload, one differing setting, in one transcript. The baseline at the
shipped default of 0 shows the train of five consecutive wakes the cap
exists to bound; the ceiled arm at 3 shows one terminal PERMANENTLY-WEDGED
wake and then silence. State plainly in the transcript that the motivating
incident happened at the default, so it motivates the ceiling and is not
itself evidence the ceiling engaged.

Correct the post-horizon assertion. It required the terminal marker on the
very first cycle after the horizon, which the reset escalation counter makes
false: the first post-horizon wake is an ordinary escalation and the bound is
reached one cycle later. Assert the lane is audible, not which marker it
carries.

Reprint the transcript to stdout before cleanup, so the run ends in one
self-contained evidence block instead of a pointer to the temp file this
script is about to delete. Source tests/wake-helpers.sh for hash_text, and
define PANE_TEXT in this script's own scope, so no unbound-variable or
command-not-found line can appear inside the evidence a reviewer reads.

Document in docs/configuration.md what the cap covers and does not: it bounds
the wedge timer where a busy pane crosses FM_BUSY_TURN_MAX_SECS, it does not
cover the non-terminal first-sight stale surface, only a pane leaving the
stale path clears the markers, and a cap fire resets the consecutive-deferral
budget of a wedge-evidence guard because that guard is not consulted while
the cap is silencing the window.

* no-mistakes(review): fix(fm-watch): release wedge cap markers on every episode-ending reset

* no-mistakes(review): derive the live guard's window key the way the watcher does

* no-mistakes(review): fix(fm-watch): probe dead endpoints under the wedge cap, scope terminal rows per episode

* no-mistakes(review): fix(fm-watch): cap the dead-endpoint probe, real degraded fallback

* fix(fm-watch): release the wedge cap through one episode-ending choke point

The cap's release invariant - every reset that ends a wedge episode drops the
cap markers with it - was wired at two inline sites and two more were missed.
One of the misses is surface_nonterminal_stale, the hot path that ends the
episode marker on every non-terminal stale poll, so the cap's episode tracking
was broken in the common case rather than the rare one and a genuine new wedge
after a pause-and-resume stayed silent for the full horizon.

Enumeration had already failed once, so wiring the two missing sites would look
finished and be incomplete again. Make the invariant structural instead: one
choke point, wedge_episode_end, now performs every removal of the
.stale-since-<key> episode marker and clears the cap markers with it, and a new
assertion in the test fails on any direct rm of that marker outside it.

keep-counter=1 marks a route that only restarts the escalation count while the
wedge timer keeps aging. That is the same episode, not a new one, so the cap
markers are deliberately not cleared there; an existing triage test pins that
behaviour and it is unchanged.

Both proofs are falsification-tested. The completeness assertion and the
behavioural case each fail against the pre-fix watcher, and the behavioural case
additionally fails when only the surface_nonterminal_stale wiring is reverted
while the choke point still exists, so it pins the hot path specifically rather
than passing because some other route happened to release the markers.

The cap stays window-scoped with no per-hash marker, still defaults to off, and
still releases on the horizon. The episode-scoped terminal row stays one per
episode under the append lock, the documented first-sight containment stays, and
the dead-endpoint-before-silencing work is untouched.

* no-mistakes(review): fix(wm-watch): release wedge cap on every episode-end route

* no-mistakes(review): fix(fm-watch): gate cap markers, probe under sentinel, release churn

* no-mistakes(review): fix(fm-watch): release wedge cap on the away first sight

* no-mistakes(review): fail safe the wedge escalation-count write under a configured cap

* no-mistakes(test): fix wedge-cap live guard leaking its temp root

* no-mistakes(review): fix(fm-watch): keep the wedge ladder reachable under a fired cap

* no-mistakes(review): fix(fm-watch): pace the sentinel dead-record probe by threshold

* no-mistakes(test): fix(test): give the wedge-cap suite its serial-lane weight hint so its CI shard fits the 30-minute job cap

* no-mistakes(document): align wedge-cap docs with implemented release boundary

* fix(docs): correct the cap markers' lifetimes in the layout reference

The state/ listing claimed .wedge-permanent-<key> "only sits on disk until a
later cap fire overwrites it". That is false: bin/fm-watch.sh:1214-1219
_wedge_cap_markers_clear removes .wedge-permanent-<key>, .wedge-terminal-queued-<key>
and .wedge-rollback-failed-<key> outright, and it runs on every cap release,
so a release takes the marker off disk rather than leaving it for a later cap
fire to overwrite.

The same clause also left the other two markers' lifetimes and delete
semantics unstated. Each now carries its own lifetime, and the sentence
records that a cap release drops all three while only the two silencing
markers re-engage a window when deleted by hand.

Verified against bin/fm-watch.sh: FM_CAP_HORIZON_SECS bounds the cap marker
via _wedge_cap_marker_stands, FM_ROLLBACK_SENTINEL_TTL_SECS bounds the
rollback-failure sentinel, and the terminal-row marker records the episode
that queued the row and is dropped with the rest of the cap state.

* no-mistakes(document): state the watcher's cap release boundary in its header comment

* fix(fm-watch): make the wedge escalation-counter reset opt-in

The upstream maintainer reviewed the wedge-cap pull request, accepted the
live validation, and asked for the escalation-counter reset to become
opt-in: it should only kick in when the cap is configured, so a home that
has not set anything keeps today's behaviour and still gets the
deep-inspection prompt for a stuck pane.

The choke point wedge_episode_end gained a third state. The call sites
whose pre-cap shape kept the escalation counter - the first-sight stale
surfaces, where upstream dropped the wedge timer and left the count
standing - now pass keep-count, so the counter survives them exactly as
upstream's did while the cap is unconfigured. With a configured cap the
count still restarts with the released episode, which is what lets a
re-wedged window escalate from 1 again past a released marker. The other
episode-ending routes are unchanged: the pre-cap watcher reset the count
there too, so those keep resetting it in both postures.

The new parity suite proves the property rather than asserting it: it
drives one stuck-pane scenario against upstream main's own bin/ tree and
against this branch, and requires the same observable outcome for the
unconfigured case - the same ladder, the same demand-deep-inspection
prompt, no cap marker. A configured cap in the same harness fires
PERMANENTLY-WEDGED at its threshold, which is what shows the setting
really reaches the watcher, so the unconfigured cases cannot pass
vacuously.

* no-mistakes(review): fix(fm-watch): bound the wedge cap settings to a comparable range

The review step's fix agent produced this change but its own turn hit the
30-minute invocation budget, so the gate failed the step with the work
uncommitted. The work is preserved in the gate's recovery ref and in the
task's saved round patch; this commit carries it forward unchanged.

bash's test cannot compare a decimal integer outside its own range: the
comparison ERRORS rather than evaluating false, and every later comparison
of such a value therefore reads as false. A value such as
99999999999999999999 passed the digit check unchanged, so the cap never
engaged - the unbounded escalation train the feature exists to bound - and
the \"is it zero\" test errored false as well, so the keep-count sites
reset the escalation counter on a home that had configured nothing, which
is the behaviour the maintainer's request forbids. The same hole let an
unusable horizon make the cap marker expire at once and an unusable
sentinel TTL drop the sentinel on the next poll, putting the failed-write
route back on every poll.

The fix bounds the accepted range at the ONE normalization choke point,
where each value is read, rather than hardening every comparison site: a
value bash cannot compare never reaches a comparison, because an
arithmetic error is read as false at every site, which is the opposite of
what each of those tests means. Values are accepted below 10^18, which
always fits bash's 64-bit signed arithmetic, and the empty, non-digit,
zero and negative handling keeps its documented fallbacks: 0 for the cap,
86400 for the horizon, 3600 for the sentinel.

Regression cases cover a value beyond bash's integer range for each of
the three settings, and the parity suite proves the unconfigured home is
still observably identical to upstream main.

* no-mistakes(document): docs: correct wedge-cap ranges, release routes, reset contract

* no-mistakes(ci): fix the wedge-cap lint finding and pack the lane on CI measurements

Upstream CI on the rework head went red on two checks, both ours.

"Lint 1" failed on the new parity suite: two `return 1` statements behind
`fail` were unreachable, and behind them was a real bug. `fail` lives in
tests/lib.sh and exits, so inside the command substitution that reads the
baseline it ended only the SUBSHELL - the outer script continued with an
EMPTY baseline and reported a divergence with an empty trace instead of
failing. The test's own header says it is the proof and a silent skip
would be no proof at all, so the baseline now reports the specific reason
and returns non-zero, and the caller's guard aborts the whole test. A
baseline that cannot be materialised aborts the test rather than
continuing.

"Behavior portable parallel 2" failed the packing-boundary check: the
wedge-cap suites were packed on provisional LOCAL measurements that
overstated their CI cost, which left the serial lane without the headroom
the boundary check needs to place one script exactly at the budget. The
same CI run measured them for real - 374225 ms for the wedge-cap suite,
27763 ms for the parity suite, 74 ms for the live-guard skip - and those
Ubuntu measurements replace the local ones in bin/fm-test-run.sh.

* no-mistakes(document): docs: fix wedge-cap measurement attribution, document cap-off release
…lag (kunchenguid#7407)

* feat: archive retired task status history behind an opt-in flag

* fix(bin): recognize an already-retired remote home before it is recreated

Sourcing fm-wake-lib.sh through the control script's libraries creates
"$FM_HOME/state", so retiring a remote home that was already removed
fabricated an unseeded directory before validate_home ran. The
already-retired branch was unreachable, and that retirement and every
retry refused with "remote home is not a seeded secondmate home".

Check for the absent home before loading any library, accepting exactly
the retire dispatcher's arguments so an invalid option still fails with
usage, and drop the allow-absent branch that could no longer be reached.

* no-mistakes(review): Removed configurable status archive retention override

* no-mistakes(review): Remove published archives after failed status retirement
…y age (kunchenguid#7364)

* fix(bin): raise unanswered review threads again after acknowledgement

Acknowledging a maintainer signal removed the only record of the thread,
so a comment nobody answered was never raised again, including while its
task sat on a hold.

Poll now tracks each unanswered maintainer comment, review and inline
review comment on an open pull request until the contribution author
replies in it or it is resolved, and raises it again once it is a day old
(FM_CONTRIBUTIONS_REPLY_AGE) and daily after that. The wake names the
comment URL and its age.

* no-mistakes(review): Track only inline and changes-requested threads, bound notified

* no-mistakes(review): Let reviewer verdicts answer reviews, skip empty-body change requests

* no-mistakes(ci): Fixed "Behavior portable serial 6" with a test-only change. The serial 4 failure is a timing flake that this change did not cause. Serial 6 (tests/fm-pr-check-security.test.sh, "retired poll left task-a.check.sh"): this PR adds one more forge read to the contribution observer, a paginated `gh api graphql` query for reviewThreads. The test's fake `gh` answered every `api graphql` call with merge-state key=value lines. The observer rejected that output and raised the wake "contributions: observation unavailable ... review thread pages returned an unexpected shape". That wake ended the watcher cycle before the merged task-a poll retired. Invariant: the fake forge must answer every read the contribution observer makes, in that read's real shape. The other contribution reads (comments, reviews, inline comments, checks, statuses, repo) were already faked. The new reviewThreads query was the only read missing. Fix: tests/fm-pr-check-security.test.sh now answers any `api graphql` call containing reviewThreads with one empty reviewThreads page. The merge-state graphql answer is unchanged. Verified: I reproduced the failure locally before the fix. The test also passes on base fc8972c with that commit's bin/. After the fix, `bash tests/fm-pr-check-security.test.sh` exits 0 with all 47 cases ok. The only other test whose fake `gh` handles `api graphql` and runs the contribution path is tests/fm-pr-merge.test.sh. It prints no "unexpected shape" text. It fails locally with "github-zero-exit-queue-required: refusal did not name the concrete observed state", and it fails the same way on base fc8972c. So that failure predates this change, and it is not among the failing CI checks. Serial 4 (tests/fm-remote-reply.test.sh, "the NUL-bearing line was not captured"): this is a 40-second wait (800 polls of 0.05 seconds) for a procevent result in the remote-reply stream, and it timed out on CI. The test does not use fm-contributions or any file this PR changes. It passed locally twice (42 ok, exit 0), so this is CI load flakiness outside this change. I made no code change for it

* fix(bin): make unanswered review re-raise opt-in

The re-raise wake and the reviewThreads read now run only when
FM_CONTRIBUTIONS_REPLY_AGE is set to a positive number of seconds.
An unconfigured install polls exactly as before: no review-thread read,
no threads[] entry and no unanswered signal. arm copies a set value into
the generated check so the watcher honors it.

* fix(bin): refuse a zero-padded zero reply age

FM_CONTRIBUTIONS_REPLY_AGE=00 and 000 passed validation as positive ages.
They now fail like 0 does.

* no-mistakes(review): remove dead reviewThreads branch from security test fake gh

* no-mistakes(review): use portable sed -i.bak in contributions test helper

* no-mistakes(docs): name the thread URL in the unanswered-wake header text
… opt-in flag (kunchenguid#7631)

* Refuse unguarded Herdr lifecycle briefs at spawn

* no-mistakes(review): name matched Herdr command, document opt-in guard, test scaffold

* no-mistakes(lint): quote matched-command assertion so ShellCheck SC2016 passes
…an opt-in flag (kunchenguid#7630)

* fix(bin): publish a child's PR-ready line only after checks green behind an opt-in flag

bin/fm-pr-check.sh publishes the child's PR-ready line to the parent channel when it registers the PR, before the child has reported its checks green. With config/ready-after-green present, a no-mistakes registration records the PR and arms the merge poll but publishes the line only when the last done line in the child's status is 'done: PR <url> checks green' for that PR. Without the flag the behaviour is unchanged.

* no-mistakes(review): accept checks-green note with surrounding text for ready line

* no-mistakes(ci): Lint 2 was caused by this PR and is fixed. Behavior tests (Herdr) is a pre-existing flake unrelated to this PR, so no code change was made for it. Lint 2 (fixed): ShellCheck SC2034 at tests/fm-teardown.test.sh:2711 because `run` was declared with `local` but is a function defined inside the test, never a variable. Invariant: a `local` declaration names only variables the function uses. The same wrong declaration also existed in the sibling opt-in test at line 2662 (both added by this PR), so `run` was removed from both `local` lines. Verified locally: `shellcheck -x tests/fm-teardown.test.sh` returns 0 (it reproduced the SC2034 warning before the edit), `bin/fm-lint.sh tests/fm-teardown.test.sh` returns 0, and `bash tests/fm-teardown.test.sh` exits 0 with 141 passing tests, including both "fm-pr-check withholds the PR-ready line ..." and "fm-pr-check releases the PR-ready line on a checks-green report that carries surrounding text". Behavior tests (Herdr) (not caused by this PR): the single failure is tests/fm-backend-herdr-presentation-e2e.test.sh "concurrent secondmate recovery failed ... error: herdr presentation recovery could not acquire its session lock; refusing a concurrent resume". That test exercises bin/fm-spawn.sh's Herdr session-lock recovery path; this PR touches only bin/fm-pr-check.sh, docs, a SKILL.md row, and tests/fm-teardown.test.sh, and the presentation test references none of them. The identical failure appeared on the unrelated branch fm/t3-5596-successor-v3 in run 39709923982 (job 119598556006), and the flake is already tracked in open issues kunchenguid#6454 and kunchenguid#7277. Rerunning the Herdr job should be enough; fixing the lock budget belongs to those issues, not this PR
* feat(bin): add Rex as an auto-detected session backend

Add bin/backends/rex.sh, a session-provider adapter for the Rex terminal
multiplexer, and wire it through the dispatcher, spawn, control plane,
crew state, busy evidence, and away-mode supervision.

- Auto-detect Rex from TERM_PROGRAM=rex with REX_BLOCK, after tmux and
  Herdr and before cmux; explicit --backend, FM_BACKEND, and
  config/backend still win, and a nested tmux or Herdr is never read
  as Rex.
- One focus-safe tab per task: in Firstmate's own Rex session when it
  runs directly inside Rex (confirmed against the server), otherwise in
  one session per home; new blocks are resized to 200x50; every call
  names its session and block by immutable id.
- Recovery-grade agent state from Rex's process view, OSC 7501 program
  status as positive busy evidence only while its owner is in the
  foreground chain, and a viewport derived from the last size.rows rows
  of the styled capture.
- Absence proof from a structured not-found on the recorded server
  (rex_server), so fm-control exit and relaunch work on Rex and a gone
  block is reclaimed into a fresh tab in its recorded session.
- Away mode for a Rex-hosted primary runs its daemon in a dedicated Rex
  session killed by exact id.
- Docs: docs/rex-backend.md, configuration and control-plane tables,
  and a dated live verification record; tests: a stateful fake-CLI
  suite, a real-server smoke test guarded to its own fm-test- session,
  and a Rex away-launcher e2e.

* no-mistakes(review): Recover Rex reclaim after server stops; document deferred asks

* no-mistakes(document): Correct Rex documentation and consolidate stale backend guidance
…ollback (kunchenguid#7625)

* no-mistakes(review): wedge cap: guard the cap-fire counter reset with rollback

* no-mistakes(document): docs: repair shard-pack wording and wedge-cap marker shorthand

* no-mistakes(review): docs: correct away-release terminal-row bound claim

* no-mistakes(document): docs: cover third guarded cap-state write in watcher comment

* no-mistakes(ci): Reweighted the packing hint for tests/fm-supervision-host.test.sh from the local 789123 ms to 1192918 ms, the one completed successful CI sample (run 39642852135, job 119276758966), and let the LPT packer rebalance. The guard was not weakened (PORTABLE_SERIAL_MAX_WEIGHT_MS=1200000, PORTABLE_SERIAL_SHARDS=9, coverage guard and packing-boundary check untouched) and nothing was hand-placed. New packed hint sums of the 9 serial shards (ms): 1=1192918 (1 script), 2=1139923 (18), 3=1139903 (30), 4=1139922 (30), 5=1139917 (30), 6=1139886 (29), 7=1139891 (30), 8=1139880 (29), 9=1139911 (31). Total 228 scripts = the serial lane exactly; max 1192918 < 1200000, so it fits. Packing guard: bin/fm-test-run.sh --check-coverage -> FM_TEST_COVERAGE ok total=268 parallel=24 parallel_max_ms=665545 parallel_imbalance_ms=2 parallel_unhinted=0 serial=228 serial_shards=9 serial_unhinted=15 serial_max_ms=1192918 serial_budget_ms=1200000 herdr=16, exit 0. tests/fm-test-run.test.sh passes both packing contracts: 'coverage guard bounds the unmeasured share and serial packing within twenty minutes' and 'serial packing accepts the exact budget and refuses one millisecond above it'. bin/fm-doc-audience-check.sh ok (surfaces=124 local_links=851). docs/fm-test-portable-shards.md now states the same 1192918 ms for that script, citing run 39642852135 (documented duration == packed weight), and adds the required honesty note in the same paragraph style: run 39765114423 cancelled this script alone in a shard at the 30-minute job cap and upstream run 39618934309 hangs identically, so the weight is a fit to the 20-minute packing target, not a cure, and the underlying slowness is an upstream defect this branch does not own. No other file, weight, test or doc line touched. Unrelated pre-existing failure, verified by git stash at base commit 5af4072: tests/fm-session-lock-ancestry.test.sh asserts 'the pty-host was not reparented to init after the daemon ended' and fails identically on the unmodified tree (sandbox pty behaviour); the --jobs family-admission assertion in the same suite fails only because of it. Not caused by this change
…nguid#6588)

* fix(bin): restore inherited handling before main-only hand-back

* Restored downtime so an earlier engine turn could not suppress a later
  main-owned close while leaving a healthy successor behind
* Routed restoration failures through the existing Stop-hook alarm
  instead of silently discarding the hand-back
* Added host-and-hook regressions plus attended and away idle-return
  controls to separate missing monitoring from status classification

* no-mistakes(test): Assert ordered stale event in returned-driver controls

* no-mistakes(document): Document main-only hand-back downtime restoration and failure

* no-mistakes(document): Correct host header on main-only downtime republish
…unchenguid#7639)

* feat(rex): push blocked edges from Rex program status through a bounded Lua reader

Rex joins Herdr as a push-capable backend: a bounded rex do reader streams
program_status_changed, child_exited, and block_closed for the watched task
blocks, and a trusted blocked edge wakes the supervisor with Rex's blocked
kind and message in the reason. The per-pane dedupe moves into the shared
transition lib, the record gains a detail field, and gone edges end the wait
for an immediate poll. The real-Rex test isolation is shared by both smokes.

* fix(rex): anchor the composer read on Rex's cursor position

Rex's format method reports the cursor alongside the styled grid, so the
composer verdict now uses the same cursor-anchored read as tmux and falls
back to the cursorless read only where that is unknown. OpenCode 1.19 draws
a status line below its composer, which made every cursorless read of an
idle OpenCode worker on Rex unknown and refused steers, exit, and relaunch.

* test(rex): add a live composer guard for every installed harness on Rex

* docs(rex): record push-event and per-tool live evidence on Rex

* no-mistakes(document): Clarify Rex documentation and shared transition ownership

* no-mistakes(ci): Fixed flaky public-followup fixture teardown: killing only the remote worker child allowed its supervisor to restart and race directory removal. Cleanup now uses the existing whole-worker-tree stop helper. Verified the full public-followup suite, remote-job orphan-reap suite, shell syntax, and git diff checks all pass
…nd an opt-in flag (kunchenguid#7634)

* refactor(bin): share the branch-to-PR lookup through fm-pr-lib

* feat(bin): notify owned PR health changes behind an opt-in flag

* no-mistakes(review): drop status-line ownership, key checks per name, remove PR wait rule

* no-mistakes(review): rediscover the branch PR once the cached one is final

* no-mistakes(review): refuse retired re-enrollment, require marked checks, verify owned records

* no-mistakes(document): note shared branch-to-PR lookup in scripts table

* fix(bin): notify reported failures when no checks are required

* no-mistakes(document): inventory PR health flag and state, note new pr-forge member
* Isolate real Rex tests with private servers

* no-mistakes(review): Trap Rex cleanup early and prove passive-read autostart guard

* no-mistakes(document): Consolidate Rex test isolation documentation
* fix(bin): report an outdated bootstrap tool instead of a missing one

detect_local_tools printed "MISSING:" for a treehouse without --lease, a
no-mistakes below 1.46.0, a gh-axi below its floor, and an incompatible
tasks-axi or quota-axi, so a supervisor read an installed tool as absent
and took the first-install remediation again.

Report those as "OUTDATED:" with the installed version, the requirement
and the tool's own upgrade command: treehouse update, no-mistakes update,
gh-axi update and quota-axi update. tasks-axi ships no self-updater, so it
keeps its install command. "MISSING:" stays for absent tools only, and
lavish-axi keeps PRESENTATION_UNAVAILABLE with its text fallback.

Update the bootstrap-diagnostics handler, the AGENTS.md section 13 trigger
list and the operator diagnostics in docs/configuration.md, and cover
absent, below-floor and at-floor for every floored tool in
tests/fm-bootstrap.test.sh.

* no-mistakes(document): Documented distinct bootstrap tool diagnostics

* fix(bin): reuse the tasks-axi check's own probe results

Rendering the tasks-axi OUTDATED requirement text ran the two `--help`
capability probes again after the compatibility check had already run
them, including when session start handed bootstrap an incompatible
verdict. The check now records the reason behind its verdict - the
version floor, or the capability probes the build fails - and reuses it,
both within the process and across the existing one-hop handoff, so
naming a missing capability costs no second probe pass. A build below the
floor is answered by its version alone and never pays for capability
probes it cannot use.

The bootstrap tests that simulate a tool as absent removed it from the
fake bin directory while bootstrap kept searching the fallback base PATH,
so a real host install could satisfy the lookup instead of the expected
MISSING line. Those cases now hide the tool from the base path as well,
and a new case pins the contrast between a bare and a curated fallback.

Verified: the touched bootstrap suite passes, and its probe-count and
capability assertions fail against the pre-fix scripts. Run with a
fallback base PATH carrying real installs of the absent tools, the
pre-fix suite fails on "absent treehouse reports a missing tool" while
the fixed suite passes every case.

* no-mistakes(document): Documented missing versus outdated tool diagnostics

* no-mistakes(document): Refresh outdated-tool documentation

* no-mistakes(review): Reuse shared version parser for outdated diagnostics

* no-mistakes(document): Correct outdated-tool diagnostics documentation

* no-mistakes(document): Align toolchain upgrade documentation

* fix(skills): keep main's bootstrap-diagnostics description and only add OUTDATED
…e verbatim match (kunchenguid#7530)

* Clarify ahoy legacy startup exclusion

* Fix quoted payload code span
…unchenguid#7637)

* fix(timeout): bypass shell builtins when invoking external runners

* no-mistakes(review): Remove redundant slashless runner resolution from external timeout
…urable (kunchenguid#6094)

* fix: count answered captain holds in the Done archive at the completion gate

Done retention moves closed markdown rows into the configured Done archive,
which tasks-axi show never reads, so verify, complete, and scout teardown
refused an answered captain hold once retention archived it. The completion
gate now reads the newest archived block for an attested entry, under its
exact or legacy identity, and accepts it only through a recorded resolution.
Unanswered archived closes and holds found nowhere still refuse.

* no-mistakes(document): document Done-archive durability in captain-hold verification record

* no-mistakes(ci): Fixed the selected Greptile findings in bin/fm-captain-hold.sh (all in the Done-archive read path added by this PR). code_change_needed=true. ci-3 (Archived reads can hang): task_show_archived() now bounds the replayed archive `tasks-axi show` with the same read bound the live backlog read uses (FM_BACKLOG_ROW_TIMEOUT_SECS via fm_run_timed, sanitising a non-positive/padded value to 10s, mirroring fm_backlog_row_show). A bound hit is treated as 124, not absence: task_show_archived returns 124 and prints a loud reason; archived_entry() propagates 124; verify_entry_durable() exits 124 on the archived-read bound (alongside its existing resolve 124 handling); verify_hold_durable() exits 124 rather than reading the row as absent. So verify can no longer hang and complete can no longer stay blocked while holding the origin metadata lock. ci-4 (User-level archive setting ignored): added captain_markdown_archive_setting(), which resolves the [markdown] archive key with tasks-axi's own source precedence — the backlog root's .tasks.toml first, then $HOME/.tasks-axi/config.toml — before the existing default of done-archive.md beside the backlog; a relative value still resolves against the backlog root, which I verified empirically matches tasks-axi (root config wins over home config; a relative home-config value resolves against the backlog root; default stays data/done-archive.md). tasks-axi exposes no command for the archive path, so re-parsing with matched precedence is the available approach. Added test_archived_answer_in_a_user_configured_archive_satisfies_the_gate, which sets the archive only in a fixture $HOME/.tasks-axi/config.toml and drives the whole hold→answer→retention→verify/complete/teardown flow with that HOME, asserting the answered call archived to the relocated location still satisfies the gate. ci-5 (repeated archive scans, P2): left unchanged per the instruction's opt-out. A clean reuse of the row archived_entry already found is not small: archived_entry runs inside a command substitution, so its TASK_SHOW_OUTPUT dies with the subshell and cannot be handed to verify_hold_durable without restructuring both to pass the loaded row through the current shell. The growth is bounded (O(archive size) per attested entry) and P2, so hardening it would add more machinery than the fix warrants. Unanswered archived closes and holds found nowhere still refuse (existing test coverage retained). Verification: `bash -n` clean; pinned ShellCheck 0.11.0 (`shellcheck -x bin/fm-captain-hold.sh`) reports 0 findings; tasks-axi archive-precedence behaviour confirmed by direct experiment. The full fm-captain-hold-lifecycle.test.sh suite (which exercises both the pre-existing archived-gate test and the new user-config test) is slow due to beads spawns and was still running at report time; recommend confirming it green before merge. ci-1/ci-2 need no code change (action_required fork workflow runs awaiting maintainer approval), per the recorded user decision

* no-mistakes(document): Document Done-archive reads under backlog row timeout

* docs: say only the archive row replay is bounded, not the archive scan

* no-mistakes(document): Move Done-archive rule to the complete section
WTF-Am-ID and others added 28 commits November 12, 2026 03:26
)

* fix: give suspended extension deadlines one bounded grace

* no-mistakes(document): Clarify timeout evidence identity
…d#8350)

* fix: recognize the bun-installed omp as a harness process

The bun global package runs omp as `bun <path>/omp`, so ps reports the
process name `bun` and the lock ancestry walk and primary detection, which
matched only the exact name `omp`, refused the session lock and printed
unknown.

bin/fm-omp-process-lib.sh now owns omp identity: the exact name `omp`, or
bun whose first non-option argument is a script named `omp` or the
package's dist/cli.js. Both call sites use it. Regressions drive real
processes through fm-harness.sh and fm-lock.sh, and the omp live guard gains
a token-free installed-omp identity probe.

* fix: match bun-run omp scripts whose install path contains spaces

The ps args fallback split the script path on whitespace, so a path like /opt/Agent Tools/bin/omp was judged as /opt/Agent. Rebuild the first non-option word until it names an existing file. The token-free live guard now also asserts the saved session lock names the omp process.

* fix: narrow bun omp matcher to the verified launch shape

Match only comm omp, or bun whose argv0 is bun and whose next argument
is a script named exactly omp. Drop the dist/cli.js path, the bun option
skip with its eval/print exclusion, and the argv0-omp-under-bun branch,
with their tests and doc mentions. Spaced install paths still resolve.

* no-mistakes(document): Clarify omp lock identity versus tmux liveness wording

* test: copy fm-omp-process-lib.sh into fixtures that source the session lock library

* no-mistakes(document): Note omp live guard checks lock owner pid
* fix(spawn): keep a recorded PR the task record's tail across relaunch

A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.

Refs kunchenguid#7938

* feat: park ship lanes on review and clean them up on merge

Add bin/fm-park.sh: a clean-state gate (GitHub and GitLab) that parks a lane
only when CI is green on the current head, review bots have posted on it or a
quiet window passed, no thread is unresolved, nothing conflicts, and the PR is
not a draft; a park that re-reads the forge bound to the recorded head before
stopping the agent through fm-control, durably leases the Treehouse slot (a
re-park reuses the lane's own lease), and records the lane; a watcher tick that
relaunches a fresh worker on review activity and reports closed PRs once; and
merge-time cleanup through fm-teardown from the watcher's merged path. The
watcher starts fm-park only when a lane is parked or parking is configured.

Teach teardown's landed proof to read GitLab merge requests and fetch
refs/merge-requests/<n>/head, so squash and merge-train merges are recognized
from the MR head.

Local proof:
- tests/fm-park.test.sh (13 tests) covers each unclean gate condition, a head
  change after the verdict, park preflight refusals, the lease, every relaunch
  trigger, closed reporting, the opt-ins and merge cleanup.
- An isolated lab home (Herdr lab session, faked forge, real Treehouse pool)
  ran a full cycle through the real fm-pr-check, fm-park, fm-watch and
  fm-teardown: park with the slot leased (a concurrent get received another
  slot), a review comment relaunched a fresh worker in the same copy, re-park,
  and on merge the watcher tore the lane down and returned the copy.
- A read-only gate run against live lanes in other homes refused lanes with
  pending CI, unresolved threads or uncomputed mergeability, passed clean ones,
  and read a merge-train squash-merged GitLab MR (main got a commit other than
  the MR head) as merged.

Refs kunchenguid#7938

* no-mistakes(review): Harden park gate, bound tick, default merge cleanup

* no-mistakes(document): Inventory park-on-review config flags and state records

* no-mistakes(ci): I made fixes for all six Greptile findings (ci-1 to ci-6). One existing watcher test now fails because of the ci-1 change and needs your decision. Fixes: - **ci-1, merge cleanup skipped** (bin/fm-watch.sh): the merge poll now runs `fm-park.sh land` even when bin/fm-pr-merge.sh recorded the merge first. The cleanup outcome wakes the captain under the queue key `land-<id>`. New test `test_self_merged_lane_is_still_cleaned_up_by_the_poll` in tests/fm-pr-check-security.test.sh. - **ci-2, old CI approves parking** (GitLab gate): `head_pipeline` counts only when its sha equals the MR's current sha. - **ci-3, bot progress permits parking**: a reviewer bot counts as settled only when it has submitted a review bound to the current head; otherwise the quiet window decides. GitLab bot notes carry no such signal, so GitLab lanes now always wait for the quiet window (default 15 minutes after CI finishes). - **ci-4, edited feedback unanswered**: the relaunch trigger uses the later of a comment's creation and edit time. - **ci-5, later lanes starved**: a new `visit_lanes` helper starts each tick at the lane the previous tick did not reach (state/.review-park-tick-next and state/.review-park-tick-next-unparked) and wraps around. - **ci-6, unfinished park looks complete**: `cmd_park` writes state/<id>.review-park only after `fm-control.sh exit` confirms the stop. I updated the header docs in bin/fm-park.sh, docs/configuration.md and the operational-home-layout skill to match. Verification: - tests/fm-park.test.sh: all 18 cases pass, including the new regression cases for ci-2 to ci-6. - shellcheck is clean on all changed scripts and tests. - I did not run the new tests against the old code to see them fail first. Open problem: `test_merged_poll_reregistration_after_notification_is_absorbed` now fails. It re-arms a merge poll for a merge that was already reported, and in that test teardown refuses (the task has no project identity). The second watcher cycle now retries cleanup and wakes the captain with the same refusal again. I did not change this. The choice is: - keep repeating the refusal, which is arguably right because the lane still needs a decision, and update that test; or - wake only when cleanup succeeded in the already-recorded case, which would hide a refusal after a merge done through fm-pr-merge.sh and partly undo ci-1. The watcher subset stopped at that failure, so three tests never ran: the new ci-1 test, `test_self_merge_and_poll_publish_one_outcome`, and `test_merged_poll_row_names_no_authority_when_no_record_grants_one`. `test_merged_poll_retires_once` passed. I deleted the temporary subset file tests/.subset-sec.test.sh

* fix(park): write the park record pending before the stop and settle it on tick

cmd_park now writes state/<id>.review-park with pending=1 before
fm-control.sh exit and drops the flag once the stop is confirmed. A park
that dies after the stop, or whose final write fails, still leaves the
lane watched and resumable; crew state and list read it as parking. Each
tick promotes a pending record to parked once its agent is confirmed dead
and drops it while the agent is still alive. A record that cannot be
written refuses the park before the agent is stopped.

The re-armed merged-poll test now expects the repeated teardown-refusal
wake while the merge notice itself is not repeated.

* fix(park): bound the pending-park agent check by the tick budget

settle_pending asked the backend whether a pending lane's agent is alive
with no timeout, before the lane loop that honours the tick deadline, so
a hung backend (for example an unanswering tmux server) held the whole
tick and the watcher with it. The check now runs under fm_run_timed cut
to what the tick has left, and settling happens inside watch_parked, so
a tick that runs out of time saves the next lane in the existing cursor
and the next tick resumes there. An unanswered check leaves the record
pending.

* fix(park): require every required check reported, relaunch on inline replies

The GitHub park gate now refuses while a check the base branch requires has
not reported on the head (or the requirement cannot be read), using the
required-check reading bin/fm-pr-merge.sh does, moved into bin/fm-pr-lib.sh
so both share it. Review-thread comments join the activity list, so an
inline reply in an existing thread relaunches a parked worker.

* fix(park): run lane actions detached so no budget cuts them short

Park, relaunch, and merge-time cleanup now run as detached single-flight
actions under the lane lock instead of inside the tick or the watcher's
merged-poll iteration. The tick holds only forge reads and action starts,
so its budget can no longer kill a slow but successful relaunch, and the
merged-poll path only starts the teardown. Each action publishes its
outcome for the next tick to report, and a merge-time cleanup waits for an
action already under way on the lane.

The ship-landing skill now names the watcher as the one owner of a merged
lane's teardown, including merges made through fm-pr-merge.sh, so
firstmate no longer tears such a lane down a second time.

* no-mistakes(document): Document review parking and merge cleanup

* no-mistakes(ci): Fixed tick-bounded idle checks, reserved half the tick for unparked lanes, and persisted merge-cleanup requests before retiring the merge poll; pending requests retry on later ticks. Updated the park-on-review documentation and state-file list. `tests/fm-park.test.sh`, shell syntax checks, and `git diff --check` pass. The requested new regression tests for the three findings were not added, so those specific scenarios are not yet verified

* no-mistakes(ci): Fixed the requested behavior: unparked merge cleanup now requires config/auto-land; pending cleanup is recorded before poll retirement and dispatched after releasing the control lock; temporary lifecycle-lock refusals preserve the request for retry. Updated docs and behavioral tests. Full suite’s failure was only its maintainer-label gate; ci.yml was left unchanged. tests/fm-park.test.sh and git diff --check pass. ShellCheck reported existing source-following/unused-variable diagnostics; the lint partition and combined shellcheck command timed out, and the merge-poll tests were not completed

* no-mistakes(ci): Added behavioral regression tests for pending-cleanup recovery after watcher restart and retry after a temporary lifecycle-lock refusal. `FM_LIVE=0 bash tests/fm-park.test.sh`, `shellcheck tests/fm-park.test.sh`, and `git diff --check` pass

* test(park): wait for the pending cleanup request to clear before asserting

A detached land publishes its report before it removes the pending
request, so waiting only for the report let the cleanup tests assert
request removal too early. wait_land_settled waits for the request to
clear, which implies the report exists. The control-lock retry test now
ticks until the retry runs instead of sleeping, failing if any tick
reports the refusal as an outcome.

* fix(park): bind cleanup requests to their PR and record wakes before removing reports

A merge-time cleanup request now records the merged PR, and land drops a
request whose PR is no longer the lane's under the lane lock, so a stale
request cannot tear down a lane that moved on to another PR. Teardown also
removes a lane's cleanup request.

The tick now records its outcome and close lines as one wake before it
removes the reports behind them or marks a close as reported; when the wake
cannot be recorded it removes and prints nothing, so the next tick retries.
The watcher only rings.

The two tick-budget tests run under a 6s tick with 8s slow stubs: under a
2s tick the parked-lane budget was one whole second, so the first forge read
was skipped whenever setup crossed a second boundary.

* no-mistakes(document): Document park-on-review safety behavior

* fix(park): keep the cleanup request until its outcome is saved

Teardown no longer deletes a lane's merge cleanup request. Only the
detached cleanup removes it, after its outcome report is saved, so a
cleanup killed partway through its teardown is retried by the next tick
instead of being lost. A request left behind by a manual teardown is still
dropped by the tick once the task record is gone, or by land when the lane
now records a different PR.

* fix(bin): keep the PR merge watch working when a worker with a PR is relaunched (kunchenguid#7996)

* Preserve PR poll authentication on relaunch

* no-mistakes(review): Keep trace and polytoken meta ahead of PR lines

* fix(spawn): keep a recorded PR the task record's tail across relaunch

A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.

Refs kunchenguid#7938

* fix(spawn): reuse main PR metadata rewrite helper

* no-mistakes(review): Count unresolved GitLab notes individually

* no-mistakes(review): Relaunch parked lanes on incomplete GitHub threads

* no-mistakes(document): Document park-on-review behavior

* fix(park): paginate GitHub comments and fix Linux mode test

* no-mistakes(review): Set private permissions on cleanup requests

* no-mistakes(document): Correct park-on-review cleanup documentation

* fix(park): serialize inbox delivery with review parking

* no-mistakes(ci): Fixed `Lint 1`: removed the unused local variables in `tests/fm-park.test.sh` and exported `FM_HOME`, which the sourced inbox library reads. `bin/fm-lint.sh tests/fm-park.test.sh` passed. The Full suite failure was an aggregate of failed lanes; its log reports `FM_CI_LANES_FAILED=true`, not the underlying lane failure, so I can’t confirm this lint fix resolves it. The park test started passing scenarios but exceeded the 120-second timeout before completing

* fix(spawn): keep a recorded PR the task record's tail across relaunch

A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.

Refs kunchenguid#7938

* feat: park ship lanes on review and clean them up on merge

Add bin/fm-park.sh: a clean-state gate (GitHub and GitLab) that parks a lane
only when CI is green on the current head, review bots have posted on it or a
quiet window passed, no thread is unresolved, nothing conflicts, and the PR is
not a draft; a park that re-reads the forge bound to the recorded head before
stopping the agent through fm-control, durably leases the Treehouse slot (a
re-park reuses the lane's own lease), and records the lane; a watcher tick that
relaunches a fresh worker on review activity and reports closed PRs once; and
merge-time cleanup through fm-teardown from the watcher's merged path. The
watcher starts fm-park only when a lane is parked or parking is configured.

Teach teardown's landed proof to read GitLab merge requests and fetch
refs/merge-requests/<n>/head, so squash and merge-train merges are recognized
from the MR head.

Local proof:
- tests/fm-park.test.sh (13 tests) covers each unclean gate condition, a head
  change after the verdict, park preflight refusals, the lease, every relaunch
  trigger, closed reporting, the opt-ins and merge cleanup.
- An isolated lab home (Herdr lab session, faked forge, real Treehouse pool)
  ran a full cycle through the real fm-pr-check, fm-park, fm-watch and
  fm-teardown: park with the slot leased (a concurrent get received another
  slot), a review comment relaunched a fresh worker in the same copy, re-park,
  and on merge the watcher tore the lane down and returned the copy.
- A read-only gate run against live lanes in other homes refused lanes with
  pending CI, unresolved threads or uncomputed mergeability, passed clean ones,
  and read a merge-train squash-merged GitLab MR (main got a commit other than
  the MR head) as merged.

Refs kunchenguid#7938

* no-mistakes(review): Harden park gate, bound tick, default merge cleanup

* no-mistakes(document): Inventory park-on-review config flags and state records

* no-mistakes(ci): I made fixes for all six Greptile findings (ci-1 to ci-6). One existing watcher test now fails because of the ci-1 change and needs your decision. Fixes: - **ci-1, merge cleanup skipped** (bin/fm-watch.sh): the merge poll now runs `fm-park.sh land` even when bin/fm-pr-merge.sh recorded the merge first. The cleanup outcome wakes the captain under the queue key `land-<id>`. New test `test_self_merged_lane_is_still_cleaned_up_by_the_poll` in tests/fm-pr-check-security.test.sh. - **ci-2, old CI approves parking** (GitLab gate): `head_pipeline` counts only when its sha equals the MR's current sha. - **ci-3, bot progress permits parking**: a reviewer bot counts as settled only when it has submitted a review bound to the current head; otherwise the quiet window decides. GitLab bot notes carry no such signal, so GitLab lanes now always wait for the quiet window (default 15 minutes after CI finishes). - **ci-4, edited feedback unanswered**: the relaunch trigger uses the later of a comment's creation and edit time. - **ci-5, later lanes starved**: a new `visit_lanes` helper starts each tick at the lane the previous tick did not reach (state/.review-park-tick-next and state/.review-park-tick-next-unparked) and wraps around. - **ci-6, unfinished park looks complete**: `cmd_park` writes state/<id>.review-park only after `fm-control.sh exit` confirms the stop. I updated the header docs in bin/fm-park.sh, docs/configuration.md and the operational-home-layout skill to match. Verification: - tests/fm-park.test.sh: all 18 cases pass, including the new regression cases for ci-2 to ci-6. - shellcheck is clean on all changed scripts and tests. - I did not run the new tests against the old code to see them fail first. Open problem: `test_merged_poll_reregistration_after_notification_is_absorbed` now fails. It re-arms a merge poll for a merge that was already reported, and in that test teardown refuses (the task has no project identity). The second watcher cycle now retries cleanup and wakes the captain with the same refusal again. I did not change this. The choice is: - keep repeating the refusal, which is arguably right because the lane still needs a decision, and update that test; or - wake only when cleanup succeeded in the already-recorded case, which would hide a refusal after a merge done through fm-pr-merge.sh and partly undo ci-1. The watcher subset stopped at that failure, so three tests never ran: the new ci-1 test, `test_self_merge_and_poll_publish_one_outcome`, and `test_merged_poll_row_names_no_authority_when_no_record_grants_one`. `test_merged_poll_retires_once` passed. I deleted the temporary subset file tests/.subset-sec.test.sh

* fix(park): write the park record pending before the stop and settle it on tick

cmd_park now writes state/<id>.review-park with pending=1 before
fm-control.sh exit and drops the flag once the stop is confirmed. A park
that dies after the stop, or whose final write fails, still leaves the
lane watched and resumable; crew state and list read it as parking. Each
tick promotes a pending record to parked once its agent is confirmed dead
and drops it while the agent is still alive. A record that cannot be
written refuses the park before the agent is stopped.

The re-armed merged-poll test now expects the repeated teardown-refusal
wake while the merge notice itself is not repeated.

* fix(park): bound the pending-park agent check by the tick budget

settle_pending asked the backend whether a pending lane's agent is alive
with no timeout, before the lane loop that honours the tick deadline, so
a hung backend (for example an unanswering tmux server) held the whole
tick and the watcher with it. The check now runs under fm_run_timed cut
to what the tick has left, and settling happens inside watch_parked, so
a tick that runs out of time saves the next lane in the existing cursor
and the next tick resumes there. An unanswered check leaves the record
pending.

* fix(park): require every required check reported, relaunch on inline replies

The GitHub park gate now refuses while a check the base branch requires has
not reported on the head (or the requirement cannot be read), using the
required-check reading bin/fm-pr-merge.sh does, moved into bin/fm-pr-lib.sh
so both share it. Review-thread comments join the activity list, so an
inline reply in an existing thread relaunches a parked worker.

* fix(park): run lane actions detached so no budget cuts them short

Park, relaunch, and merge-time cleanup now run as detached single-flight
actions under the lane lock instead of inside the tick or the watcher's
merged-poll iteration. The tick holds only forge reads and action starts,
so its budget can no longer kill a slow but successful relaunch, and the
merged-poll path only starts the teardown. Each action publishes its
outcome for the next tick to report, and a merge-time cleanup waits for an
action already under way on the lane.

The ship-landing skill now names the watcher as the one owner of a merged
lane's teardown, including merges made through fm-pr-merge.sh, so
firstmate no longer tears such a lane down a second time.

* no-mistakes(document): Document review parking and merge cleanup

* no-mistakes(ci): Fixed tick-bounded idle checks, reserved half the tick for unparked lanes, and persisted merge-cleanup requests before retiring the merge poll; pending requests retry on later ticks. Updated the park-on-review documentation and state-file list. `tests/fm-park.test.sh`, shell syntax checks, and `git diff --check` pass. The requested new regression tests for the three findings were not added, so those specific scenarios are not yet verified

* no-mistakes(ci): Fixed the requested behavior: unparked merge cleanup now requires config/auto-land; pending cleanup is recorded before poll retirement and dispatched after releasing the control lock; temporary lifecycle-lock refusals preserve the request for retry. Updated docs and behavioral tests. Full suite’s failure was only its maintainer-label gate; ci.yml was left unchanged. tests/fm-park.test.sh and git diff --check pass. ShellCheck reported existing source-following/unused-variable diagnostics; the lint partition and combined shellcheck command timed out, and the merge-poll tests were not completed

* no-mistakes(ci): Added behavioral regression tests for pending-cleanup recovery after watcher restart and retry after a temporary lifecycle-lock refusal. `FM_LIVE=0 bash tests/fm-park.test.sh`, `shellcheck tests/fm-park.test.sh`, and `git diff --check` pass

* test(park): wait for the pending cleanup request to clear before asserting

A detached land publishes its report before it removes the pending
request, so waiting only for the report let the cleanup tests assert
request removal too early. wait_land_settled waits for the request to
clear, which implies the report exists. The control-lock retry test now
ticks until the retry runs instead of sleeping, failing if any tick
reports the refusal as an outcome.

* fix(park): bind cleanup requests to their PR and record wakes before removing reports

A merge-time cleanup request now records the merged PR, and land drops a
request whose PR is no longer the lane's under the lane lock, so a stale
request cannot tear down a lane that moved on to another PR. Teardown also
removes a lane's cleanup request.

The tick now records its outcome and close lines as one wake before it
removes the reports behind them or marks a close as reported; when the wake
cannot be recorded it removes and prints nothing, so the next tick retries.
The watcher only rings.

The two tick-budget tests run under a 6s tick with 8s slow stubs: under a
2s tick the parked-lane budget was one whole second, so the first forge read
was skipped whenever setup crossed a second boundary.

* no-mistakes(document): Document park-on-review safety behavior

* fix(park): keep the cleanup request until its outcome is saved

Teardown no longer deletes a lane's merge cleanup request. Only the
detached cleanup removes it, after its outcome report is saved, so a
cleanup killed partway through its teardown is retried by the next tick
instead of being lost. A request left behind by a manual teardown is still
dropped by the tick once the task record is gone, or by land when the lane
now records a different PR.

* fix(bin): keep the PR merge watch working when a worker with a PR is relaunched (kunchenguid#7996)

* Preserve PR poll authentication on relaunch

* no-mistakes(review): Keep trace and polytoken meta ahead of PR lines

* fix(spawn): keep a recorded PR the task record's tail across relaunch

A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.

Refs kunchenguid#7938

* fix(spawn): reuse main PR metadata rewrite helper

* no-mistakes(review): Count unresolved GitLab notes individually

* no-mistakes(review): Relaunch parked lanes on incomplete GitHub threads

* no-mistakes(document): Document park-on-review behavior

* fix(park): paginate GitHub comments and fix Linux mode test

* no-mistakes(review): Set private permissions on cleanup requests

* no-mistakes(document): Correct park-on-review cleanup documentation

* fix(park): serialize inbox delivery with review parking

* no-mistakes(ci): Fixed `Lint 1`: removed the unused local variables in `tests/fm-park.test.sh` and exported `FM_HOME`, which the sourced inbox library reads. `bin/fm-lint.sh tests/fm-park.test.sh` passed. The Full suite failure was an aggregate of failed lanes; its log reports `FM_CI_LANES_FAILED=true`, not the underlying lane failure, so I can’t confirm this lint fix resolves it. The park test started passing scenarios but exceeded the 120-second timeout before completing

* no-mistakes(review): Document GitLab pagination completeness invariant

* no-mistakes(review): Remove duplicate temporary park test suite

* no-mistakes(review): Strengthen relaunch and inbox lock regressions

* no-mistakes(review): Keep merge poll armed when cleanup queueing fails

* no-mistakes(review): Preserve pending parks and merge cleanup retries

* no-mistakes(review): Test merged-poll cleanup queue retries

* no-mistakes(review): Retain cleanup request when outcome reporting fails

* no-mistakes(document): Fix park-on-review documentation links

* fix(park): relaunch a pending park only once its stop is confirmed

A pending record now stays pending while its agent reads alive, so feedback could relaunch over a worker whose park never finished. Hold every trigger until the stop is confirmed, for a live agent and an unreadable one alike.

Update the preflight test to expect the record to stay pending and expire at the stop bound, fix gh_fixture's review count for extra_reviews, and make the interrupted-alive and interrupted-unreadable cases wait out the detached relaunch they rule out.

* no-mistakes(review): Fix same-second relaunches and synchronize detached tests

* no-mistakes(document): Clarify park-on-review documentation ownership

* no-mistakes(ci): Applied the GitLab incomplete-discussions handling and outage distinction in `bin/fm-park.sh`, with corresponding test updates. Verification failed: `FM_LIVE=0 bash tests/fm-park.test.sh` reported 3/32 failures; specifically, the failed-page parked-lane relaunch was not observed within the test timeout. Fix/test remains incomplete

* test(park): write real newlines in the GitLab relaunch fixtures

The fixtures used a doubled backslash, so the record held one line, parked_at could not be read, and the tick skipped the lane. The relaunch assertion could not pass, and the outage assertion passed without reaching the forge read.

* no-mistakes(review): Synchronize detached teardown timing test

* no-mistakes(ci): Added the measured `fm-park.test.sh` serial hint and provenance; moved closed-PR reporting ahead of the idle-worker check and added a busy-worker regression. Coverage guard passed (43/290 unhinted), and `FM_LIVE=0 bash tests/fm-park.test.sh` passed. `tests/fm-test-run.test.sh` reached the shard-coverage cases but timed out during a later case; `git diff --check` passed

* fix(teardown): gate GitLab merged-MR landed-work proof on park-on-review opt-in

Teardown accepts a merged GitLab merge request (squash or merge train) as
landed work only when config/park-on-review or config/auto-land exists.
Without either flag a GitLab MR goes through the same read as on main.

* no-mistakes(ci): Fixed park preflight to reject backends lacking verified stop and replacement-agent support before lease or record creation. Added a Zellij regression test; `bash tests/fm-park.test.sh` and `git diff --check` pass

* no-mistakes(ci): Fixed CI coverage by moving fm-park into the proven portable parallel set and rebalancing its lanes; retained teardown status-4 slot/path details in saved land reports with a regression test. Updated scheduling evidence docs. Verified coverage guard (27 parallel; max 850004 ms), fm-park tests, and doc audience check. fm-test-run tests passed scheduling/coverage checks but timed out at 600s before the suite completed

---------

Co-authored-by: Ian Brown <742554+zestysoft@users.noreply.github.com>
* feat(bootstrap): report orphan treehouse pools

* no-mistakes(review): Use Treehouse lease start for stale-slot age

* no-mistakes(review): Fix stale lease ages and duplicate-pool detection

* no-mistakes(ci): Fixed the report to inspect later slots, report duplicate pools once, and use slot-path modification time when lease timestamps are absent. Added a before/after file snapshot to the read-only behavior test; its pool root was already isolated under the test temp directory. `bash tests/fm-bootstrap.test.sh` passed (with noisy expected Git errors from non-repository fixture paths)

* no-mistakes(ci): Updated `bin/fm-bootstrap.sh` to use `treehouse-state.json` `created_at` for stale-slot age, skip missing or nonnumeric parsed epochs, and remove the filesystem-stat fallback. Added old- and missing-`created_at` fixtures in `tests/fm-bootstrap.test.sh`. The pool-report test passed; the full script exceeded the 120-second timeout later in the suite. Expected fixture Git errors were printed

* fix(bootstrap): parse offset pool timestamps

* no-mistakes(review): Preserve treehouse report field boundaries

* fix(bootstrap): recognize durable pool leases

* no-mistakes(review): Recognize durable lease IDs and holders as owned slots

* no-mistakes(review): Recognize durable leases and normalize duplicate pool identity

* no-mistakes(review): Skip empty pool records during orphan reporting

* no-mistakes(review): Skip empty worktrees and pathless slot records

* no-mistakes(test): Fixed pool-report test assertion; focused pool fixture passes

* perf(bootstrap): avoid repeated pool index parsing

* no-mistakes(document): Document read-only Treehouse pool report

* Declare pool report clock local

* no-mistakes(review): Remove Treehouse CLI prerequisite from pool report

* no-mistakes(document): Correct pool report prerequisites

* Identify duplicate Treehouse pools by origin

* no-mistakes(document): Document Treehouse pool reporting and age threshold

* no-mistakes(ci): Fixed the duplicate-pool report to print the local checkout path instead of the origin URL. Added a behavioral test with credentialed HTTPS origins; it passed. The bootstrap test suite timed out after 180 seconds during later tests; pool-report assertions passed

* test: remove unused bootstrap pool local

* no-mistakes(document): Clarify Treehouse pool report behavior

* feat(bin): make the Treehouse pool report opt-in via config/treehouse-pool-report
…d#8381)

* fix: recover stale real-directory lock records

* no-mistakes(review): Fix watch-lock identity checks across path aliases

* no-mistakes(document): Document lock recovery and refusal behavior

* no-mistakes(ci): Fixed the shared reaper to name stable inaccessible lock directories while keeping replacements retriable. Non-root permission, both session paths, recovery/race regressions, and pinned lint pass. Scratch files cleaned
…unchenguid#7376)

* fix(bin): keep home-summary collection inside its refresh deadline

A home of twelve scouts with long status histories repeatedly hit the
60-second home-summary refresh deadline while fm-fleet-snapshot.sh was
still collecting. After the bounded concurrent reads, every task row was
composed one task at a time, and each row re-folded that task's whole
append-only status history through status_open_decisions, which forked
four to five subshells per decision transition. Collection cost grew
with task count times history and had no concurrency of its own, so a
busy host pushed it past the whole-operation bound before validation or
publication.

Fold each task's status history inside its own observation worker while
its bounded current-state read is outstanding, and compose its row in
that same worker, so FM_SNAPSHOT_LOCAL_READ_CONCURRENCY now bounds the
whole per-task cost. Give the whole-file fold's per-line helpers the
optional out-variable form status_line_verb already uses, so the fold no
longer forks per line; every printed form is unchanged for other
callers.

The refresh deadline, per-child current-state bound, validation, atomic
last-good publication, and refresh lock are unchanged.

* no-mistakes(review): Describe batched snapshot workers and remaining history-growth cost

* no-mistakes(review): Rename per-task row temp file to avoid dotted-id collisions
…id#8304)

The runner-up floor check already treats a probability of 0.3 as
clearing a declared floor of 0.3. jq 1.6 prints the JSON literal 0.30
as 0.3, while jq 1.7 and 1.8 keep the trailing zero, so the assertion
failed only on that spelling. The canned probability is now 0.3, which
jq 1.6, 1.7, and 1.8 all print the same way.
…8383)

* fix(remote-job): pass USER and LOGNAME to the remote job child

* no-mistakes(document): Spresniť dokumentáciu prostredia pracovníka

* test(remote-job): run the identity-unset fixture in its own process for clean lint

* no-mistakes(document): Spresniť odkazy na kontrakt prostredia
Grok 1.0.77 titles the grok-4.7-build-fast composer
'Grok 4.7 Fast (medium) · always-approve'. The two-word model name
failed the typed-title check, so the idle composer read unknown and
fm-control exit and relaunch refused to type /exit.

Accept the single ' Fast' model word on the always-approve title only.
Pin the real styled Rex captures as fixtures.

Closes kunchenguid#8388
…nguid#8422)

* Settle declared captain holds from terminal PR evidence

Keep forge settlement opt-in and preserve unfinished work through an explicit release policy. Record merge or closure evidence without claiming a captain answer, and report unmerged closures through contribution notifications.

Fixes kunchenguid#8368

* no-mistakes(review): Defer away releases and scope closed PR reports

* no-mistakes(review): Ignore every structured link in PR hold fingerprint

* no-mistakes(review): Hold away-record lock across forge hold release

* no-mistakes(review): Defer forge release promptly on a busy away lock

* no-mistakes(document): List hold-pr-settle in layout and scripts docs

* no-mistakes(ci): Both selected Greptile findings are fixed in the worktree; nothing is committed. Invariants and sites: - ci-2: the contribution poll must never wait on a lock longer than the watcher's 30-second check bound. `settle-pr` takes two locks. The away-record lock was already bounded to 1 second. The task control lock was the only unbounded site, so `command_settle_pr` in bin/fm-captain-hold.sh now takes it with `fm_lock_acquire_wait_bounded ... 1` and returns 0 silently when busy. The policy file stays, so a later poll retries. The other callers of `acquire_task_control_lock` are captain or firstmate commands, not the poll, and are unchanged. - ci-3: a `closed` event and wake go only to a task that is an open captain hold at the moment the event is raised. `terminal_hold_event` in bin/fm-contributions.sh is the single place that raises it (the settled, final and live paths all call it). It now runs `fm-captain-hold.sh open <task>` after the cheap snapshot filter and before `write_record`, so only rows about to raise an event pay for the process. Tests added to tests/fm-contributions.test.sh: - `test_forge_settlement_defers_while_the_task_is_busy`: a held control lock makes the poll and a direct `settle-pr` return 0 with no output inside the bound, keep the policy and the hold, then settle once the lock is free. - `test_settled_task_gets_no_closed_event_for_its_other_pr`: one task with two closed PRs, the first settles the hold, the second raises no poll line, wake or `closed` event. I confirmed it fails without the bin/fm-contributions.sh fix (`not ok - the second closed PR woke a task settled in the same poll`) and passes with it. - The lock-holder fixture of the existing away-record-lock test became a shared `hold_lock` helper. docs/captain-hold-lifecycle.md gained one sentence on the busy-task deferral and an updated test list. Verification: `nice -n 10 bash bin/fm-test-run.sh tests/fm-contributions.test.sh` exited 0 (`FM_TEST_SUMMARY total=1 failed=0`, about 335 seconds). No other suite was run, as instructed. ci-1 (Full suite) remains a recorded CI override: it is only the full-ci label gate, no code or workflow was changed for it, and the hosted full suite did not pass. Not checked and risks: - The busy-lock test was not run against the old code, because the old unbounded wait would hang the test instead of failing it. - When a busy control lock defers settlement of a closed PR, the policy file remains, so that poll still raises the `closed` event and wake for the still-held task. That matches the existing away-deferral behaviour and was left unchanged. - Shellcheck was not run
# Conflicts:
#	.agents/skills/bootstrap-diagnostics/SKILL.md
#	.agents/skills/harness-adapters/references/harness/claude.md
#	.agents/skills/operational-home-layout/SKILL.md
#	.agents/skills/ship-landing/SKILL.md
#	.claude/settings.json
#	.github/workflows/ci.yml
#	README.md
#	bin/fm-bearings-snapshot.sh
#	bin/fm-busy-event.sh
#	bin/fm-captain-hold.sh
#	bin/fm-claude-stop-autoarm.sh
#	bin/fm-crew-state.sh
#	bin/fm-dod-lib.sh
#	bin/fm-lock.sh
#	bin/fm-pr-check.sh
#	bin/fm-session-lock-lib.sh
#	bin/fm-spawn.sh
#	bin/fm-teardown.sh
#	bin/fm-test-run.sh
#	bin/fm-watch.sh
#	docs/architecture.md
#	docs/configuration.md
#	docs/fm-test-portable-shards.md
#	docs/scripts.md
#	docs/turnend-guard.md
#	docs/verification/process-event-sources.md
#	docs/verification/supervision.md
#	docs/watcher-continuity.md
#	tests/assets/board-render-harness.mjs
#	tests/fm-backlog-atomicity.test.sh
#	tests/fm-bearings-board-render.test.sh
#	tests/fm-bearings-snapshot.test.sh
#	tests/fm-claude-stop-autoarm.test.sh
#	tests/fm-extension-binding.test.sh
#	tests/fm-procevent.test.sh
#	tests/fm-spawn-dispatch-profile.test.sh
#	tests/fm-turnend-guard.test.sh
# Conflicts:
#	tests/fm-control-relaunch.test.sh
…d both fixes are in tests only. "Full suite" failed only because those two shards did. 1. Serial 10, tests/fm-spawn-dispatch-profile.test.sh: upstream bf421ee changed bin/fm-spawn.sh so ship and scout launches set FM_HOME. The merge dropped `export FM_HOME='$2'; ` from the test's `claude_expected_launch` helper, and I put it back. Every Claude launch check in that file goes through this one helper. For every test file that mentions `FM_HOME='` upstream, the number of `export FM_HOME` lines matches between upstream and HEAD. 2. Serial 2, tests/fm-watch-triage.test.sh: upstream now names per-window state files with a `v3.<hash>` key, which tests get from `watch_window_key`. The fork-only `make_finished_stale_case` and `test_finished_handed_on_stale_absorbed` still built the key with `tr ':/.' '___'`, so they prepared and then checked the wrong file and failed every time. I switched both to `watch_window_key "test:fm-$name"`. The other `tr ':/.' '___'` uses in tests are unchanged from upstream. Verification: - `test_finished_handed_on_stale_absorbed` failed 3 runs out of 3 before the fix and passes after it. - The full spawn-dispatch-profile file passes (exit 0, 114 ok). - bin/fm-lint.sh and `git diff --check` are clean. - The full watch-triage file was stopped by the background time limit after 79 tests passed and none failed, so a complete run in CI is still needed. The cancelled "Behavior portable parallel 2" check (ci-4) is not covered
@clarsen clarsen changed the title feat: merge upstream firstmate main into fork feat(bin): merge upstream firstmate main into fork Nov 22, 2026
@clarsen
clarsen merged commit f4384dc into main Nov 23, 2026
51 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.