Skip to content

feat: sync upstream kunchenguid/firstmate main through 99054624 - #5

Closed
PhillGray wants to merge 90 commits into
mainfrom
upgrade/firstmate-2026-10-29
Closed

PhillGray wants to merge 90 commits into
mainfrom
upgrade/firstmate-2026-10-29

Conversation

@PhillGray

@PhillGray PhillGray commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Intent

Nightly upstream sync of the PhillGray/firstmate fork: merge kunchenguid/firstmate main (through 9905462, 2026-10-28) into the fork as a plain conflict-free merge commit. Goal: keep the fork tracking upstream. This branch supersedes the still-open sync PRs #2, #3 and #4 (it contains everything they do plus 12 newer upstream commits). Constraints the owner set: keep the fork's mode-777 guards (bin/fm-x-lib.sh:96,109, bin/fm-procevent-lib.sh, bin/fm-bootstrap.sh:1008) and the fork's .agents/skills/aios-estate skill unchanged; add no agent co-author lines; keep the owner-role word the owner banned out of commit and PR text (upstream file contents that already contain it are fine). Do not rewrite upstream code: fixes should be limited to what is needed to make the merged tree pass the fork's tests/lint. Upstream test changes in the window strengthen tests (tasks-axi skip -> fail) and must not be weakened.

What Changed

  • Merges upstream kunchenguid/firstmate main through 99054624 as a plain merge commit. It adds the new paseo, rex, t3code and tern runtime backends (bin/backends/*, plus fm-t3-mcp.mjs, fm-rex-marks.sh and their docs), the Cortex harness adapter, and the new helpers fm-capacity.sh, fm-usage-warner.sh, fm-pr-health.sh, fm-record-export.{sh,py}, fm-approval-failover.sh and fm-supervision-handoff.sh.
  • Brings in upstream behavior changes in spawn and dispatch resolution, which now prefers the configured provider family. It also changes the watcher's wedge cap and triage pause, the supervision host and daemon, teardown containment proofs, local-only merges pinned to the accepted done commit, session locking, and the OpenCode 2 and Pi primary plugins (including a new Pi read-repetition guard). The CI workflow, skills and docs are updated to match.
  • Adds or splits the upstream test suites for these areas (for example, the backend, watch-triage, wedge-cap, supervision-host, record-export and usage-warner tests). This supersedes the earlier open sync PRs feat: merge upstream firstmate main (69 commits, 2026-10-19 to 2026-10-25) #2, feat: merge upstream firstmate main through 46df1608 #3 and feat: sync upstream firstmate main through 2ba4c455 #4.

🤖 Generated with Claude Code

Risk Assessment

⚠️ Medium: The constraints I could check in the working tree hold (777 guards, aios-estate skill present, no conflict markers, tasks-axi fail-not-skip), but git access was blocked, so the merge diff and commit messages were never actually reviewed.

Testing

No scenario could be driven live: this phase's permission mode still refuses git, bash test suites, bin/ scripts and creating the evidence directory, so the verdict is inconclusive and remote CI is the only regression signal for the merged tree.

  • Live validation: ⚠️ inconclusive - 0 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Local-only merge pins to the accepted done commit (upstream kunchenguid#7916) ⏸️ untested no Permission mode refuses every bash/git execution in this phase; grant Bash execution of tests/.test.sh and bin/.sh to drive it.
Dispatch resolution prefers the configured provider family (upstream kunchenguid#7876) ⏸️ untested no Running bin/ dispatch scripts requires Bash approval, which this phase does not have.
Teardown reports when a Git containment proof is unavailable (upstream kunchenguid#7915) ⏸️ untested no Needs git and bin/ teardown scripts to run; both are refused by the permission mode.
Patch-landed proof preserves whitespace (upstream kunchenguid#7910) ⏸️ untested no Needs git and the proof scripts to run; both are refused by the permission mode.
Adversarial: bearings snapshot fails rather than skips when tasks-axi is missing ⏸️ untested no tests/fm-bearings-snapshot.test.sh cannot be run without Bash approval.
Fork mode-777 guards and the aios-estate skill still work after the merge ⏸️ untested no Running bin/fm-x-lib.sh, bin/fm-procevent-lib.sh or bin/fm-bootstrap.sh paths, or diffing the skill against the base, needs Bash/git approval, which this phase lacks.
  • Outcome: ⚠️ 2 warnings across 2 runs (1m15s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 warnings
  • ⚠️ bin/fm-x-lib.sh:96 - This review could not see the diff. Every git command (git status, git log, git diff, and /usr/bin/git) was blocked with 'This command requires approval', so the changes between 4bcf56b and 74e196a were never listed or read. I checked the owner's constraints against the working tree instead, and these hold: (1) the mode-777 guards are still in place at bin/fm-x-lib.sh:96 and :109, bin/fm-procevent-lib.sh:482, :1035 and :1338, and bin/fm-bootstrap.sh:1008; (2) .agents/skills/aios-estate/SKILL.md is present; (3) no merge-conflict markers turned up in tracked .sh/.md/.js/.ts/.json files; (4) the tasks-axi regressions in tests/fm-bearings-snapshot.test.sh:1665 and :1821 fail rather than skip when tasks-axi is missing. Not checked, because each needs git history: whether the aios-estate skill is byte-identical to the base, whether the commit messages contain agent co-author lines or the banned owner-role word, whether the merge is really conflict-free with no fork-side edits to upstream code, and whether any upstream test was weakened. Remedy: re-run this review with git read access, or have a person check git diff 4bcf56bc 74e196a and git log 4bcf56bc..74e196a against those constraints.

🔧 No changes applied.
2 warnings still open:

  • ⚠️ bin/fm-x-lib.sh:96 - This review could not see the diff. Every git command (git status, git log, git diff, and /usr/bin/git) was blocked with 'This command requires approval', so the changes between 4bcf56b and 74e196a were never listed or read. I checked the owner's constraints against the working tree instead, and these hold: (1) the mode-777 guards are still in place at bin/fm-x-lib.sh:96 and :109, bin/fm-procevent-lib.sh:482, :1035 and :1338, and bin/fm-bootstrap.sh:1008; (2) .agents/skills/aios-estate/SKILL.md is present; (3) no merge-conflict markers turned up in tracked .sh/.md/.js/.ts/.json files; (4) the tasks-axi regressions in tests/fm-bearings-snapshot.test.sh:1665 and :1821 fail rather than skip when tasks-axi is missing. Not checked, because each needs git history: whether the aios-estate skill is byte-identical to the base, whether the commit messages contain agent co-author lines or the banned owner-role word, whether the merge is really conflict-free with no fork-side edits to upstream code, and whether any upstream test was weakened. Remedy: re-run this review with git read access, or have a person check git diff 4bcf56bc 74e196a and git log 4bcf56bc..74e196a against those constraints.
  • ⚠️ bin/fm-x-lib.sh:96 - This review still could not see the diff. The round-1 remedy (re-run with git read access) was not delivered: git log, git diff, git status and git show all failed again with 'This command requires approval'. Reading the bare gate repository directly is forbidden by the phase rules, so the change between 4bcf56b and 74e196a was never listed or read. These owner constraints were re-checked against the working tree and hold: (1) the mode-777 guards are still present at bin/fm-x-lib.sh:96 and :109, bin/fm-procevent-lib.sh:482, :1035 and :1338, and bin/fm-bootstrap.sh:1008; (2) .agents/skills/aios-estate/SKILL.md exists; (3) no merge-conflict markers in tracked .sh/.md/.js/.ts/.json files; (4) the tasks-axi regressions at tests/fm-bearings-snapshot.test.sh:1665 and :1821 fail rather than skip when tasks-axi is missing. The version-floor checks at :1667 and :1823 still skip when the installed tasks-axi is older than FM_TASKS_AXI_MIN; whether those lines are upstream's own could not be confirmed without history. Still unverified because each needs git history: whether the aios-estate skill is byte-identical to the base; whether the commit messages contain agent co-author lines or the banned owner-role word; whether the merge is conflict-free with no fork-side rewrites of upstream code; and whether any upstream test was weakened. Remedy: grant git read access to the review phase, or have a person check git diff 4bcf56bc 74e196a and git log 4bcf56bc..74e196a against these constraints.
⚠️ **Test** - 2 warnings
Scenario Result Live Evidence
Local-only merge pins to the accepted done commit (upstream kunchenguid#7916): fm-merge-local merges exactly the accepted commit even if the branch moved afterwards ⏸️ untested no The session's permission mode refuses running any test script or bin/ script under bash. Granting Bash execution approval for tests/.test.sh and bin/.sh in this worktree would let it run.
Dispatch resolution prefers the configured provider family (upstream kunchenguid#7876): fm-dispatch-resolve picks a profile from the configured family ⏸️ untested no Running bash and bin/ scripts needs approval that this session does not have. Grant Bash execution permission and re-run the test phase.
Teardown reports when a Git containment proof is unavailable instead of treating it as proven (upstream kunchenguid#7915) ⏸️ untested no tests/fm-teardown.test.sh needs bash execution, which needs approval this session lacks. Grant Bash execution permission and re-run.
Patch-landed proof preserves whitespace, so a whitespace-only difference is not reported as landed (upstream kunchenguid#7910) ⏸️ untested no The fm-landed-lib consumers can only be driven through bash, which needs approval this session lacks. Grant Bash execution permission and re-run.
Adversarial: bearings snapshot fails, not skips, when tasks-axi is missing (upstream test strengthening must not be weakened) ⏸️ untested no I could not run the test with PATH stripped of tasks-axi because bash execution needs approval. Grant Bash execution permission and re-run.
Fork mode-777 guards and the aios-estate skill still work after the merge (bin/fm-x-lib.sh, bin/fm-procevent-lib.sh, bin/fm-bootstrap.sh) ⏸️ untested no Both the git history read and the guard test need commands that need approval in this session. Grant Bash/git execution permission and re-run.
  • bash tests/fm-merge-local.test.sh (refused: requires approval)
  • bash tests/fm-dispatch-resolve.test.sh (refused: requires approval)
  • bin/fm-dispatch-resolve.sh --help (refused: requires approval)
  • bash --version (refused: requires approval)
  • git diff --stat 4bcf56bc 74e196a (refused: requires approval)
  • mkdir -p ~/.no-mistakes/evidence/01M62K2T6RCG77JYY89AA8FC0K (refused: outside working directory, needs approval)
  • which tasks-axi (ran; tasks-axi is at ~/.local/bin/tasks-axi)

🔧 No changes applied.
2 warnings still open:

Scenario Result Live Evidence
Local-only merge pins to the accepted done commit (upstream kunchenguid#7916) ⏸️ untested no Permission mode refuses every bash/git execution in this phase; grant Bash execution of tests/.test.sh and bin/.sh to drive it.
Dispatch resolution prefers the configured provider family (upstream kunchenguid#7876) ⏸️ untested no Running bin/ dispatch scripts requires Bash approval, which this phase does not have.
Teardown reports when a Git containment proof is unavailable (upstream kunchenguid#7915) ⏸️ untested no Needs git and bin/ teardown scripts to run; both are refused by the permission mode.
Patch-landed proof preserves whitespace (upstream kunchenguid#7910) ⏸️ untested no Needs git and the proof scripts to run; both are refused by the permission mode.
Adversarial: bearings snapshot fails rather than skips when tasks-axi is missing ⏸️ untested no tests/fm-bearings-snapshot.test.sh cannot be run without Bash approval.
Fork mode-777 guards and the aios-estate skill still work after the merge ⏸️ untested no Running bin/fm-x-lib.sh, bin/fm-procevent-lib.sh or bin/fm-bootstrap.sh paths, or diffing the skill against the base, needs Bash/git approval, which this phase lacks.
  • git log --oneline 4bcf56bc..74e196a (refused: requires approval)
  • git status (refused: requires approval)
  • mkdir -p ~/.no-mistakes/evidence/01M62K2T6RCG77JYY89AA8FC0K (refused: requires approval)
  • bash tests/fm-merge-local.test.sh (refused: requires approval)
  • ls tests (allowed; showed which test suites exist)
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 1)

🔧 No changes applied.
1 warning still open:

  • ⚠️ linter found issues (exit code 1)
✅ **Push** - passed

✅ No issues found.

leonardourci and others added 30 commits October 20, 2026 07:23
…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
…kunchenguid#7627)

* fix(bin): optionally read a PR with no CI checks as unverified, not checks green

nm_ci_checks_state maps the ci log marker "no CI checks reported - still
monitoring" to green, the same verdict as "all CI checks passed". A pull
request that no check ever ran against therefore surfaced as "checks green: PR
ready for review" (kunchenguid#3216).

Add a no-checks verdict for that marker, returned only in a home that creates
config/ci-no-checks-not-green. The run-step consumer reports working with a
detail naming the real condition, and the status-log override no longer
promotes a crew's own "checks green" report while that marker is the latest.
Without the flag every reading is unchanged.

Co-authored-by: Harlan Do <hieudtr8@gmail.com>

* no-mistakes(document): document ended-monitor reading under the zero-checks flag

* fix(bin): read a PR with no CI checks as unverified on every home

The ci log marker "no CI checks reported - still monitoring" now always
yields the no-checks verdict, so a pull request that no check ran against is
reported as working instead of checks green (kunchenguid#3216). The opt-in flag, its
docs section, and its skill entry are removed, the default-path test now
expects working, and the usage header and architecture note describe the
no-checks reading.

---------

Co-authored-by: Harlan Do <hieudtr8@gmail.com>
… test root-safe (kunchenguid#7650)

* no-mistakes(review): correct the counter-reset log line, the sentinel comment, and the root proof

Three findings the review step recorded but never applied, all in this branch's own change.

The clean-rollback branch of the counter-reset guard logged "cap state rolled back", copied
from the sibling marker-write branch. That is wrong here: the cap marker was already written
before this block and _wedge_cap_rollback only truncates the counter, re-arms the since-file
and clears write tracking - it never clears the markers. The window therefore stays silenced
for FM_CAP_HORIZON_SECS, so the one operator-facing line must say that rather than claim the
cap state was rolled back. The rollback behaviour is unchanged and no marker-clear call is
added: the marker is deliberately kept so the window stays quiet.

The sentinel short-circuit comment opened "from either route that has to defend cap state"
and then enumerated three routes. Wording only.

The new regression case injected its fault with chmod 444, which does not restrict root, so
under root the guard would never fire and the case would fail on its own exit-code
assertion. It now skips as root the way this suite's other mode-based faults do. The
assertions are untouched: as the ordinary user the case still proves the guard.

* no-mistakes(review): name both ways a capped window leaves the silence in the reset log line

The tier-0 message for a refused post-fire escalation-counter reset says the cap marker
stands, so the window stays silent until its horizon elapses. That names one release route
where there are two: wedge_episode_end drops the marker through _wedge_cap_markers_clear, so
any episode-ending route ends the silence early, and docs/configuration.md records deleting
the marker as the operator's way to re-engage a capped window at once. This tier writes no
sentinel, so the marker is the only thing left to remove.

The message now names the horizon, an episode-ending route, and the operator remedy, in one
line in the same shape and position as its sibling tier-0 messages. The rollback behaviour,
the marker handling and the tier are unchanged.

* no-mistakes(document): correct root-skip comment's mode-bit precedent in wedge-cap test
craighurdman and others added 27 commits October 24, 2026 23:22
…guid#7738)

* feat(bin): pin a local omp secondmate to its own omp profile

Add the opt-in config/secondmate-accounts/<id>/omp-profile file in the
primary home. When present, that local secondmate's omp agent launches
with --profile <name> and its pre-launch catalog check reads the same
profile; the pin is recorded as omp_profile= in the task record and on
the spawned line. A malformed file refuses before any endpoint, local
copy, or record exists, and a relaunch checks it before stopping the
running agent. An absent file leaves every launch unchanged.

* no-mistakes(document): Document optional omp --profile flag in omp adapter reference

* no-mistakes(review): Reject Windows reserved device names in omp profile pins
…e host's grant (kunchenguid#7265)

* fix(wake): pin TZ in the process-table pid identity

fm_pid_identity's ps fallback (macOS, or any host without /proc) renders
lstart in local time. A supervision engine launched through a wrapper that
exports a different TZ than the host's hook environment read the host's
branch-grant owner identity as a different process, so its drain discarded
the grant as stale and refused. The engine reported but could never
acknowledge its granted rows, and the host handed nearly every wake to main.

Pin TZ=UTC0 alongside the existing LC_ALL and COLUMNS pins, and pin the same
zone in fm-extension.mjs's pidIdentity, which compares identities the bash
helper writes. Add a host regression test that runs the engine in another
time zone than the host on the process-table path.

* no-mistakes(review): Document TZ-pin identity upgrade-window residual

* no-mistakes(document): Note TZ pid-identity upgrade residual in turnend-guard doc
…id#7728)

Rex's process view reports a block's foreground process and its ancestors
only. A login shell that starts the harness through a wrapper in its own
process group (a fish function, a bash shim) stays the reported foreground,
so a live worker read as dead: steering was refused, relaunch could not
confirm the running agent, and the watcher raised stale wakes.

Before calling a shell foreground dead, walk its live descendants through
the shared agent classifier, and trust OSC 7501 records from a harness found
there under the same rule.
…unchenguid#7536)

* feat(backends): add experimental tern runtime backend

* docs(backends): document tern setup and verification limits

* no-mistakes(review): Refuse tern kill when task tab was renamed

* no-mistakes(test): Treat tern shell --rcfile/--init-file values as option arguments

* no-mistakes(document): Document tern endpoint-close refusal for renamed task tabs

* fix(tern): project safe fields before reading Carly answers

* fix(backends): make tern explicit-only

Tern is selected only by `--backend tern`, `FM_BACKEND=tern`, or
`config/backend`; runtime auto-detection no longer routes a spawn into it.
TERM_PROGRAM=tern and TERN_PANE reach every descendant process of a Tern
block, including a tmux server or Herdr client started inside it, so an
inherited marker never proves the captain chose Tern.

- bin/fm-backend.sh: drop the tern arm from fm_backend_detect and the
  auto-detected tern NOTICE from fm_backend_name, which became unreachable
  with the arm.
- Replace the tern detect-precedence and auto-detect-notice tests with
  test_backend_tern_is_never_autodetected, mirroring the Paseo case, and drop
  the Tern-marker unsets that only guarded detection hermeticity.
- docs/tern-backend.md: replace "Runtime detection" with "Selection is
  explicit"; fm-spawn.sh and adapter headers, architecture, configuration,
  README, and the operational-home-layout skill now list tern beside zellij,
  orca, and Paseo as never auto-detected.

* no-mistakes(review): Read tern surface capture JSON text; fix TERM_PROGRAM doc

* no-mistakes(review): Narrow tern Carly projection; name rex as supervisor backend

* no-mistakes(review): Name tern in Command Code backend refusal comment
…nguid#7729)

A fleet pane already carries GIT_CONFIG core.hooksPath, and the suite's
cases set the Git config they assert on themselves, so unset
GIT_CONFIG_COUNT, GIT_CONFIG_KEY_0, GIT_CONFIG_VALUE_0 and
GIT_CONFIG_PARAMETERS at the top as the sibling suites do.
… wait (kunchenguid#7740)

* fix(bin): stop a watcher promptly when a stop lands in its event wait

On bash 3.2 a TERM is held until a running command substitution's child
exits. The watcher's push-backend event wait ran as rec=$(...) and blocks
for up to POLL, so a supervision-host take-over that landed there could not
confirm the stop within its 5s bound. The unconfirmed take-over skipped
restoring main's acknowledgement, the stopped watcher's close minted a fresh
downtime generation, and the next watcher announced it as
check: rearm-resurface with nothing queued, repeating every ~30s.

Run the event wait through the same waited background process group the
pane reads already use (watcher_capture, generalized to watcher_waited).
The helper's own setup failures now return 2, which the event wait reads as
an unusable event path rather than a full-budget wait. Because a stop now
kills the wait before its own cleanup, the wait gets a watcher-owned scratch
TMPDIR that the watcher removes after each wait and on exit, and the
cleanup's group stop is silenced so bash's job-termination notice does not
reach the arm's output.

Add a fm-watch-arm regression case that takes over a watcher inside its
herdr event wait and asserts a confirmed take-over, an unchanged
acknowledged marker, a quiet fresh cycle, and no leftover wait scratch.
Make the event-wait unit case assert the capability flag outside the wait,
since the wait now runs in its own process.

* no-mistakes(test): Raise event-wait take-over regression POLL so it fails on base

* no-mistakes(document): Document event-wait stop handling in watcher continuity

---------

Co-authored-by: vatsa <pashupati@vatsa.lan>
…ee (kunchenguid#7752)

The EXIT trap removed the fixture root with a plain rm -rf. When the run
stops early, for example when the watcher auto-relaunch leg fails, the
fixture still holds the read-only state/<id>.git-hooks strip folder, so
cleanup prints "Permission denied" for each hook, leaves the fixture root
behind and exits non-zero. Use the shared fm_test_remove_tree, which makes
read-only fixture directories writable before it removes them.

Refs kunchenguid#7629
* feat(bin): add allowlisted live record sync

* feat(bin): archive teardown records by generation

* feat(bin): export task records before teardown

* docs: define the private record export contract

* fix(bin): satisfy ShellCheck in the record exporter and its test

* fix(bin): publish record exports as safe snapshots

* fix(bin): make record archives transactional

* fix(bin): fail closed on record export teardown

* fix(bin): harden record export transactions

* fix(bin): prevent record export staging wedges

* no-mistakes(review): Archive task records before irreversible teardown cleanup

* no-mistakes(review): Archive records after endpoint quiescence

* no-mistakes(document): Consolidate record export architecture documentation

* no-mistakes(ci): [Certain] Fixed both CI issues: quoted the remote-home test fixture assignment to clear ShellCheck, and added the missing `spawn_gen` to the export-enabled remote retirement fixture so the expected lost-slot exit code is preserved. ShellCheck, `git diff --check`, and the focused remote-home export test passed. The full lifecycle E2E was blocked locally by an earlier fixture failure (`remote spawn never reached its blocked inheritance write`); CI’s log identified the later failure this fixture correction addresses

* no-mistakes(ci): [Certain] Fixed the fixture to replace any existing `spawn_gen` field before setting `remote-retirement-test`, preserving the exporter’s exactly-one-generation invariant. `git diff --check` passed. The full remote lifecycle test could not reach this scenario: it failed earlier at “remote spawn never reached its blocked inheritance write,” and cleanup reported permission errors on generated git-hook files

* no-mistakes(ci): [Certain] Fixed the fixture race in `tests/fm-remote-secondmate-lifecycle-e2e.test.sh`: it now pins `spawn_gen` after the blocked respawn finishes publishing metadata, so the exporter receives exactly one generation key. `bash -n` and `git diff --check` passed. The full E2E remains blocked by an earlier failure to reach the blocked inheritance write, followed by cleanup permission errors; it did not reach the corrected assertion, captain

* no-mistakes(ci): [Certain] Fixed `teardown_export_records` to return before config-directory safety checks when `record-export-root` is absent, and added a regression test for an unopted home with symlinked `config/`. The regression passed. The full teardown suite stopped in its existing inaccessible-config case: this environment runs as root, which can read the chmod-000 directory, so that case cannot reproduce its expected refusal here. `bash -n` and `git diff --check` passed; `fm-lint.sh` was blocked because `actionlint` is unavailable. The CI log shows steady test progress followed by GitHub cancelling the job and cleaning up orphan processes, with no reported test failure; treat it as provider cancellation and let the fresh push rerun it

* no-mistakes(ci): [Certain] Updated the teardown test fixtures: a regular file at the export-root path now deterministically causes export failure, and a symlinked config directory tests the opted-in safety refusal across users, including root. The unopted symlinked-config regression remains intact. The relevant teardown cases passed; `bash -n` and `git diff --check` passed. The full suite later failed an unrelated leaked-process-reap case. Serial 1 was cancelled without a verdict and, per the provided instruction, needs no code change
…is warm (kunchenguid#7807)

* feat(bin): add opt-in warm-cache compaction for the Claude primary and host engine

Refs kunchenguid#7755

* no-mistakes(review): Persist engine compaction marker, run it abortable, match resume predicate

* no-mistakes(review): Run engine compaction in host shell; skip marker on abandon

* no-mistakes(review): Test abandoned engine compaction is not marked done

* no-mistakes(document): Clarify warm-compact episode and engine resume rules

* no-mistakes(lint): Fix ShellCheck SC2015 in engine compaction marker

* no-mistakes(ci): Test coverage guard and portable parallel 2 failed because the two new warm-compact tests had no timing hint. The runner packed them at the 45000 ms default, pushing the largest serial shard to 1204066 ms, over the 1200000 ms limit. I added measured hints in bin/fm-test-run.sh (fm-warm-compact.test.sh 1500, fm-warm-compact-herdr-live-e2e.test.sh 170). `bin/fm-test-run.sh --check-coverage` now passes (largest serial shard 1194253 ms), and tests/fm-supervision-instructions.test.sh passes. A full run of tests/fm-test-run.test.sh was killed at its time limit and did not finish, so it is unverified. The serial-shard failures in the logs were watcher/timing tests unrelated to warm-compact. I did not reproduce them locally. main also has a failing run. They need a rerun, not a code change
…7810)

* refuse remote Rex servers during spawn

* no-mistakes(document): Clarify Rex locality requirements and remote-worker guidance
* fix(bin): read a Windows win:<pid> session lock in the supervision host and Claude auto-arm

On Git Bash the session lock records its holder as a tagged win:<pid>
(kunchenguid#6300), but four readers still passed that value to the numeric-only
fm_pid_identity and fm_pid_alive: fm_supervision_host_main_key produced no
key, fm_autoarm_claim_next pinned no lock-holder identity and dropped
owner_session_id, fm_autoarm_claim_open rejected the non-numeric lock so a
live claim never read as open, and fm_autoarm_midturn_healthy read a live
holder as lapsed.

Add fm_session_pid_alive and fm_session_pid_identity beside the tagged-pid
contract in fm-session-lock-lib.sh. A tagged pid is answered from the
Windows process table; every other value falls straight through to the
existing numeric helpers, so POSIX behaviour is unchanged. The claim
read-back checks the lock shape with fm_session_pid_valid.

tests/fm-session-lock-windows-consumers.test.sh covers each reader on a
faked Git Bash host, including an exited holder, a reissued Windows pid,
and the tag off Windows, plus a parity case proving untagged values get
exactly the numeric helpers' answers.

Fixes kunchenguid#7739

* no-mistakes(document): Document tagged Windows session-lock consumers

* no-mistakes(ci): Fixed tests/fm-afk-return.test.sh partial host fixtures to copy fm-session-lock-lib.sh alongside fm-supervision-engine-lib.sh in all three affected paths. The focused host/latch tests and tests/fm-session-lock-windows-consumers.test.sh pass; the full afk-return suite exceeded the 180s local timeout after earlier cases passed
)

* test: fail required watcher-triage cases without tasks-axi

* no-mistakes(document): Document required watcher-test dependency and failure rationale

* no-mistakes(ci): Rebased onto 2ba4c45 successfully. New HEAD: 5902c09. Preserved all changes in the relocated pause suite. No conflicts or tracked changes remain. Missing-dependency regression, syntax, and diff checks passed. Command guards blocked the installed-dependency test loop and backup cleanup. Untracked .ci-rebase-backup.bundle remains

* Untrack pipeline backup bundle

* no-mistakes(review): Untrack pipeline backup bundle; exclusion remains blocked

* Untrack excluded pipeline backup bundle

* no-mistakes(document): Document watcher test prerequisite and remove stale count

* no-mistakes(ci): Fixed SC2329 with a one-line annotation for the function exported to child Bash. Tier 3 applies because static analysis cannot trace that indirect use. Focused lint, all four missing-dependency cases, syntax, and diff checks passed
…unchenguid#7875)

* fix(scout): authorize task-scoped empty-inventory completion (kunchenguid#103)

Allow scouts to run only their generated complete --none command for an empty inventory, without granting metadata or backlog edit authority. Keep non-empty inventories and refused attestations with firstmate.

Fork carry for kunchenguid#7862 pending upstream validation.

* fix(scout): allow scoped empty-inventory attestation

* no-mistakes(document): point lifecycle doc at scout brief boundary test
* Add opt-in reminders for overdue open worker decisions

* no-mistakes(document): Align overdue-decision documentation with watcher behavior

* no-mistakes(ci): Fixed ci-1 with a tier-1 structural correction: AWK now compares both task and key as exact strings. Added behavioral regressions for keys 1/01 and task IDs 1/01, including independent backoff. Reproduced the failure before the fix. All focused reminder, decision-key and cursor tests passed, as did stock /bin/bash verification, canonical lint and git diff --check. Only the two intended files changed. No scratch files remain. Publication and PR updates remain with the outer executor
* fix(pi): contain repeated successful unchanged primary reads

Add an off-by-default Linux Pi primary safeguard with bounded configurable
limits, verified ownership, durable stopping, and deliberate user reset.
Preserve ignored legacy guards and require explicit collision migration.

Cover policy, SDK compatibility, installed RPC behavior, and test selection.
Refs kunchenguid#7805.

* no-mistakes(test): Fixed locale-dependent coverage checks; coverage and shard packing passed
…uid#7886)

* fix(bin): reclaim a lock whose dead holder's pid was reused

The generic lock in fm-wake-lib.sh judged a record stale only by asking
whether its pid was alive. Once the holder died and the kernel handed that
pid to an unrelated process, the lock read as held forever and every
acquirer spun and gave up - each watcher re-arm paid for it while trying
to append to the cycle ledger.

Acquisition now records the holder's start time beside its pid, and a
record whose live pid no longer has that start time is stale, so the
ordinary stale-owner takeover reclaims it and reports the pid it took over.
Start time alone is the key because a holder may exec another program,
which keeps its pid and start time but replaces its command line. A record
without a start time, or a pid whose start time cannot be read, keeps the
old pid-liveness answer. The bounded wait's handoff drops the helper's
start time before the pid changes hands and records the caller's after.

Refs kunchenguid#7885

* no-mistakes(document): Note reused-pid lock staleness in FM_LOCK_STALE_AFTER
… work (kunchenguid#7352)

* feat(bin): add opt-in config/spawn-base-primary-checkout for local landings

A fresh pooled task worktree is reset to origin/<default>. A local-only
project lands work on the primary checkout's default branch through
fm-merge-local.sh and never pushes, so that ref stays frozen at the last
push and every fresh task starts behind work already landed, loading the
project's instruction files from the stale tree. The always-on fix proposed
in kunchenguid#3812 replaced the specified origin-only refresh for every home; this
rework keeps that rule as the default and moves the new base behind an
explicit, default-off presence flag, following the existing config/<flag>
pattern.

With config/spawn-base-primary-checkout present:
- fm-spawn.sh starts a fresh local-only ship, or a scout without
  --base-branch, from the primary checkout's <default> when it strictly
  contains origin's tip. Publishing modes and named base branches keep
  origin's tip, because that work is delivered against origin. A diverged
  primary keeps origin's tip and prints a note counting both sides. The
  commit is read from the local object store, so nothing extra is fetched,
  and the clean-slot refusal still runs first.
- fm-review-diff.sh anchors a remote-backed task without base_branch= on the
  branch it delivers to: publishing modes stay on origin/<default>, while a
  local-only ship or a scout is compared against whichever of the local
  <default> and origin/<default> meets the branch later, so the review shows
  the task's own work instead of every locally landed commit.
- fm-promote.sh tells a scout promoted to a publishing mode to return to
  origin's default branch, because in this home the scout may have started
  from the primary checkout's branch, whose unpushed commits would otherwise
  be published with the work.

fm-dod-lib.sh gains fm_mode_publishes as the one predicate those three
readers share. Without the flag every path is unchanged: the spawn resets
to origin's tip, the review anchors on origin/<default>, and promotion keeps
its wording; the existing tests run unmodified. Treehouse 3 (verified on
3.1.3) already hands a slot out at whichever of the local and remote default
branch is further ahead, so with the flag the refresh keeps that slot where
Treehouse put it for a local landing instead of rewinding it, and a project
without origin is untouched as before.

Supersedes kunchenguid#3812.

* no-mistakes(document): Drop change-relative wording from spawn-base config docs

* no-mistakes(ci): The Greptile Review check failed on two review findings, not on a broken build or test. I fixed both as the user directed, and the tests and lint pass. ci-1 (bin/fm-promote.sh): promotion must name origin's default branch only when spawn could actually have started the scout from the primary checkout. Spawn does that only when the project has an origin remote and is recorded on the task. Before this fix, the opt-in flag alone made promotion to no-mistakes or direct-PR say "copy of origin's default branch...", even on a project with no origin. - The new wording now also requires a recorded project (`[ -n "$PROMOTE_PROJECT" ]`) whose `git remote get-url origin` succeeds. That is the same check bin/fm-review-diff.sh already makes. The empty-project guard is needed because `git -C ""` would run in the current directory. Otherwise the existing "default-branch base" wording stays. - The three places that read the flag now agree: spawn, review-diff and promote. - I updated the header and inline comments in fm-promote.sh, and the promote line in docs/configuration.md, to say this applies only to a project with an origin remote. - Test: `test_promote_names_origin_for_a_publishing_mode_in_an_opted_in_home` in tests/fm-task-delivery.test.sh now records a real `project=` with a registry entry, and covers flag on/off × origin/none × direct-PR/no-mistakes/local-only. Only flag on + origin + a publishing mode gets the new wording. The named-base case is unchanged. - Before the fix, the test fails with "not ok - flag on, remote none, direct-PR: the promotion changed the default-branch wording". With the fix, it passes. ci-2 (tests/fm-spawn-pool-base-freshen.test.sh): with the flag set, both publishing modes must start from origin's tip and print no divergence note. - The opted-in spawn test now covers no-mistakes as well as direct-PR, local-only and scout. - The expectations no longer single out direct-PR. Both publishing modes now expect origin's tip, no "note: pooled worktree", and a review anchored at the slot's start, in the leading, diverged and trailing cases. Verification: - `bash tests/fm-task-delivery.test.sh`: exit 0. - `bash tests/fm-spawn-pool-base-freshen.test.sh`: exit 0. - `bin/fm-lint.sh` on the three changed shell files: exit 0 (ShellCheck 0.11.0, pinned, with extended analysis)
…enguid#7915)

* fix(teardown): distinguish unavailable content-landed proof

* no-mistakes(document): Clarify teardown proof failure documentation

* no-mistakes(ci): Captain, CI failed in unchanged watcher recovery code, independent of this PR. The focused failing case passed locally with exit 0. The full suite stalled earlier and was stopped. No tracked changes. Command guard rejected cleanup; scratch remains at .ci-7915/ and tests/.ci-7915-cycle.sh

* chore: untrack CI validation scratch
…kunchenguid#7876)

* feat(dispatch): prefer configured provider family

* no-mistakes(review): drop policy_why field and dead auth fixture from preference tests

* no-mistakes(document): docs: record preferred_provider in schema, diagnostics, verification
)

* fix: pin local-only landing to its accepted done head

Persist the accepted local-only commit in task metadata and refuse landing when the branch or the recorded head changes. Merge the full commit ID under the task control and metadata locks.

Closes kunchenguid#7782

* no-mistakes(test): Refuse local landing races with atomic ref transactions

* no-mistakes(document): Document pinned local landing and recovery contracts

* no-mistakes(ci): Applied only the verified incremental patch and preserved existing repairs. Complete diff matches the supplied candidate hash. Both focused test files, default lint, and source-aware lint passed with exit 0. Evidence retained at /tmp/up7782-local-repair/ci-phase-fresh-*. No commits, pushes, or pipeline-control actions performed; publication remains with the outer executor

* no-mistakes(ci): Fixed both SC2031 false positives in tests/fm-merge-local.test.sh with narrowly scoped suppressions. Tier 2 lint correction; runtime changes were unnecessary. Default lint, source-aware lint, all 8 focused tests, and git diff --check passed. No commits, pushes, or pipeline-control actions performed
@PhillGray

Copy link
Copy Markdown
Owner Author

Superseded by #9 (upgrade/firstmate-2026-11-02), which carries every upstream commit this PR carried.

@PhillGray PhillGray closed this Nov 2, 2026
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.