Skip to content

feat: sync fork with upstream kunchenguid/firstmate main - #27

Merged
demy00 merged 66 commits into
mainfrom
feature/fm-upstream-sync-u3
Nov 14, 2026
Merged

demy00 merged 66 commits into
mainfrom
feature/fm-upstream-sync-u3

Conversation

@demy00

@demy00 demy00 commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Intent

Update Firstmate itself: bring the fork (github.com/demy00/firstmate) up to date with the latest kunchenguid/firstmate main. Approved 2026-11-13 ("yes to all") from this recommendation: "Firstmate itself: the original project has 59 changes we don't have yet, and our copy has 49 of its own. Recommend yes, but after the current PRs land. It's a bigger merge that restarts supervision."
A trial merge of upstream/main into origin/main conflicts in 12 files: AGENTS.md, bin/fm-dispatch-resolve.sh, bin/fm-pr-merge.sh, bin/fm-spawn.sh, bin/fm-teardown.sh, bin/fm-watch.sh, docs/configuration.md, docs/pi-supervision-branch.md, docs/verification/runtime-backends.md, tests/assets/board-render-harness.mjs, tests/fm-bearings-board-render.test.sh, tests/fm-teardown.test.sh.
Conflict rule from the previous syncs: keep our own changes, adapted onto upstream's current version; where the two genuinely clash and keeping both is not possible, bring the question back instead of guessing.

What Changed

  • Merges the latest upstream kunchenguid/firstmate main (59 commits) into the fork. Upstream features brought in:
    • Lavish URL snapshots with feedback routing (fm-lavish-url)
    • Parking ship lanes while they await review (fm-park.sh)
    • Worker status reporting over OSC 7501
    • An opt-in adaptive lane budget based on measured host vitals
    • Asking a Claude primary to /stow before compaction
    • An opt-in Linux container check for changed shell tests
    • Settling captain holds from forge PR events
    • Opt-in PR squash summaries and explicit branch updates before merge
    • Honoring crew-exclude-tools on Claude workers
    • Many fixes to supervision, the watcher, Herdr, remote, process events and teardown
  • Resolves the 12 conflicting files (including fm-spawn.sh, fm-watch.sh, fm-teardown.sh, fm-pr-merge.sh, fm-dispatch-resolve.sh and AGENTS.md) by keeping the fork's own changes, adapted onto upstream's current code.
  • Follow-up fixes after the merge:
    • fm-skill-select.sh now honors TYPESAFE_BASE and exits with code 2 when the value is invalid.
    • Restores the captains_call reader in the board-render test harness.
    • Fixes the watch-arm test's fake date epoch under bash 3.2.
    • Adds tests for the merge's never-send record and repeated waivers.
    • Adds a CHANGELOG entry for the merge.

🤖 Generated with Claude Code

Merge notes

Merges upstream kunchenguid/firstmate main (427056c4, 59 commits since the last sync point bb8dd209) into the fork as one merge commit on top of beeeaded.
Upstream had not moved past 427056c4 when this was prepared.
No history was rewritten and the fork's 40 commits since the last sync stay in place.

What upstream brings that matters here

Fork changes dropped as superseded

  • None. Every conflicted fork change is still needed on upstream's current version.

Fork behaviour kept against upstream

Each of the 12 conflicted files, the upstream and fork changes that met there, and the resolution:

Auto-merged files were checked for the fork's features: the skill-naming spawn gate (#26), Claude usage-limit resume (#23), broken-git-link teardown (#22), the writing levers (#25), design variants (#24), and the captain-hold, yolo and waiver records. PR identity parsing still accepts the fork's yolo= and waiver keys, and no fork-called fm_ function was left undefined.

Validation

  • bin/fm-lint.sh (ShellCheck 0.11.0) reports no findings, and bin/fm-doc-audience-check.sh passes.
  • 68 targeted test scripts cover every file the fork changed since the last sync that the merge touched. 62 pass on macOS.
  • The other six fail the same way on origin/main and on upstream 427056c4, run one at a time on the same machine, so the merge does not cause them: fm-control and fm-watch-wedge-cap-unconfigured-parity hit bash 3.2 empty-array unbound variable errors, fm-supervision-host needs timeout, which macOS lacks, and fm-muse-harness, fm-supervision-host-park and fm-watch-arm fail identically on all three. fm-watch-arm now passes, see Also tidied.
  • TYPESAFE_BASE for skill selection: tests/fm-skill-select.test.sh covers posting to the configured base, and both tools were driven with real curl against a local gateway, from the environment and from .env, with a credential-bearing base refused without echoing it.
  • CI found three more merge-caused failures, all in upstream tests meeting fork behaviour, fixed here: tests/fm-lane-capacity-integration.test.sh wrote a brief with no # Required skills section, which the fork's spawn gate (feat(bin): refuse a fresh worker spawn whose brief names no skills #26) refuses; tests/fm-gotmp.test.sh fake roots lacked the fork-only bin/fm-task-branch-lib.sh and bin/fm-supervision-engine-lib.sh that teardown now reaches; and two new upstream tests had no serial duration hint, which pushed the coverage guard over 15%.
  • Merge-caused failure fixed: the board render harness lost upstream's captains_call reader in the conflict resolution, and tests/fm-bearings-board-render.test.sh failed with ReferenceError: captains_call is not defined. It passes with the reader restored.
  • Never-send record regression: with the fm_ts_off override removed, bash tests/fm-dispatch-resolve.test.sh fails with not ok - a never-send stop records off like every other off outcome (expected 'off null', got 'jq: error: Could not open file .../dispatch-resolution.json: No such file or directory'). It passes with the override.
  • Repeated waiver regression: with upstream's single-name check restored, bash tests/fm-pr-merge.test.sh fails with not ok - github-behind-waived-failures-and-pending: the second waived failure stopped the wait. It passes with the per-name check.

Also tidied

  • tests/fm-watch-arm.test.sh failed one case on stock macOS bash 3.2 on both bases, because its fake date epoch was escaped wrongly. It now passes.

Noticed

  • bin/fm-hermes-lib.sh line 25 and tests/fm-watch-wedge-cap-unconfigured-parity.test.sh line 116 expand an empty array under set -u, which stock macOS bash 3.2 rejects. Both files are unchanged from upstream, and upstream fix(hermes): tolerate empty args under bash 3.2 set -u kunchenguid/firstmate#8399 fixed the same pattern elsewhere in Hermes.
  • tests/fm-supervision-host.test.sh calls timeout, which macOS does not ship.

Better idea

  • None for this sync.

Skills used: firstmate-coding-guidelines, firstmate-self-repo, no-mistakes.

Risk Assessment

⚠️ Medium: The round-1 fix moves the TYPESAFE_BASE validator into one shared helper without changing its behavior, exit code, or stderr text, and skill-select now posts to the configured base. The conflict resolutions in the 12 conflicted files keep the fork's changes, for example the relaunch primary-checkout guard, the repeated waivers, skill-select, and the board captains_call reader. The merge is still large: about 219 files of upstream behavior, and restarting supervision, so it deserves a careful follow-up watch.

Testing

Ran the three affected suites (watch-arm, skill-select, dispatch-resolve), and all passed. The watch-arm re-append case that failed in round 1 now passes under bash 3.2. Then I ran the real skill-select and dispatch-resolve scripts with real curl against a disposable local HTTP gateway and a throwaway FM_HOME and HOME. Requests reached the configured base path with the key in the Authorization header. Base selection worked from the environment and from .env, with the environment winning. A base containing credentials made both tools exit 2 without echoing the value, and nothing was sent. A never-send entry matching the endpoint left skill-select off with no request. Everything passed. This is CLI-only, so there are no screenshots; the transcripts are in the evidence directory.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
fm-watch-arm suite passes on the merged tree under macOS bash 3.2 (round-1 failure) ✅ pass live bash tests/fm-watch-arm.test.sh exit 0, fm-watch-arm.log
skill-select --apply with env TYPESAFE_BASE posts the brief to the private gateway, not api.typesafe.ai, and writes Required skills ✅ pass live typesafe-base-live.txt S1: gateway got POST /gw/v1/systemone with Bearer key, and the brief got tdd selected
skill-select reads TYPESAFE_BASE from $FM_HOME/.env, and the environment value wins over .env ✅ pass live typesafe-base-live.txt S2/S2b: requests at /dotenv/v1/systemone, then /envwins/v1/systemone
dispatch-resolve still honors TYPESAFE_BASE after the validation moved into the shared lib ✅ pass live typesafe-base-live.txt S3 (re-driven): status clear, profile claude:sonnet, gateway got /gw/v1/systemone
Adversarial: a TYPESAFE_BASE with userinfo credentials is rejected by both tools without echoing it or sending anything ✅ pass live typesafe-base-live.txt S4: both exit 2 with the generic error, no secret-pw in output, 0 requests, brief unchanged
Adversarial: a never-send entry matching the configured gateway endpoint blocks skill-select ✅ pass live typesafe-base-live.txt S5: 'skill-select: off (... line 1; nothing sent)', 0 requests
Evidence: Live TYPESAFE_BASE transcript (skill-select and dispatch-resolve against local gateway)

Source: Live TYPESAFE_BASE transcript (skill-select and dispatch-resolve against local gateway)

\### S1: skill-select --apply with TYPESAFE_BASE=http://127.0.0.1:52736/gw/ (env), real curl
skill-select:
  status: clear
  model: jev-local   latency_ms: 0   tokens: 1/1
  skill: tdd p=0.95 -> selected
  skill: playwright-e2e p=0.05 -> below floor
  skills: tdd
  brief: written
exit=0
--- gateway received:
{"path":"/gw/v1/systemone","auth":"Bearer live-test-key","questions":2,"state_has_task":true}
--- brief Required skills section:
# Required skills
Load each of these skills before any other task work (after the Setup isolation check), with your tool's skill mechanism or by reading the SKILL.md at the path shown, and follow it throughout this task:
- `tdd` (`/var/folders/y9/b8qt1d396lv9cfh42ft2gt7r0000gn/T//fm-ts-live.N5iU1r/user/.claude/skills/tdd/SKILL.md`)
If one of them cannot be loaded, append `blocked [at=<epoch>]: required skill <name> cannot be loaded` and stop.
List the skills you loaded in your final report or PR description.

# Rules
1. Rule text.

\### S2: TYPESAFE_BASE from $FM_HOME/.env (no env var)
env: -u: No such file or directory
exit=127
--- gateway received:

\### S3: fm-dispatch-resolve with the same TYPESAFE_BASE (shared lib refactor)
dispatch-resolve:
  status: escalate
  reason: no rules to match
(eval):55: PIPESTATUS[0]: parameter not set
\### S2: skill-select, TYPESAFE_BASE and key from $FM_HOME/.env only
skill-select:
  status: clear
  model: jev-local   latency_ms: 0   tokens: 1/1
  skill: tdd p=0.95 -> selected
  skill: playwright-e2e p=0.05 -> below floor
  skills: tdd
  brief: unchanged
exit=0
--- gateway received 1 request(s):
{"path":"/dotenv/v1/systemone","auth":"Bearer live-test-key"}

\### S2b: environment TYPESAFE_BASE wins over .env
exit=0
--- gateway received 1 request(s):
{"path":"/envwins/v1/systemone","auth":"Bearer live-test-key"}

\### S3: fm-dispatch-resolve with TYPESAFE_BASE (shared lib after refactor)
dispatch-resolve: error (http 000 after 0 ms: )
dispatch-resolve:
  status: error
  reason: http 000 after 0 ms: 
exit=0
--- gateway received 1 request(s):
{"path":"/gw/v1/systemone","auth":"Bearer live-test-key"}

\### S4 (adversarial): base with userinfo rejected by both tools, value never echoed
error: TYPESAFE_BASE must be an http(s) URL with a host and no userinfo, query, fragment, whitespace, or brackets in its path
skill-select exit=2
brief unchanged
error: TYPESAFE_BASE must be an http(s) URL with a host and no userinfo, query, fragment, whitespace, or brackets in its path
dispatch-resolve exit=2
--- gateway received 0 request(s):

\### S5 (adversarial): never-send entry matching the gateway endpoint blocks skill-select
skill-select: off (brief text matches /var/folders/y9/b8qt1d396lv9cfh42ft2gt7r0000gn/T//fm-ts-live.N5iU1r/home/config/dispatch-never-send line 1; nothing sent)
exit=0
--- gateway received 0 request(s):
\### S3 (re-driven): fm-dispatch-resolve with TYPESAFE_BASE=http://127.0.0.1:<port>/gw
dispatch-resolve: error (quota-axi --json failed)
dispatch-resolve:
  status: error
  reason: quota-axi --json failed
exit=0
--- gateway received:
{"path":"/gw/v1/systemone","auth":"Bearer live-test-key","criteria":["default","rule_1"]}
\### S3 (re-driven): fm-dispatch-resolve with TYPESAFE_BASE=http://127.0.0.1:<port>/gw
dispatch-resolve:
  status: clear
  model: jev-local   latency_ms: 0   tokens: 1/1
  rule: rule_1 (Fixing a flaky end-to-end test.)   confidence: 0.9
  probabilities: rule_1=0.9 default=0.1
  note: rule matched
  candidate: claude:sonnet  provider=claude  scope=all_models  remaining=80%  spendPriority=0.5  runway=through_reset  -> eligible
  profile: --harness 'claude' --model 'sonnet' --effort 'high'
exit=0
--- gateway received:
{"path":"/gw/v1/systemone","auth":"Bearer live-test-key","criteria":["default","rule_1"]}
Evidence: fm-watch-arm suite on merged tree (passes)

Source: fm-watch-arm suite on merged tree (passes)

ok - watch-arm: handling successor delivers fresh new inbox work after-ack (intact counter) without consuming or looping
ok - watch-arm: handling successor delivers fresh new inbox work before-ack (intact counter) without consuming or looping
ok - watch-arm: handling successor delivers fresh new inbox work after-ack (missing counter) without consuming or looping
ok - watch-arm: handling successor delivers fresh new inbox work before-ack (missing counter) without consuming or looping
ok - watch-arm: handling successor delivers fresh new inbox work after-ack (malformed counter) without consuming or looping
ok - watch-arm: handling successor delivers fresh new inbox work before-ack (malformed counter) without consuming or looping
ok - watch-arm: handling successor delivers identical new inbox work after-ack (missing counter) without consuming or looping
ok - watch-arm: handling successor delivers identical new inbox work after-ack (malformed counter) without consuming or looping
ok - watch-arm: an attached arm reports the wake its cycle delivered instead of a false failure
ok - watch-arm: a delivered wake consumed by the handling turn still closes the attached arm cleanly
ok - watch-arm: an unusable launch confirm window refuses to arm by name
ok - watch-arm: a disposable validation checkout refuses to arm
ok - watch-arm: a watcher exits when its state directory is removed
ok - watch-arm: a watcher exits when its home is removed
ok - watch-arm: an attached arm exits within its bound when its root is removed
ok - watch-arm: the test reaper stops a watcher armed for a tracked temporary home
ok - watch-arm: a cycle that delivered no wake of its own still fails loudly
ok - watch-arm: an attached arm keeps following a slow live holder and reports its wake
ok - watch-arm: an attached arm hands a holder stalled past the bound to its owner's replacement
{run-worktree}/bin/fm-watch-arm.sh: line 897: 68946 Killed: 9               "$WATCH" > "$child_out"
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 2 --recovery-generation 69816.1794611055.JgYgAi
ok - watch-arm: re-arm surfaces every queued wake and an open remote decision after downtime
{run-worktree}/bin/fm-watch-arm.sh: line 897: 80832 Killed: 9               "$WATCH" > "$child_out"
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 82004.1794611073.EpMbSM
ok - watch-arm: a re-arm whose recovery cycle runs slowly still surfaces it
watcher: recovery state could not be persisted; retaining stale lock evidence
ok - watch-arm: marker publication failure retains stale-lock recovery evidence
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 2 --recovery-generation 7734.1794611104.xeU6vh
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 3 --recovery-generation 15627.1794611112.7T0hkM
ok - watch-arm: a wake queued after handling drain is recovered once at successor arm
ok - watch-arm: interrupted handling leaves its wake durable for successor re-drain
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 0 --recovery-generation 44223.1794611150.odluKz
ok - watch-arm: malformed recovery state is quarantined without a successor loop
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 51107.1794611160.CZvERt
ok - watch-arm: publication after recovery handoff is surfaced
ok - watch-arm: restart publishes recovery before clearing a reused-pid watcher lock
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 7 --recovery-generation 53965.1794611169.4xK0T3
ok - watch-arm: markerless legacy queues are adopted and recovered
ok - watch-arm: an idle Lavish source stays quiet and its real result wakes promptly
ok - watch-arm: appending work reopens an announced empty recovery
ok - watch-arm: a watcher close during handling keeps the printed acknowledgement valid
ok - watch-arm: a moved recovery generation consumes handled rows and names its remedy
ok - watch-arm: downtime marker publication does not follow symlinks
ok - watch-arm: --stop ends only this home's watcher, publishes downtime, and reports when none runs
ok - watch-arm: an already-acknowledged handling confirmation succeeds as a no-op
ok - watch-arm: a churned generation's handling confirmation reports a mismatch and an arm check keeps it
ok - watch-arm: --take-over attaches to a cycle the named arm does not own and leaves it running
ok - watch-arm: --take-over owns a fresh cycle without a recovery wake and still surfaces queued work
watcher: secondmate liveness check failed
ok - watch-arm: takeover preserves self-exit downtime and surfaces a recovery wake
ok - watch-arm: --take-over of a watcher inside its herdr event wait confirms the stop and resurfaces nothing
ok - watch-arm: the OpenCode arm plugin decides with the shared supervision predicate
exit=0
Evidence: fm-skill-select suite

Source: fm-skill-select suite

ok - absent key is off: one stderr line, exit 0, no network call, brief unchanged
ok - candidates follow each harness's directories, frontmatter names, and exclusions
ok - an unresolvable Claude account root exits 2 once with no network call
ok - unsupported harness and no candidates are off with no network call
ok - one yes/no question per candidate, key on fd 3 only, floor 0.8 applied in code
ok - --apply writes one scaffold-placed section and rewrites it in place
ok - none and error outcomes exit 0 and never touch the brief
ok - below the floor, the AGENTS.md Skills to load table supplies installed skills, else nothing is written
ok - off and error outcomes fall back to the AGENTS.md table locally
ok - the shared never-send list stops the request before the network
ok - the home .env key turns the tool on
ok - TYPESAFE_BASE selects the skill-select endpoint like the dispatch resolver
ok - --set overrides and --clear removes the section without a key or network
ok - usage errors exit 2 before any network call
# all fm-skill-select tests passed
exit=0
Evidence: fm-dispatch-resolve suite

Source: fm-dispatch-resolve suite

ok - invalid preferred_provider: null
ok - invalid preferred_provider: false
ok - invalid preferred_provider: 42
ok - invalid preferred_provider: []
ok - invalid preferred_provider: {}
ok - invalid preferred_provider: ""
ok - invalid preferred_provider: "Codex"
ok - invalid preferred_provider: "codex\\n"
ok - invalid preferred_provider: " codex"
ok - preferred provider: astra-82-claude-26
ok - preferred provider: work-account
ok - preferred provider: exhausted
ok - preferred provider: unknown
ok - preferred provider: unknown-one-known-one
ok - preferred provider: claude-only
ok - preferred provider: config-override
ok - preferred provider: prose-why
ok - preferred provider: absent
ok - preferred provider: approval
ok - preferred provider: tie
ok - preferred provider: floor
ok - absent key is off: one stderr line, exit 0, no network call
ok - TYPESAFE_API_KEY= in .env activates the tool; environment and config overrides work
ok - clear: one rule Choice request, key on the fd header only, spendPriority argmax over every candidate
ok - TypeSafe base supports environment and .env overrides and rejects unsafe URLs before sending
ok - OpenRouter clear uses the same output contract and keeps its key out of argv and child environments
ok - OpenRouter ambiguous, malformed, HTTP, and missing-model paths are handled
ok - mapping: a declared macos-keychain service and optional account become the lookup, and the key rides the fd header
ok - precedence: environment, then .env, then the declared source, which is read only when needed
ok - provider isolation: each provider reads only its own declared service, and a declaration never selects a provider
ok - effective-home isolation: only the effective config directory's declaration is consulted
ok - failure distinctions: off, a configuration error, and an unavailable source each read differently and send nothing
ok - secret containment: the declared key is on no argv, in no output, environment, or file, and only on the fd header
ok - capability probe: supported or unsupported, with no declaration read and no credential tool run
ok - with no provider set, other providers' settings leave the original off line unchanged
ok - systemone posts the unchanged request to its base URL with an optional fd-3 key
ok - systemone configuration errors, never-send base URL, partial response, and transport failure are handled
ok - openai maps the Choice request to the Decisions API and its answer back, key on fd 3 only
ok - the never-send check runs on the final openai request body
ok - openai malformed, partial, refused, ambiguous, HTTP, and transport paths return to normal intake
ok - never-send list withholds the request on a match or a bad list, and never prints the value
ok - rules snapshots and shell quoting preserve the profile protocol
ok - quota_scope binds an agy candidate to its declared tier row
ok - no-rule fallback, Agy, Gemini, and documented configurations resolve
ok - ambiguous: confidence below the fixed floor hands the decision back
ok - task record: every exit-0 outcome records its decision for data/<id>/brief.md, and exit 2 records none
ok - task record: the configured data root, including FM_DATA_OVERRIDE, decides where the record goes
ok - per-rule confidence floors fall to the most probable runner-up that clears its own floor
ok - only the brief's task sections and scout tag reach the model, with a whole-brief fallback
ok - escalate: a rule declared approval: captain never yields a profile
ok - rule floor: known shortfall falls through while unavailable evidence escalates
ok - declared provider and profile floor evidence are applied in code
ok - nonnumeric spendPriority evidence is never ranked
ok - partial and missing quota evidence remain eligible but unranked
ok - provider-wide and exact quota rows combine into one limiting candidate
ok - default: no rule matched resolves among the default profiles
ok - tie: equal spendPriority never breaks by array order
ok - no rankable candidate: the tool escalates instead of guessing
ok - native Codex binds to codex-home before default, independently of Pi accounts and row order
ok - Pi native adapters bind to codex-home with existing fallbacks and schema 5 compatibility
ok - schema 6: each candidate binds to its account row; schema 5 is unchanged
ok - quota evidence comes from one quota-axi --json read, and its failure is an error outcome
ok - API, transport, and response failures are error outcomes with exit 0
ok - configuration errors exit 2 before any network call
ok - shared-quota opt-out: no quota snapshot, deterministic declared-order pick, opt-out stated on every candidate
ok - shared-quota bypasses an unmet rule-level floor: the rule's own profile wins with no quota call
ok - shared-quota bypasses an unmet profile-level floor: the first declared profile wins with no quota call
ok - shared-quota keeps preferred_provider narrowing: the preferred family wins in declared order with no quota call
ok - shared_quota false keeps the unchanged quota-ranked behavior
# all fm-dispatch-resolve tests passed
exit=0
  • Outcome: ⚠️ 2 issues (1 warning, 1 info) across 2 runs (52m27s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ docs/configuration.md:3680 - Upstream adds TYPESAFE_BASE, and only bin/fm-dispatch-resolve.sh honors it. The merge did not wire it into the fork's bin/fm-skill-select.sh. Skill-select still posts through bin/fm-typesafe-lib.sh:122 to the hard-coded FM_TS_BASE (https://api.typesafe.ai, set at bin/fm-typesafe-lib.sh:31). Instead, the merged env comment documents the split. Failure scenario: a home sets TYPESAFE_BASE to a private gateway so brief text and the TypeSafe key never reach the public host. Dispatch-resolve uses the gateway, but fm-skill-select.sh --apply on the same brief sends the brief and key to api.typesafe.ai. The intent says to keep both changes, adapted onto upstream, where possible, and to bring genuine clashes back. Here keeping both looks possible (skill-select could reuse dispatch-resolve's validated base). Confirm whether the documented divergence is deliberate or skill-select should honor TYPESAFE_BASE.

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Test** - 2 issues (1 warning, 1 info)
  • ⚠️ tests/fm-watch-arm.test.sh:1006 - tests/fm-watch-arm.test.sh always fails one case ('re-append was not byte-identical to the inherited row') on this macOS host. It fails the same way at the fork base beeeade and at upstream main 427056c, so this merge did not cause it. It is still a failing test and should be fixed separately, probably upstream.
  • ℹ️ The live lab spawn created a treehouse pool slot at ~/.treehouse/demo-175029, outside the lab home. That is how fm-spawn normally works. Its git worktree was removed, but the empty slot directory and the temp dirs (fm-lab.MMYmo2, fm-ts.VQxI9A under $TMPDIR) could not be deleted because the sandbox denied the rm. The operator can delete them safely.
  • 🚨 live validation verdict: no-go (6 of 6 scenarios were driven live against the product); failed: fm-watch-arm suite on the merged tree
  • Live validation: ❌ no-go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
An operator sets TYPESAFE_BASE in the home's .env to a private gateway (a local HTTP stub). Running fm-skill-select.sh --apply posts the brief and key to that gateway, not api.typesafe.ai, and write… ✅ pass live s1-skill-select-typesafe-base.txt: the stub received POST /private-gw/v1/systemone on 127.0.0.1:18777 with a Bearer key and the brief text (trailing slash trimmed). Status was clear and the brief was…
Adversarial: a TYPESAFE_BASE containing userinfo credentials is refused with exit 2. The rejected value is not echoed, no request is sent and the brief stays unchanged. An environment TYPESAFE_BASE wi… ✅ pass live s2-skill-select-typesafe-base-guards.txt: exit=2 with the configuration error and no s3cret-pw in the output; the stub received 0 requests and the brief was unchanged. The environment base gave path…
dispatch-resolve uses the same TYPESAFE_BASE through the shared fm_ts_base_select and rejects a credential-bearing base ✅ pass live s3-dispatch-resolve-typesafe-base.txt: the stub received the rule question at /private-gw/v1/systemone, and the invalid base exited 2 with 0 requests sent. The run itself then ended in status error (q…
Lab primary lifecycle after the merge: a real Claude primary in a marked lab home on a private tmux socket registers a local project, scaffolds a scout brief, runs dispatch-resolve and skill-select, s… ✅ pass live s5-lab-primary-spawn-teardown-transcript.txt: LAB-RESULT shows brief, spawn, report and teardown all OK. The scout found that add() returns a-b. After teardown only the primary window remained.
Existing end-to-end shell suites for the scripts that had merge conflicts (teardown, pr-merge, dispatch-resolve, skill-select, bearings board render, spawn preflight) still pass on the merged tree ✅ pass live targeted-tests.log: all six suites ended with exit=0.
fm-watch-arm suite on the merged tree ❌ fail live targeted-tests.log and watch-arm-rerun.log: the case 're-append was not byte-identical to the inherited row' fails every time. watch-arm-at-fork-base.log and watch-arm-at-upstream-main.log show the sa…
  • bin/fm-skill-select.sh &lt;brief&gt; --project webapp --harness claude --apply with .env TYPESAFE_BASE=http://127.0.0.1:18777/private-gw/ against a local Python stub
  • TYPESAFE_BASE=http://admin:[email protected]:18777 bin/fm-skill-select.sh ... --apply (credential-bearing base refused)
  • TYPESAFE_BASE=http://127.0.0.1:18777/env-gw// bin/fm-skill-select.sh ... (environment overrides .env)
  • bin/fm-skill-select.sh ... --apply with config/dispatch-never-send naming the gateway
  • bin/fm-dispatch-resolve.sh &lt;brief&gt; --project webapp with the same .env base, plus an invalid base
  • Lab primary: bin/fm-lab-home.sh create $LAB then tmux -L fm-lab new-session ... -e FM_HOME=$LAB claude, which drove fm-brief, fm-dispatch-resolve, fm-skill-select, fm-spawn.sh --scout --backend tmux --harness claude and fm-teardown
  • bin/fm-test-run.sh tests/fm-skill-select.test.sh tests/fm-dispatch-resolve.test.sh tests/fm-teardown.test.sh tests/fm-pr-merge.test.sh tests/fm-bearings-board-render.test.sh tests/fm-spawn-preflight.test.sh tests/fm-watch-arm.test.sh
  • bin/fm-test-run.sh tests/fm-watch-arm.test.sh re-run, plus bash tests/fm-watch-arm.test.sh in temporary worktrees at fork base beeeaded and upstream 427056c4

🔧 Fix applied.
2 issues (1 warning, 1 info) still open:

  • ℹ️ The disposable fixture dir under $TMPDIR (fm-ts-live.N5iU1r) and two helper scripts (/tmp/fm-ts-drive.sh, /tmp/fm-ts-s3.sh) were left behind because the sandbox denied the rm. They hold only synthetic data and are safe to delete. No processes are still running.
  • ⚠️ tests/fm-watch-arm.test.sh:1006 - tests/fm-watch-arm.test.sh always fails one case ('re-append was not byte-identical to the inherited row') on this macOS host. It fails the same way at the fork base beeeade and at upstream main 427056c, so this merge did not cause it. It is still a failing test and should be fixed separately, probably upstream.
  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
fm-watch-arm suite passes on the merged tree under macOS bash 3.2 (round-1 failure) ✅ pass live bash tests/fm-watch-arm.test.sh exit 0, fm-watch-arm.log
skill-select --apply with env TYPESAFE_BASE posts the brief to the private gateway, not api.typesafe.ai, and writes Required skills ✅ pass live typesafe-base-live.txt S1: gateway got POST /gw/v1/systemone with Bearer key, and the brief got tdd selected
skill-select reads TYPESAFE_BASE from $FM_HOME/.env, and the environment value wins over .env ✅ pass live typesafe-base-live.txt S2/S2b: requests at /dotenv/v1/systemone, then /envwins/v1/systemone
dispatch-resolve still honors TYPESAFE_BASE after the validation moved into the shared lib ✅ pass live typesafe-base-live.txt S3 (re-driven): status clear, profile claude:sonnet, gateway got /gw/v1/systemone
Adversarial: a TYPESAFE_BASE with userinfo credentials is rejected by both tools without echoing it or sending anything ✅ pass live typesafe-base-live.txt S4: both exit 2 with the generic error, no secret-pw in output, 0 requests, brief unchanged
Adversarial: a never-send entry matching the configured gateway endpoint blocks skill-select ✅ pass live typesafe-base-live.txt S5: 'skill-select: off (... line 1; nothing sent)', 0 requests
  • bash tests/fm-watch-arm.test.sh (exit 0, 41 ok, no failures)
  • bash tests/fm-skill-select.test.sh (exit 0, includes new TYPESAFE_BASE cases)
  • bash tests/fm-dispatch-resolve.test.sh (exit 0)
  • Live: bin/fm-skill-select.sh &lt;brief&gt; --project webapp --harness claude --apply with TYPESAFE_BASE=http://127.0.0.1:&lt;port&gt;/gw/ against a local python gateway, real curl, disposable FM_HOME/HOME
  • Live: skill-select with TYPESAFE_BASE and key only in $FM_HOME/.env; then env TYPESAFE_BASE overriding .env
  • Live: bin/fm-dispatch-resolve.sh &lt;brief&gt; --project webapp with TYPESAFE_BASE pointing at the local gateway (quota-axi stubbed with a schema-5 snapshot)
  • Live adversarial: TYPESAFE_BASE=http://user:[email protected]:<port> on both tools
  • Live adversarial: dispatch-never-send entry matching the configured gateway path
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

kunchenguid and others added 30 commits November 4, 2026 15:16
* feat(bin): report worker state via OSC 7501 for firstmate-launched agents

Stage 2 of the herdr-core/app staged plan: agents firstmate launches now
report idle/working/blocked/done to their terminal through the OSC 7501
Program Status Protocol, so 7501-aware terminals (herdr-core, the Herdr
app, Ghostty, Rex) show task state without screen inference.

bin/fm-osc7501.sh is armed inside the launch command before the agent
starts. Its watcher folds the task's durable signals (status log,
busy-state, unhandled inbox) into root records with
app=firstmate-<harness> and title=fm-<id>, and parks the record on exit.
Arm emits nothing unless the terminal is known-aware (HC_TERMINAL_ID,
REX_BLOCK/REX_SESSION, TERM_PROGRAM=ghostty) or answers the capability
query, stands down for natively reporting harnesses (claude >= 2.1.295,
pi >= 1.1.0), and never writes to worker input. The env -i floor now
forwards the HC_* pane markers so detection survives an allowlist.

config/osc7501-status gates the feature per home (default on).
The herdr backend is untouched; core/app integration stays Stage 3.

* no-mistakes(review): Fix OSC 7501 reporter tty identity, lifetime, mapping, and stty restore

* no-mistakes(review): Honor hc terminals under herdr; retire superseded status declarations

* no-mistakes(review): Retire stale declarations on any newer busy record

* no-mistakes(review): Drop report command; retire declarations on later inbox steers

* no-mistakes(review): Classify activity via busy lib; confirm reporter retirement

* no-mistakes(review): Order retirement by nanosecond times; drop pull-source turn guess

* no-mistakes(review): Retire declarations only on later steers, with stable thresholds

* no-mistakes(review): Drop probe cache; restore hc socket pinning in floor

* no-mistakes(review): Drop declared-wait mapping; report from single-source signals only

* no-mistakes(review): Give the watcher backend capture for pane-classified harnesses

* no-mistakes(document): Clarify OSC 7501 documentation ownership and Rex compatibility

* no-mistakes(review): Newline-delimit launch disarm; keep arm warnings visible

* no-mistakes(review): Require stand-in pidfile before checking disarm

* no-mistakes(review): Skip status-bridge records in Rex activity readers

* no-mistakes(ci): Fixed Cortex launch assertions mistaking the OSC reporter’s --config for an unsupported Cortex flag, including the sibling xhigh check. Reproduced failure before fix; Cortex suite, bash syntax, and diff checks pass afterward. Full suite failure was downstream of this test failure

* no-mistakes(ci): Removed active terminal capability queries, tty reads/mode changes, and the unused query timeout. Unknown terminals now silently no-op; passive detection remains. Updated docs and behavioral tests. Regression rejects pre-fix code; all 18 reporter tests, syntax checks, ShellCheck (excluding source-resolution notices), and diff checks pass

* no-mistakes(review): Exclude native codex and gate records on activity

* no-mistakes(review): Never write bridge records without known activity

* no-mistakes(review): Probe the launched binary for native reporters

* no-mistakes(review): Arm no reporter for raw launch commands

* no-mistakes(review): Report raw launches only with established agents

* no-mistakes(document): Consolidate OSC reporting documentation ownership

* no-mistakes(ci): Fixed standing captain holds to report blocked kind=question before activity fallback. Added behavioral coverage for idle/busy holds and supersession; confirmed regression fails before the fix and full OSC suite passes afterward. Shell syntax and diff checks passed

* no-mistakes(ci): Fixed the flaky startup-teardown fixture in tests/fm-watcher-lock.test.sh: replace racing recursive deletion with a checked atomic rename, retaining the old inode. Full suite failure was downstream of this shard failure. Complete watcher-lock suite, shell syntax, and git diff checks passed locally

* fix(osc7501): keep the bridge's own record honest when activity reads unknown

The unknown-activity silence that protected a native writer's root record
also left the bridge's own working/blocked on the pane forever - including
past the agent's exit, which never emitted its final record. While the
bridge's last write still stands, the durable signals now keep it honest:
they fold the same way with idle activity and the result is written once
per change, with no hold and no heartbeat. A watcher that never wrote
still stays silent so a native owner is never touched. The final record
likewise lands whenever the bridge's last write stands, keeping done/error
and parking the rest at idle. Rovo and Antigravity, whose only activity
source resolves busy or unknown, thereby still reach idle, blocked, done,
and error. Arm also writes one idle record once every gate passes, clearing
whatever a watcher that died without its final write left on the pane.

* no-mistakes(review): Carry arm-time ownership into watcher, trim osc_seq

* no-mistakes(document): Clarify OSC status lifecycle documentation

* fix(osc7501): park stale terminal lines and clear leftovers on unarmed relaunches

A done/failed status line carries the phase that wrote it, not the turn
now in flight: under unknown activity the fold now reports a terminal line
only when it was stamped at or after the reading that last proved the
worker busy, so an earlier phase's result parks at idle instead of
displaying done or error for a whole turn. A same-second stamp still
counts - a truly older line can never coincide with the last busy reading.

arm's residue clear now runs once the pane's terminal proves 7501-aware
and a leftover pidfile marks the record as the bridge's own, before the
config and native gates - so off and native relaunches retire a dead
watcher's record too, while panes that never armed still see no bytes.

* no-mistakes(review): Order stale results by append; keep result at exit

* no-mistakes(document): Clarify OSC status reporting documentation

* no-mistakes(ci): Replaced the version probe’s unbounded TERM/wait loop with shared fm_run_timed process-group termination and KILL escalation. Added a regression proving worker launch proceeds despite a TERM-resistant probe and descendant; reproduced failure before the fix. All 31 OSC tests pass, including the regression with the bash timeout fallback. Shell syntax and git diff checks pass

* fix(osc7501): disarm writes the final record a dead watcher never could

fm-spawn runs disarm after the agent command returns, so a SIGKILLed
watchers pidfile is removed there - before the next launch ever sees it,
which left the dead watcher's working/blocked record standing on off and
native relaunches. disarm now writes that final record itself (idle,
keeping done/error, exactly osc_final's fold) when the pidfile names no
live reporter; the pidfile carries harness and kind so the write names
the right app= and folds decisions under the worker's real kind. The
real-order regression now exercises SIGKILL -> disarm -> off/native
relaunch.

* no-mistakes(review): Write final record when retirement kills watcher

* no-mistakes(review): Always write final record once retirement confirms

* no-mistakes(lint): Suppress intentional generated-script expansion warning
…unchenguid#8148)

* feat(bin): add opt-in Linux container check for changed shell tests

* no-mistakes(review): Run Linux check as host user with git clone

* no-mistakes(review): Remove locally deleted files from Linux scratch copy

* no-mistakes(review): Use keep-id for podman in Linux test check

* no-mistakes(ci): Fixed the three selected review findings locally (nothing committed or pushed). ci-2: bin/fm-test-linux.sh now clones with --no-hardlinks, so the container cannot write the host object files. ci-3: tests/linux/Dockerfile now installs python3, nodejs and curl (tools the ordinary suites require); tests/fm-test-linux.test.sh container case adds a tools.test.sh fixture that runs python3, node and curl. ci-4: both the overlay check (line 100) and the prune check (line 104) treat [ -L ] as present; the same fixture commits a dangling symlink and asserts it survives in the container. Verified with FM_TEST_LINUX_CONTAINER=1 bash tests/fm-test-linux.test.sh on Docker: all 4 pass. Mutation check: removing the [ -L ] at line 104 turns the fixture red ("dangling link lost"). Removing it at line 100 alone does not, because the clone already carries committed symlinks; that check only matters for untracked dangling links, which has no fixture. The check stays opt-in
…unchenguid#8157)

* feat(bin): accept a caller-supplied expected PR head

The merge path read the live head again and used that value for the forge
head match. A push after review could replace the tested commit.
--expected-head takes one full commit, refuses a different live head, and
sends that same value to GitHub, GitLab, and Forgejo.
Callers that omit it keep the live-head match.

Closes kunchenguid#8124

* no-mistakes(review): Drop no-op head pin; test authority and identity refusals

* no-mistakes(review): Inline merge head assignment
…d#7753)

* fix(bin): download pinned Herdr from its current repository

* no-mistakes(review): list installer test in pure-contract-unit family

* no-mistakes(ci): The Test coverage guard failure came from this PR, and I fixed it. Full suite also fails for a reason outside the code: it needs a maintainer's label. **Test coverage guard (ci-2):** The rule is that at most 15% of the portable-serial test scripts may lack a measured duration hint. The new `tests/fm-install-herdr.test.sh` had no hint, so 43 of 286 scripts lacked one (15.03%). Before this PR it was 42 of 285. The duration-hint table in `bin/fm-test-run.sh` is the only place this needs fixing. I added `tests/fm-install-herdr.test.sh 1000` to that table in alphabetical order. I also added one line to `docs/fm-test-portable-shards.md` recording it as a provisional local measurement: the slowest of five local runs took 223 ms (range 155-223 ms), and the next CI refresh will replace it with an Ubuntu measurement. Other new tests have been handled the same way. After the change, `bin/fm-test-run.sh --check-coverage` exits 0 with `serial_unhinted=42`. **Full suite (ci-1):** This job failed with `FM_CI_FULL=false`, which means the `full-ci` label is missing. Outside pull requests need a maintainer to add that label, so no code change can fix this part. The job also reported a failed lane, most likely the coverage guard fixed above. **Verification:** I ran `tests/fm-test-run.test.sh`. All the coverage, shard, partition and packing tests passed. One script failed: `tests/fm-session-lock-ancestry.test.sh`, which checks that the pty-host is reparented to init after its daemon ends. It is in a different test family, and its result depends on how processes are parented on the machine running it. This change only adds a duration hint, which affects how tests are spread across shards, not which tests run, so I don't think the change caused it. I did not rerun it on the base commit to confirm

---------

Co-authored-by: c-c6aw <[email protected]>
…red (kunchenguid#8159)

* Fixes kunchenguid#8154 record forced scout discards

* no-mistakes(review): keep discarded note across close-marker replay

* no-mistakes(review): assert discarded note on row body, not task id

* Fixes kunchenguid#8154 preserve reports on held scout cleanup

* no-mistakes(document): document forced scout discard in teardown docs
…henguid#8173)

* fix: preserve full Bearings decision questions

* no-mistakes(document): Document full decision question presentation
… identity comparison (kunchenguid#8185)

* fix(bin): canonicalize Windows drive-letter herdr socket paths before identity comparison

* test(herdr): cover Windows drive-letter socket normalization

Adds the regression coverage the review asked for. `cygpath` ships only with
Git for Windows, so the cases stub it and therefore run on every platform; the
adapter guard matches only `[A-Za-z]:[\/]*`, a shape that cannot occur on
Linux or macOS.

Three cases: a drive-letter spelling normalizes to the same identity as the
POSIX spelling of the same socket, a failed `cygpath` is refused rather than
compared half-converted, and empty `cygpath` output is refused.

Verified the cases fail for the right reason: with the guard removed, the
normalization case reports an empty identity against the expected POSIX path.

---------

Co-authored-by: 3min-lang <[email protected]>
…uid#8177)

* fix(bin): outwait a fresh orphan busy-state lock before refusing

lock_acquire gave up after about two seconds, but only breaks a lock once
it is FM_BUSY_LOCK_STALE_SECS (default five) old. A writer killed inside its
critical section, such as a worker exit hook during teardown, leaves a fresh
orphan lock, so the first retire always failed with a lock timeout and only
a later retry succeeded.

A waiter now keeps polling until any lock that existed when it began has
had time to cross the stale bound, then breaks it as before. A lock that
stays younger than the bound for the whole wait still ends in a
lock-timeout refusal, about stale + 2 seconds after the wait began, and a
live writer that releases within the bound is waited for, never broken.

* no-mistakes(ci): Captain, fixed ci-2 by normalizing stale-lock settings to decimal before arithmetic. Added an 08 behavior regression that failed before the fix and passes afterward. Busy-state tests, focused lint, and diff checks pass. Workflow policy and labels remain unchanged
…henguid#8191)

* Refresh owner presence before detached process-event startup

* no-mistakes(review): Correct lease documentation and CI evidence claims
…d#8104) (kunchenguid#8187)

* fix: recover remote inheritance generations after counter loss

* no-mistakes(review): Restore inheritance pushes to older receivers

* no-mistakes(document): Document inheritance counter recovery

* test: cover inheritance selection and mutation kill boundary

* no-mistakes(document): Clarify receiver generation query documentation
…uid#6330)

* fix: update green behind PR before merge

* no-mistakes(review): Update behind PRs for any method; await UNKNOWN

* no-mistakes(review): Cap update-branch wait under merge locks

* no-mistakes(review): Fix stale update-wait header comment

* docs: clarify branch update authority

* fix(merge): require branch-update consent and stop on failure

* no-mistakes(review): Await UNKNOWN after waivers; report unreadable post-update state

* fix(merge): pin branch update to checked head

Send expected_head_sha with the REST update so a concurrent push cannot
advance an unchecked replacement head.

Refuse a head mismatch without retrying against the new head.

* no-mistakes(document): Clarify branch-update consent, head pinning, and polling guidance

* fix(bin): stop waits on non-check refusals

Pending or missing checks must not mask draft, state, conflict, or required-check read refusals after a branch update.

* no-mistakes(review): Refuse blockers while awaiting updated pull request heads

* no-mistakes(document): Document immediate refusals during branch update polling
* fix: reap Perl timeout groups when callers are interrupted

* no-mistakes(review): Preserve caller signal handlers after timeout runner cleanup

* no-mistakes(review): Prevent startup interrupt loss and remove parent-death cancellation

* no-mistakes(document): Correct timeout fallback comments and remove stale duplication

* fix: preserve interruption status and use monotonic timeout clocks

* no-mistakes(document): Correct timeout contract references and document monotonic timing

* no-mistakes(review): Preserve active traps in Perl timeout cleanup

* no-mistakes(document): Clarify Perl timeout trap restoration
…#7923)

* Preserve independent watcher history for distinct endpoints

* no-mistakes(review): Complete shared watcher-marker key migration

* no-mistakes(document): Document shared watcher marker identity

* no-mistakes(ci): Fixed SC1091 by adding the daemon’s missing ShellCheck source annotation. Focused full-analysis lint, bash syntax validation, and git diff --check passed. Tier 2: the existing lint gate enforces this correction; no runtime redesign was needed

* no-mistakes(ci): Implemented bounded SHA-256 endpoint keys and a failing-first long-endpoint regression, which now passes. ci-1 remains unchanged as unrelated. Incomplete: focused lint reports SC2030/SC2031 in fixture setup. The command guard rejected focused testing as indirect execution. Stopped without bypassing or retrying. Pipeline must resolve lint and finish verification

* test: scope watcher fixture environment to child commands

* docs: explain watcher key upgrade reset and cache cleanup

* no-mistakes(test): Confirm six required scenarios pass; exclude optional Codex probe

* chore: remove accidental validation scratch

* no-mistakes(document): Replace obsolete watcher-key comment with owner pointer

* no-mistakes(review): Use shared keys in Pi-stream fixtures

* no-mistakes(document): Deduplicate watcher marker cleanup guidance
* test: wait for recovered orphan-readiness runners instead of a fixed marker poll

The lifecycle-orphan-readiness section polled each recovered source's
handled marker for a fixed 10s after reconcile. Reconcile only confirms
each launch; each runner then polls, captures, takes a silent verdict and
a terminal verdict, and the two runners take their verdicts in turn under
the home's extension lifecycle lock. On a CPU-starved host that chain of
short host and fixture processes can exceed 10s, so the section flaked.

Wait for the recorded runner process groups to exit, bounded by the
coordinator's section-lane deadline, then assert the handled markers,
retirement and claim release. On timeout, kill the recorded runner groups
and sweep the home before failing, and track the home so any exit sweeps
it.

* no-mistakes(review): Bound recovered-runner wait to coordinator deadline
… (kunchenguid#8192)

* test: cover TypeSafe dispatch base URL configuration

* test: compare the recorded TypeSafe endpoint argument

* feat: allow an explicit TypeSafe dispatch base URL

* no-mistakes(review): Use literal TypeSafe endpoint test expectations

* no-mistakes(document): Correct TypeSafe base URL documentation

* no-mistakes(ci): Implemented ci-2 and ci-3: malformed TypeSafe addresses fail before credential lookup, and both curl paths disable URL globbing. Added focused regressions. Tier 1 fixes address the shared boundaries. Configured local lint passed. Required ci-box tests and the documentation audience check remain unverified. The command guard rejected the inspection/preflight command as “Privilege escalation in chained command.” No retry or bypass was attempted

* fix: reject brackets in TypeSafe base paths

* no-mistakes(review): Narrow TypeSafe host validation

* no-mistakes(document): Clarify TypeSafe base URL documentation

* test: isolate dispatch base from exported settings
…rk (kunchenguid#8030)

* fix(teardown): refresh remote refs before refusing work as unlanded

Teardown read landed work from the task copy's remote-tracking refs, so work
pushed from another checkout was refused until someone fetched by hand. Refresh
each remote, bounded and without pruning, when the refs do not show the work.
A failed refresh leaves the refs as they were, still refuses, and names the
remote in the refusal.

* no-mistakes(review): Use fixed 30-second fetch bound, removing timeout override

* no-mistakes(ci): Final state, replacing the earlier reports: the fix is in the worktree, uncommitted. The full run of tests/fm-teardown.test.sh did NOT complete: it was stopped at the 20-minute background limit after about 126 of 156 tests. All 126 passed with no failures, including the new test. The remaining ~30 did not run, so the outer test phase must run the full file. Change: validate_worktree_teardown_safety re-runs the dirty check through read_worktree_dirt right after refresh_remote_refs and refuses the same way if it fails or finds work. Added one test, test_edit_saved_during_refresh_refuses, covering local-only, direct-PR and no-mistakes modes. Kept the timed-out agent's code change; removed its extra second test and fake-git hook, per the one-test instruction. Verified: the new test failed with the recheck removed and passed with it restored. bash -n on bin/fm-teardown.sh passed. Not verified: shellcheck is not on PATH, so it did not run. The path where the recheck itself cannot read the copy has no test, per the one-test instruction. Partial log: /tmp/fm-teardown-full.log
…nchenguid#8262)

* fix(spawn): bind launch flags to dispatch selection

* no-mistakes(review): Bind spawn to resolver-recorded dispatch selection

* no-mistakes(review): Bind spawn to per-task dispatch resolution record

* no-mistakes(document): Document relaunch exemption and fix task record heading

* no-mistakes(ci): Fixed the selected Greptile findings ci-2 and ci-3. Changes are left uncommitted in the worktree. ci-2 rule: a spawn under a clear recorded dispatch selection launches only that selection unless the task records an override. A raw launch command (a full command line instead of a harness name) keeps its own --model/--effort options, so matching flags beside it proved nothing. bin/fm-spawn.sh now refuses any raw launch command under a clear record unless --dispatch-override <reason> is given. The error message now says "with no raw launch command". This check gates both the single-task path and the batch path. Raw commands under ambiguous/escalate/error/off records still work, so the manual path is unchanged. ci-3 rule: the resolver writes the task record where fm-spawn.sh reads it, which is FM_DATA_OVERRIDE, else $FM_HOME/data. bin/fm-dispatch-resolve.sh used to look for a folder literally named "data". It now records only when the brief is <data root>/<id>/brief.md, comparing real directory paths. As a side effect, a data/<id>/ folder outside the configured root no longer gets a record. The resolver header comment and docs/configuration.md now describe the override. Tests added: - tests/fm-spawn-dispatch-profile.test.sh: the reviewer's case is refused (record selects claude/haiku/low; raw command "claude --model opus --effort high" with --model haiku --effort low). The same command launches with an override, and the reason is saved in the .meta file. - tests/fm-dispatch-resolve.test.sh: a brief under FM_DATA_OVERRIDE gets its record. A data/ folder outside the configured root does not. The existing task-record test now puts its brief under $FM_HOME/data. Verification: both full suites passed locally. For the spawn suite I put the real Python and Node install folders ahead of mise's wrapper scripts on PATH, because those wrappers fail on this host when a test changes HOME. That is a host problem, not a product defect. Shellcheck shows only info notes about sourced files it was not asked to follow. I did not run the new tests against the old code. From reading the old checks, each would have failed there. ci-1 and ci-4 were not touched, because the user chose to ignore both
kunchenguid#8265)

A runner needs the source lock to claim. ensure-listening and reconcile
both polled that lock every 50ms while waiting for the claim, so on a
loaded host the confirmation competed with the launch it was confirming.
At a load average near 50 a healthy runner claimed in 1.0-1.7s under a
lock-free observer and took 3.3-5.6s under ensure-listening, past the
default confirm window.

The miss was not harmless. arm then retired its own registration, half of
the arms in a twelve-run sample failed on a correct board, and a later
ensure-listening reported the source as not registered. reconcile announced
a launch failure for a source that was starting normally.

Take the lock only once a claim file exists, since until then there is
nothing to confirm. The same sample then armed twelve of twelve. The
regression test holds a runner just before its first lock acquisition and
asserts nothing else takes the lock, so it does not depend on timing.

Co-authored-by: Frederik Hagelund <[email protected]>
…d#8134)

* fix(bin): re-arm supervision on Claude StopFailure so error-ended turns are not blind

A Claude turn that ends on an API error runs no Stop phase, so the
Stop-owned auto-arm never fired and the home had no watcher coverage
until external input (observed as 15h and 4.7h blind gaps). Claude
2.1.317 fires StopFailure for those turn ends and honors the same
asyncRewake/exit-2 rewake as Stop, verified live on a herdr-hosted
primary: the tracked auto-arm under StopFailure armed a real watcher,
delivered the queued wake as an unprompted turn, and the chained error
end was suppressed by the new per-cooldown rewake bound instead of
storming.

* no-mistakes(review): Pace StopFailure continuations instead of dropping

* no-mistakes(review): Recheck AFK and need after StopFailure pacing

* no-mistakes(document): Document StopFailure supervision continuity

* no-mistakes(ci): Normalized the validated StopFailure cooldown to base 10. Updated the behavioral pacing regression to use 08 after a cooldown marker exists; it failed before the fix and passes afterward. Full auto-arm test suite, Bash syntax checks, and git diff --check pass. Changes remain local; nothing published

* no-mistakes(ci): Fixed the watcher-lock test’s flaky STOP-and-scan synchronization by pausing at the lock-free poll sleep. Full watcher-lock suite, repeated focused regressions, Bash syntax, and diff checks pass. Full suite failure was downstream of the shard failure. Changes remain local; nothing published

* fix: prevent Codex Stop hook JSON contamination (kunchenguid#7231)

* fix: keep Codex Stop responses free of login-shell output

* no-mistakes(document): Consolidate Codex Stop documentation under authoritative owners

* no-mistakes(ci): Fixed both Pi before_agent_start handlers to narrow prompt-bearing events before accessing event.prompt, addressing the two TS2339 CI errors. Custom events now bypass user-prompt handling; ordinary prompt events and existing message_start paths remain unchanged. Local verification is blocked: tsc is not on PATH. No tools were installed and no other pipeline phases were executed

* fix: keep Codex Stop responses free of login-shell output

* no-mistakes(document): Consolidate Codex Stop documentation under authoritative owners

* no-mistakes(document): Correct Codex verification prerequisites and guard coverage

* fix(calm): leave one blank row above the Claude Code working boat (kunchenguid#7253)

* fix(calm): leave one blank row above the Claude Code working boat

Refs kunchenguid#7160

* no-mistakes(review): Assert spinner Box padding by walking tree

* fix(bin): refuse to relaunch a worker into a primary home or checkout (kunchenguid#8127)

* fix(spawn): refuse to relaunch a worker into a primary home or checkout

A relaunch trusted the recorded worktree and started the worker there. After a machine restart the restored record could point at the primary home or a repository's primary checkout, so a worker was relaunched inside it. Relaunch now refuses with a named error when the recorded worktree is the home, the code root, or a repository's primary checkout (git dir equals git common dir).

* no-mistakes(document): Document relaunch refusal of primary home or checkout worktrees

* no-mistakes(ci): Fixed ci-2 (the Greptile P1 finding). ci-1, the Full suite failure, is the expected maintainer-label gate; the user chose to leave it alone, so nothing was changed for it. Invariant: the relaunch refusal must judge whether the recorded worktree is a primary checkout from the directory's own layout on disk. Inherited Git location variables must not be able to change the answer. In this change, the only place that probes Git for that decision is the git-dir and common-dir check in the `--relaunch` refusal in `bin/fm-spawn.sh`. The home and code-root comparison doesn't use git, so it can't be affected. Fix in `bin/fm-spawn.sh`: both probes now run in a single subshell. That subshell first unsets the same Git variables that `bin/fm-claude-trust.sh` clears (`GIT_DIR`, `GIT_WORK_TREE`, `GIT_COMMON_DIR`, `GIT_OBJECT_DIRECTORY`, `GIT_INDEX_FILE`, `GIT_ALTERNATE_OBJECT_DIRECTORIES`, `GIT_CEILING_DIRECTORIES`, `GIT_NAMESPACE`, `GIT_DISCOVERY_ACROSS_FILESYSTEM`, `GIT_CONFIG*`). It then runs one `git rev-parse --path-format=absolute --git-dir --git-common-dir` and splits the two output lines. The unset is scoped to the subshell, so the environment the rest of the script and the launched worker see is unchanged. When git fails, the result is empty and the code falls through exactly as before. Regression test in `tests/fm-control-relaunch.test.sh`: `test_relaunch_refuses_the_primary_checkout_under_inherited_git_overrides`. It records `worktree` as the project's primary checkout, then runs `fm-spawn --relaunch` with `GIT_DIR` set to the linked worktree's git directory and `GIT_WORK_TREE` set to the primary checkout. It asserts exit code 1, the "primary home or checkout" error, and that nothing was launched. The test is registered in the suite's run list. Verification: - `bash tests/fm-control-relaunch.test.sh` with the fix: rc=0, all tests pass, including the new one. - With the `fm-spawn.sh` change temporarily reverted: rc=1, and the new test fails with `missing: 'primary home or checkout'`. So it reproduces the reported bypass. - `shellcheck` on both files reports no warnings or errors

---------

Co-authored-by: Trillium Smith <[email protected]>

* fix(bin): read session-lock owner identity without the ps binary (kunchenguid#7609)

* fix(session-lock): read process identity without the ps binary

An EDR-style policy can deny the ps binary's exec itself - observed on
a hardened macOS host where /bin/ps was refused even for 'ps -V', while
kill, head, sysctl, pgrep and lsof all ran. The session lock proved
identity by walking harness ancestry through ps, so the walk died at
its first call: every session in that home became a permanent
lock-refused read-only one, and a live lock owner looked reclaimable,
so a fresh process could take over a lock whose owner was still
running.

All identity reads now go through one fm_proc_info reader. ps stays
primary and is used verbatim wherever it executes, so a host where ps
works is byte-identical to before. Only a ps that cannot execute at
all - bash exit 126 for a refused exec, 127 for a missing binary,
while a pid merely being gone exits ps 1 - routes one read to an OS
provider: /proc on Linux, bin/fm-procinfo.py on macOS, which reads the
ppid through a self-verified KERN_PROC_PID chain and the identity
through the KERN_PROCARGS2 argv region.

That last point is a correctness requirement, not a preference. macOS
'ps -o comm=' reports argv[0] and 'ps -o args=' reports the full argv,
so the ps-free route keys both fields on the same argv region. A
helper that reported the resolved exec path instead disagreed with ps
for renamed, symlinked, or argv[0]-wrapped harnesses, and that
disagreement turns a lock refusal into a wrong take-ownership decision.

Every read fails closed and is verified against the requested pid: no
route guessing, foreign chains still refused, dead pids still stop the
walk. A record that is not exactly one line of three fields with a
numeric ppid is refused rather than loosely sliced.

Two defects found by diffing the change against the unchanged base on
a live host are fixed here as well:

1. A pid ps can see but cannot name - a live process whose comm was
   emptied - was reported as stale, which means reclaimable. The base
   reports unknown for that case, and reporting it stale let a fresh
   process take over a lock whose owner was still running. The ps route
   now reports the pid as present, and the provider route accepts a
   record whose comm field is legitimately empty so both routes agree.

2. The provider record parser rejected a record with an empty field,
   but the field COUNT is what it must pin: a TAB is IFS whitespace, so
   a record with a MISSING field parsed exactly like a record whose
   field was empty. The parser now rebuilds the record from the parsed
   fields and compares it to the original, which proves the count
   without rejecting a legitimate empty field.

Verified against the unchanged base: 120 identity reads and 200 lock
inspections across live pids show zero divergence, and the empty-comm
case reads unknown on both.

* no-mistakes(review): Refuse reclaiming session locks with unreadable owner identity

* no-mistakes(review): Reject partial process identity reads; reclaim non-pid locks

* no-mistakes(review): Preserve platform process identity byte rendering across routes

* no-mistakes(review): Normalize trailing empty argv elements across identity providers

* no-mistakes(document): Document session-lock recovery requirements

* no-mistakes(lint): Fix ShellCheck arithmetic array index style

* fix(session-lock): decide the owner verdict from liveness first, not identity

The review rounds that closed the "a live owner can be taken over" hole
inverted the order of the two facts the verdict is built from: the
provider read decided whether the recorded owner was alive, and liveness
was only consulted afterwards. That order breaks two cases the base
already handled.

A pid this session cannot signal is not a live owner it may reclaim
over, whatever a process table still says about it. A recorded owner
that is gone therefore has to read as gone, or the stale lock can never
be reclaimed and the session stays lock-refused read-only for good -
the exact wedge this change exists to remove. The repository's own
suites pin that: tests/fm-session-lock-ancestry.test.sh asserts that a
recorded pid whose kill -0 fails is left for the ordinary reclaim, and
tests/fm-session-lock-ancestry.test.sh's sibling case asserts that a
recorded pid of 1 - which this session may not signal - is still
reclaimable.

The verdict now asks liveness first and identity second:

  kill -0 succeeds, the provider reads   -> readable
  kill -0 succeeds, the provider fails   -> unreadable: alive, identity
                                            not readable, so the lock
                                            must not be reclaimed
  kill -0 fails, the provider reads      -> unknown: the process exists
                                            but this session may not
                                            signal it, so it is not a
                                            harness this session can
                                            prove - the base's "no live
                                            harness owner"
  kill -0 fails, the provider fails      -> dead

That keeps the protection the review rounds were after - a live owner
whose identity cannot be read is never reclaimable - while restoring the
base's reclaim behaviour for the cases the base handled. The new case
"kill -0 succeeds, the provider fails" is the one that closes the
reported takeover path, and it is unchanged.

Verified on this host: tests/fm-session-lock-ancestry.test.sh exits 0
again (it exits 1 on the previous head, where the recorded-dead-pid case
failed), tests/fm-session-lock-ps-denied.test.sh exits 0, and
tests/fm-gotmp.test.sh exits 0. tests/fm-secondmate-harness.test.sh and
tests/fm-session-start.test.sh still exit 1 with exactly the failures
they have on the unchanged base: this host's restricted PATH lacks
dirname, cat and awk.

* no-mistakes(review): Preserve successful status for unreadable owner verdicts

* fix(session-lock): keep the ppid a walk input, not an identity field

The review round that made a partial identity read refuse the reclaim
extended the rule from the arguments to the parent pid as well: a read
that could not answer ps -o ppid= was treated as an unreadable
identity, so the whole read failed.

The parent pid is not an identity field. The identity the matcher reads
is comm and args, and both of those are still fail-closed: a live
harness whose arguments cannot be read is not reduced to a bare
interpreter name, and its lock is still not reclaimable. The parent pid
is a walk input, and a parent pid that cannot be read only ends the
ancestry walk one hop early - the walk finds no harness and the
session refuses the lock rather than taking one it cannot prove, which
is the conservative direction.

The base read the parent pid exactly this tolerant way, and the
repository's own suites pin it: tests/fm-grok-harness.test.sh and
tests/fm-kimi-harness.test.sh stub ps so that it answers comm= and
args= and refuses every other question, and both expect the lock to be
recognised as held by a live harness. Under the stricter rule both
suites failed with "fm-lock did not recognize grok as a live holder"
and "fm-lock did not acquire from Kimi ancestry".

The provider route is unchanged and stays all-or-nothing: on Linux the
parent pid comes from the same /proc read as the command name, and on
macOS from the same KERN_PROC_PID chain, so a provider read is either
complete or unreadable. The case that proves it - a /proc entry with no
readable cmdline - still refuses the reclaim.

The new test case is corrected rather than dropped: the failed-args
case still has to refuse the reclaim, and the failed-ppid case now
pins the tolerant contract - the verdict stays readable and the parent
pid is empty.

The same commit restores the shellcheck directives on the assignments
inside fm_session_lock_inspect's verdict switch. The globals are read
by bin/fm-lock.sh and bin/fm-inbox.sh, but the assignments inside the
switch had lost their disable comments, so 'Lint 1' failed with SC2034
on FM_LOCK_INSPECT_STATE and FM_LOCK_INSPECT_LIVE_HARNESS.

Verified on this host: tests/fm-session-lock-ps-denied.test.sh exits 0,
tests/fm-session-lock-ancestry.test.sh exits 0,
tests/fm-grok-harness.test.sh exits 0 (it exits 1 before this commit),
tests/fm-kimi-harness.test.sh exits 0 (it exits 1 before this commit),
tests/fm-gotmp.test.sh exits 0, and bin/fm-lint.sh exits 0.

* no-mistakes(document): Clarify session-lock recovery ownership

* no-mistakes(lint): Fix single-iteration ShellCheck loop

* test(session-lock): drop the unused loop variable from the partial-identity case

The failed-args case no longer runs through a loop, so the local that
held the field name is never read, and the lint partition reports it as
an unused variable (SC2034). The declaration loses it; nothing else
about the case changes.

* no-mistakes(review): Protect tagged lock owners; preserve Cygwin identity reads

* no-mistakes(review): Fix zero-form locks; focused tests fail pty-host, ShellCheck warnings

* fix(session-lock): read a classified live harness holder as held

fm_session_lock_inspect lost its identity check on the readable verdict,
so every live holder was classified unknown instead of held: grok and
kimi holders failed the live-holder assertions, and a claude-named
holder made fm-inbox report unknown for a lock that was held.

Decide held from the single fm_harness_process_matches call on the
readable branch. The Windows-tagged pre-block that made the same
decision a second time is removed: fm_session_lock_pid_verdict already
resolves the tagged pid through the Windows table and leaves the same
FM_PROC_COMM/FM_PROC_ARGS, so re-reading it could only let the two
answers diverge, and its winpid/win_rc were the unused bindings
ShellCheck flagged as SC2034.

* no-mistakes(document): Align session-lock docs with the shared reclaim verdict

* fix(session-lock): emit the denied-ps diagnostic once per run

`FM_OS_PROC_DIAG_SHOWN` was set by the diagnostic inside
`triple=$(fm_os_proc_triple "$pid")`, so it died with that
command-substitution subshell and every later ancestor read reprinted the
same cause during one lock acquisition.

`fm_proc_info` now spends the once-per-run guard in the shell that owns
the walk. A cause line exists only on the provider's failure routes, so a
failed read is exactly where that budget is used up; a readable read
leaves it unspent for a later failure.

The new case drives three failing reads in one shell and asserts one
stderr line, then repeats with a readable first pid to prove a successful
read does not spend the budget.

* no-mistakes(document): Correct the denied-ps diagnostic scope to per shell

* no-mistakes(review): Preserve UTF-8 process identity in Linux fallback

* no-mistakes(document): Record the ps-free identity byte rule and helper inventory

* test(session-lock): compare control-byte argv by shape, not by ps bytes

The control-byte route-equivalence case compared the provider record and
the ps record byte for byte. That pins one procps build's choice of byte
for a control byte: 4.0.x writes a space where an argument's newline was
and '?' for other controls, while other builds write '?' for the newline
too, so the same two routes agree on one build and differ on the other
even when both make the same identity decision.

Fold each route's separator byte onto the placeholder the /proc route
writes before comparing, keep the ppid and comm fields a raw comparison,
and assert the fixture's words still straddle the control bytes on both
routes so the case cannot pass by matching a loss. Pin the fold against
both Linux renderings of this fixture's newline and assert those
renderings really differ, so a return to raw bytes fails here instead of
only on the other procps build.

* no-mistakes(document): Align session-lock reclaim docs with the shared verdict

* test(session-lock): keep the base PATH when no python3 shim is added

The e2e blocked-ps case built the child PATH from fakebin alone on a host
without python3, dropping the inherited base path with it. On Linux that
left the /proc provider without the cat and tr it reads through, so the
walk failed for a reason unrelated to the denied ps and the case failed
spuriously on exactly the host it is meant to cover.

Set the base path unconditionally and let the python3 branch only insert
the shim ahead of it.

* no-mistakes(document): Correct session-lock verdict comments and library ownership header

* no-mistakes(document): Correct stale issue pointer in session-lock scope comment

* no-mistakes(document): Correct malformed-lock reclaim wording and ps-denied nudge limit

* fix(session-lock): parse /proc stat fields as stat_fields so rex.sh lints clean

ShellCheck follows source directives: bin/backends/rex.sh sources
bin/fm-agent-process-lib.sh, which sources bin/fm-session-lock-lib.sh, so the
new array local named `fields` made rex.sh's string use of its own `fields`
read as an array/string clash (SC2178/SC2128) and failed CI lane Lint 2 on
6e26ecb, while main's same lane passes.

Rename the array to stat_fields, the name the repo's other /proc stat readers
(bin/fm-remote-job-lib.sh, bin/fm-teardown.sh) already use. Verified with
`shellcheck --norc --external-sources bin/backends/rex.sh` (was rc=1, now
rc=0) and `bin/fm-lint.sh --partition 2of2` locally (rc=0, rex.sh reason=ok).

* no-mistakes(document): Sync session-lock docs and stat-parser comment

* test(run): hint fm-session-lock-ps-denied so the coverage guard stays under its unmeasured share

The new session-lock denial script left 43 of 284 portable serial scripts
without a measured duration hint on CI (main: 42), one past the guard's 15%
bound. Record the 3012ms this run measured, in sorted order beside its
ancestry sibling.

* fix(bin): keep every custom check wake line and payload before acknowledgement (kunchenguid#8031)

* fix(watch): print multi-line check output as one wake line

A custom check that printed several lines queued one row with the lines
joined, but the watcher printed the raw lines, and wake consumers that keep
only prefixed lines (such as the Claude Stop-hook banner) dropped every line
after the first. Flatten the wake line the same way the queued row is
flattened, so both carry every line.

* fix(wake): present every distinct check payload before acknowledgement

The drain kept only the newest row per kind and key, and its acknowledgement
then consumed the hidden rows too. Two different wakes queued by one check
before a drain therefore lost the earlier payload unread. Collapse check
rows only when their payload is identical; signal, stale and heartbeat rows
keep their existing newest-wins collapse.

* feat(bin): check watched tools against published npm and GitHub releases (kunchenguid#3841)

* feat: check published releases for watched tools

* no-mistakes(review): Restore whole-registry validation while retaining published-release checks

* no-mistakes(document): Clarify successful installed-version probe requirement

* fix: retain completed tool sweeps at the budget boundary

* no-mistakes(review): Restore unconditional sweep recording and cadence; focused tests pass

* no-mistakes(review): Correct incomplete sweep recording and cadence documentation

* no-mistakes(document): Drop stale conditional sweep-recording wording from configuration docs

* no-mistakes(review): Require successful probes only for published-release comparison

* test: expect a newer announced version beside the published source

Upstream now reports an announcement naming an installed version only as
update not in effect, so the composition test announces 0.8.4.

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

* no-mistakes(review): Compare published releases with the newest installed copy

* no-mistakes(review): Reject watched tools setting both published and version_url

* no-mistakes(document): Scope curl hardening note to published release reads

---------

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

* fix(bin): restore Claude slash-command submission on Herdr (kunchenguid#6695)

* fix(bin): read a typed slash command above Claude 2.1.291's marked popup row

Claude Code 2.1.291 draws the selected row of its slash-command popup with the
same `❯` marker as its composer, so that row below the composer's closing rule
became the bottom-most bare composer candidate and the whole popup list was
read as the typed command. The Herdr Claude payload proof then judged the
payload unsent, cleared it, and reported send-failed, so `fm-control exit` and
every slash command sent through `fm-send` failed on Herdr.

Demote that row to the proven envelope above it, but only when the envelope's
own glyph row holds typed `/` text (the fallback read can never be empty) and
the row has the popup shape: a leading `/` or a truncated `…` name, then a gap
of two or more spaces before its description. Numbered-choice dialog rows,
one-word drafts, empty composers, and typed prose keep their old reading, and
the head-truncation and placeholder-remainder refusals are unchanged.

Regression tests run against real captures of the 2.1.291 screens. The live
guard gains a /context scenario, and the dated verification record is updated.

* no-mistakes(review): Ghost-strip popup demotion guard; relocate 2.1.291 docs

* no-mistakes(review): Match popup guard to fallback's plain glyph row

* no-mistakes(review): Narrow box popup test; note box follow-up in docs

* no-mistakes(document): Point same-glyph footer rule at 2.1.291 popup exception

* no-mistakes(ci): Both selected Greptile findings are fixed. Only the live test and the verification doc changed; product code and box handling are untouched. The changes are left uncommitted for the outer executor. **ci-2** (tests/fm-herdr-submit-confirm-live-e2e.test.sh) - Invariant: a live delivery check must show that the command actually ran, through its rendered output. An empty composer and a registered agent are not enough. - Fix: after the `/context` verdict, the test now polls the pane the same way the earlier reply check does, until `/context`'s `Context Usage` heading renders. Any other result fails. - I confirmed that heading with a probe in an isolated `fm-lab-` session. The popup's description says "context usage" in lowercase, so the case-sensitive match cannot hit the popup. - The read window is 1000 lines (`--source recent --lines 1000`). The report runs to hundreds of rows here with its heading at the top, so the 200-line window the reply check uses would lose it. - The existing agent-registered and composer-empty checks are kept. The header comment, block comment and pass message were updated to match. **ci-3** (docs/verification/runtime-backends.md) - Invariant: only tests that fail against the previous classifier may be called before-and-after regressions. - I ran each of the five tests on its own against base 5838f10's `bin/fm-composer-lib.sh`: - These 3 fail there and are now labelled before-and-after regressions: `marked_row_is_not_a_second_composer`, `composer_content_..._not_the_composer`, and `send_text_submit_..._proven_and_submitted` (the last one returned 'unknown'). - These 2 pass there and are now labelled guards: `demotion_only_ever_refuses` and `popup_still_refuses_a_partial_payload`. - I corrected one more claim in the same paragraph. It said the live guard fails against the old classifier "at the `/exit` scenario". A live run against the old classifier (session `fm-lab-herdr-submit-con-1106578-15406`) actually fails earlier, at `/context`, with `send-failed`. The doc now says that. - The doc's recorded live output was replaced with the real output of the new run. **Verification** - Live guard on HEAD: `FM_HERDR_SUBMIT_CONFIRM_LIVE=1 ANTHROPIC_MODEL=claude-haiku-4-5-20251001` passed all 4 checks, including "...proves and submits a typed /context behind its command popup and renders its report". It ran in its own session, `fm-lab-herdr-submit-con-1098793-23839`. - Every live run used only its own `fm-lab-` session. Afterwards `herdr session list` shows only `default`, which was never touched. - `tests/fm-composer-lib.test.sh` returned 0 with 47 ok, and `tests/fm-backend-herdr.test.sh` returned 0 with 233 ok. - With the opt-in off, the live test skips with rc 0. - `bin/fm-lint.sh` returned 0 (ShellCheck 0.11.0, actionlint 1.7.12). - Temporary directories were removed. **Gap:** the new check's failure path was never triggered in a live run, because the old classifier fails earlier, at the verdict. That the check can tell a run from no run rests on the probe: the heading is not on screen before submission, and the popup text is lowercase

* no-mistakes(document): Include Tern in popup classifier inheritance documentation

* fix(bin): tolerate slow Herdr worktree entry in fm-spawn (kunchenguid#8139)

* fix(spawn): tolerate slow Herdr worktree entry

Restore shell startup tolerance after out-of-pane leasing, resend the worktree cd once, and diagnose a pane that never moves. Cover delayed and dropped entry portably and ordinary/delayed projected spawns in an isolated real-Herdr lab.

Fixes kunchenguid#8138

* no-mistakes(document): Document Herdr worktree cd resend in agent-control

* no-mistakes(ci): I fixed Greptile ci-1. On supported Herdr releases below the presentation floor (0.8.0, including pinned 0.7.4), the live test `tests/fm-herdr-projected-cd-live-e2e.test.sh` reported a correct flat spawn as a failure. Now it skips clearly on those releases. **Invariant:** the test may expect a projected spawn only when the same floor classifier `fm-spawn` uses says projection is the default. **Where it must hold:** the one decision point before the case loop. Both cases (delay 0 and delay 1) assert the `.herdr-presentation` marker, and both sit after that check. **Change (test file only):** after the lab is provisioned, the test calls the existing `fm_backend_herdr_presentation_release_supported` from `bin/backends/herdr.sh`. It goes through the test's fake `herdr`, which routes every call to the named lab session, so the check covers the same client and server `fm-spawn` sees. The result is handled three ways: - **At or above the floor:** the projected and delayed cases run as before. - **Below the floor:** the test prints `skip: Herdr <release> is below the 0.8.0 presentation floor, so spawns stay flat` and exits 0. The cleanup trap still tears down the lab. - **Can't be classified:** the test fails. No production code changed, and the overall Herdr support floor is unchanged. **Verification** (Herdr was only run through `bin/fm-herdr-lab.sh` on its own `fm-lab-` session): - **Above the floor:** on the installed Herdr 0.9.5, both cases pass: "Herdr 0.9.5 projected spawn enters its recorded copy" for delayed=0 and delayed=1. - **Below the floor:** I pointed `HERDR_LAB_HELPER` at a temporary wrapper around the real lab helper. It changes only the `status --json` reply so the client and server report 0.7.4, protocol 17. The test printed "skip: Herdr server version 0.7.4 (protocol 17) is below the 0.8.0 presentation floor, so spawns stay flat" and exited 0. This is simulated, not a real 0.7.4 install. - Afterwards no lab sessions were left over. - `tests/fm-spawn-herdr-lease.test.sh` passed through `bin/fm-test-run.sh`. - `bash -n` is clean. shellcheck shows only the existing SC1091 info note about the sourced `tests/fixtures.sh`. I did not edit the PR body, so its links to issue kunchenguid#8138 are untouched

* no-mistakes(document): Document live projected-cd test's below-floor skip

* feat: report worker status through OSC 7501 (kunchenguid#8011)

* feat(bin): report worker state via OSC 7501 for firstmate-launched agents

Stage 2 of the herdr-core/app staged plan: agents firstmate launches now
report idle/working/blocked/done to their terminal through the OSC 7501
Program Status Protocol, so 7501-aware terminals (herdr-core, the Herdr
app, Ghostty, Rex) show task state without screen inference.

bin/fm-osc7501.sh is armed inside the launch command before the agent
starts. Its watcher folds the task's durable signals (status log,
busy-state, unhandled inbox) into root records with
app=firstmate-<harness> and title=fm-<id>, and parks the record on exit.
Arm emits nothing unless the terminal is known-aware (HC_TERMINAL_ID,
REX_BLOCK/REX_SESSION, TERM_PROGRAM=ghostty) or answers the capability
query, stands down for natively reporting harnesses (claude >= 2.1.295,
pi >= 1.1.0), and never writes to worker input. The env -i floor now
forwards the HC_* pane markers so detection survives an allowlist.

config/osc7501-status gates the feature per home (default on).
The herdr backend is untouched; core/app integration stays Stage 3.

* no-mistakes(review): Fix OSC 7501 reporter tty identity, lifetime, mapping, and stty restore

* no-mistakes(review): Honor hc terminals under herdr; retire superseded status declarations

* no-mistakes(review): Retire stale declarations on any newer busy record

* no-mistakes(review): Drop report command; retire declarations on later inbox steers

* no-mistakes(review): Classify activity via busy lib; confirm reporter retirement

* no-mistakes(review): Order retirement by nanosecond times; drop pull-source turn guess

* no-mistakes(review): Retire declarations only on later steers, with stable thresholds

* no-mistakes(review): Drop probe cache; restore hc socket pinning in floor

* no-mistakes(review): Drop declared-wait mapping; report from single-source signals only

* no-mistakes(review): Give the watcher backend capture for pane-classified harnesses

* no-mistakes(document): Clarify OSC 7501 documentation ownership and Rex compatibility

* no-mistakes(review): Newline-delimit launch disarm; keep arm warnings visible

* no-mistakes(review): Require stand-in pidfile before checking disarm

* no-mistakes(review): Skip status-bridge records in Rex activity readers

* no-mistakes(ci): Fixed Cortex launch assertions mistaking the OSC reporter’s --config for an unsupported Cortex flag, including the sibling xhigh check. Reproduced failure before fix; Cortex suite, bash syntax, and diff checks pass afterward. Full suite failure was downstream of this test failure

* no-mistakes(ci): Removed active terminal capability queries, tty reads/mode changes, and the unused query timeout. Unknown terminals now silently no-op; passive detection remains. Updated docs and behavioral tests. Regression rejects pre-fix code; all 18 reporter tests, syntax checks, ShellCheck (excluding source-resolution notices), and diff checks pass

* no-mistakes(review): Exclude native codex and gate records on activity

* no-mistakes(review): Never write bridge records without known activity

* no-mistakes(review): Probe the launched binary for native reporters

* no-mistakes(review): Arm no reporter for raw launch commands

* no-mistakes(review): Report raw launches only with established agents

* no-mistakes(document): Consolidate OSC reporting documentation ownership

* no-mistakes(ci): Fixed standing captain holds to report blocked kind=question before activity fallback. Added behavioral coverage for idle/busy holds and supersession; confirmed regression fails before the fix and full OSC suite passes afterward. Shell syntax and diff checks passed

* no-mistakes(ci): Fixed the flaky startup-teardown fixture in tests/fm-watcher-lock.test.sh: replace racing recursive deletion with a checked atomic rename, retaining the old inode. Full suite failure was downstream of this shard failure. Complete watcher-lock suite, shell syntax, and git diff checks passed locally

* fix(osc7501): keep the bridge's own record honest when activity reads unknown

The unknown-activity silence that protected a native writer's root record
also left the bridge's own working/blocked on the pane forever - including
past the agent's exit, which never emitted its final record. While the
bridge's last write still stands, the durable signals now keep it honest:
they fold the same way with idle activity and the result is written once
per change, with no hold and no heartbeat. A watcher that never wrote
still stays silent so a native owner is never touched. The final record
likewise lands whenever the bridge's last write stands, keeping done/error
and parking the rest at idle. Rovo and Antigravity, whose only activity
source resolves busy or unknown, thereby still reach idle, blocked, done,
and error. Arm also writes one idle record once every gate passes, clearing
whatever a watcher that died without its final write left on the pane.

* no-mistakes(review): Carry arm-time ownership into watcher, trim osc_seq

* no-mistakes(document): Clarify OSC status lifecycle documentation

* fix(osc7501): park stale terminal lines and clear leftovers on unarmed relaunches

A done/failed status line carries the phase that wrote it, not the turn
now in flight: under unknown activity the fold now reports a terminal line
only when it was stamped at or after the reading that last proved the
worker busy, so an earlier phase's result parks at idle instead of
displaying done or error for a whole turn. A same-second stamp still
counts - a truly older line can never coincide with the last busy reading.

arm's residue clear now runs once the pane's terminal proves 7501-aware
and a leftover pidfile marks the record as the bridge's own, before the
config and native gates - so off and native relaunches retire a dead
watcher's record too, while panes that never armed still see no bytes.

* no-mistakes(review): Order stale results by append; keep result at exit

* no-mistakes(document): Clarify OSC status reporting documentation

* no-mistakes(ci): Replaced the version probe’s unbounded TERM/wait loop with shared fm_run_timed process-group termination and KILL escalation. Added a regression proving worker launch proceeds despite a TERM-resistant probe and descendant; reproduced failure before the fix. All 31 OSC tests pass, including the regression with the bash timeout fallback. Shell syntax and git diff checks pass

* fix(osc7501): disarm writes the final record a dead watcher never could

fm-spawn runs disarm after the agent command returns, so a SIGKILLed
watchers pidfile is removed there - before the next launch ever sees it,
which left the dead watcher's working/blocked record standing on off and
native relaunches. disarm now writes that final record itself (idle,
keeping done/error, exactly osc_final's fold) when the pidfile names no
live reporter; the pidfile carries harness and kind so the write names
the right app= and folds decisions under the worker's real kind. The
real-order regression now exercises SIGKILL -> disarm -> off/native
relaunch.

* no-mistakes(review): Write final record when retirement kills watcher

* no-mistakes(review): Always write final record once retirement confirms

* no-mistakes(lint): Suppress intentional generated-script expansion warning

* feat(bin): add opt-in Linux container check for changed shell tests (kunchenguid#8148)

* feat(bin): add opt-in Linux container check for changed shell tests

* no-mistakes(review): Run Linux check as host user with git clone

* no-mistakes(review): Remove locally deleted files from Linux scratch copy

* no-mistakes(review): Use keep-id for podman in Linux test check

* no-mistakes(ci): Fixed the three selected review findings locally (nothing committed or pushed). ci-2: bin/fm-test-linux.sh now clones with --no-hardlinks, so the container cannot write the host object files. ci-3: tests/linux/Dockerfile now installs python3, nodejs and curl (tools the ordinary suites require); tests/fm-test-linux.test.sh container case adds a tools.test.sh fixture that runs python3, node and curl. ci-4: both the overlay check (line 100) and the prune check (line 104) treat [ -L ] as present; the same fixture commits a dangling symlink and asserts it survives in the container. Verified with FM_TEST_LINUX_CONTAINER=1 bash tests/fm-test-linux.test.sh on Docker: all 4 pass. Mutation check: removing the [ -L ] at line 104 turns the fixture red ("dangling link lost"). Removing it at line 100 alone does not, because the clone already carries committed symlinks; that check only matters for untracked dangling links, which has no fixture. The check stays opt-in

* feat(bin): accept a caller-supplied expected PR head in fm-pr-merge (kunchenguid#8157)

* feat(bin): accept a caller-supplied expected PR head

The merge path read the live head again and used that value for the forge
head match. A push after review could replace the tested commit.
--expected-head takes one full commit, refuses a different live head, and
sends that same value to GitHub, GitLab, and Forgejo.
Callers that omit it keep the live-head match.

Closes kunchenguid#8124

* no-mistakes(review): Drop no-op head pin; test authority and identity refusals

* no-mistakes(review): Inline merge head assignment

* fix(bin): re-arm supervision on Claude StopFailure so error-ended turns are not blind

A Claude turn that ends on an API error runs no Stop phase, so the
Stop-owned auto-arm never fired and the home had no watcher coverage
until external input (observed as 15h and 4.7h blind gaps). Claude
2.1.317 fires StopFailure for those turn ends and honors the same
asyncRewake/exit-2 rewake as Stop, verified live on a herdr-hosted
primary: the tracked auto-arm under StopFailure armed a real watcher,
delivered the queued wake as an unprompted turn, and the chained error
end was suppressed by the new per-cooldown rewake bound instead of
storming.

* no-mistakes(review): Pace StopFailure continuations instead of dropping

* no-mistakes(review): Recheck AFK and need after StopFailure pacing

* no-mistakes(document): Document StopFailure supervision continuity

* no-mistakes(ci): Normalized the validated StopFailure cooldown to base 10. Updated the behavioral pacing regression to use 08 after a cooldown marker exists; it failed before the fix and passes afterward. Full auto-arm test suite, Bash syntax checks, and git diff --check pass. Changes remain local; nothing published

* no-mistakes(ci): Fixed the watcher-lock test’s flaky STOP-and-scan synchronization by pausing at the lock-free poll sleep. Full watcher-lock suite, repeated focused regressions, Bash syntax, and diff checks pass. Full suite failure was downstream of the shard failure. Changes remain local; nothing published

* no-mistakes(document): Clarify StopFailure continuity documentation

---------

Co-authored-by: Michal Zuber <[email protected]>
Co-authored-by: Lewis Mazzei <[email protected]>
Co-authored-by: Trillium Smith <[email protected]>
Co-authored-by: Trillium Smith <[email protected]>
Co-authored-by: Martin Kessler <[email protected]>
Co-authored-by: c6aw <[email protected]>
Co-authored-by: AgardnerAU <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Symphony <[email protected]>
Co-authored-by: Alexander Goldstein <[email protected]>
Co-authored-by: Tim Kleinschmidt <[email protected]>
* fix(bin): let the Herdr lab tripwire protect a custom-named fleet session

fm-herdr-lab.sh only accepted a running session literally named "default"
as the fleet-state tripwire, so a home whose fleet runs in a custom-named
Herdr session could not provision any lab.

FM_HERDR_LAB_FLEET_SESSION (default "default") now names the fleet session
the tripwire records and compares, with the same {name, default, running,
socket_path} snapshot and exactly-one-running-row rule. The name must be a
plain session name and can never be an fm-lab- session. Every Herdr call the
helper makes now clears the inherited HERDR_SOCKET_PATH, HERDR_PANE_ID,
HERDR_TAB_ID and HERDR_WORKSPACE_ID pane variables.

Fixes kunchenguid#8268

* no-mistakes(review): Isolate lab tests from inherited fleet-session configuration

* no-mistakes(document): Clarify Herdr fleet-session documentation and ownership

* no-mistakes(document): Correct configurable fleet-session safety wording

* no-mistakes(lint): Suppress ShellCheck warning for intentional literal backticks
kunchenguid#7255)

* fix: require a live Pi watcher successor

* no-mistakes(document): Document Pi dead-but-ready successor regression coverage

* no-mistakes(review): Retry Pi watcher arms on process exit, not close

* fix(pi): preserve actionables across exit drain

* no-mistakes(document): Document Pi exit-drain actionable regression coverage
…enguid#8217)

* test(remote): run FIFO holders from a non-platform jq copy

macOS hides a platform binary's environment from ps -E. On a host whose
jq is Apple's /usr/bin/jq, the holder markers were unreadable, so
fm-remote-doctor and fm-remote-herdr-guard failed.

tests/lib.sh gains fm_test_nonplatform_binary, which copies the binary
and ad-hoc signs the copy on Darwin. Both suites run their holders from
that copy.

* test(omp): run the no-omp-ancestor case under a named claude shell

The leaked-marker case ran under a plain bash, so its verdict came from
the harness that ran the suite. Under a Codex ancestor it detected codex
and failed. A claude-named shell now gives the case its own nearest
harness ancestor.

* test(procevent): start the draining holder with the portable perl setsid

macOS ships no setsid binary, so the draining-holder case failed with
"setsid: command not found" before it could read the holder's
identity. The suite already starts its other new-session holders with
perl's POSIX::setsid; this one now does the same.

* no-mistakes(ci): Captain, added the marker-only case using fm_fake_blind_ancestry and preserved the named Claude case. Mutation verification confirmed the new case rejects unguarded OMP markers. All 19 OMP checks, repository lint, shell syntax, and diff checks passed. Runtime code remains unchanged

* test(omp): clear inherited gemini and rovo markers in the blind-ancestry case

harness_marker checks GEMINI_CLI, ATLASSIAN_AGENT_TYPE and ROVODEV_CLI
before CLAUDECODE. With ancestry hidden, no process name outranks them,
so a suite that inherited one of them failed the marker-only case with
'gemini' or 'rovo'. The case now clears those markers as well.

---------

Co-authored-by: Karan Manoharan <[email protected]>
* fix(bin): export the active FM_HOME onto ship and scout launches

The tmux/herdr daemon that owns a worker's pane does not inherit the
spawner's environment, and fm-spawn.sh set FM_HOME only for secondmates.
A ship or scout therefore started with no FM_HOME, so any bin/*.sh script
it ran resolved its own code root as the home and read and wrote the
wrong home's state. Set the spawner's resolved FM_HOME on every ship and
scout launch, in both the pane launch command and the T3 Code env.

Fixes kunchenguid#8271

* no-mistakes(ci): Fixed ship/scout launch FM_HOME export; secondmate branch unchanged. Updated launch-shape assertions and added an executed compound-launch environment probe. Passed FM_LIVE=0 compact-adviser test, Kimi harness test, fm-lint, and git diff --check. Dispatch-profile suite not run as instructed

* no-mistakes(ci): Updated only tests/fm-spawn-compact-adviser-disable.test.sh: the executed compound-launch probe reports both COMPACT_ADVISER_DISABLE and FM_HOME; assertions require 1 and $HOME_DIR, and the pass message names both. Verified with FM_LIVE=0 bash tests/fm-spawn-compact-adviser-disable.test.sh and bin/fm-lint.sh. Both passed
…publish (kunchenguid#8283)

* fix(watch): quiet relayed captain holds and keep reminder backoff on republish

The opt-in open-decision reminder tick only suppressed a key when its own
task was paused or held, so a secondmate's captain-hold-<task>-<n> key
relayed into the parent status file always reminded, and every republish
of a still-open key with a new [at=] restarted its backoff at the threshold.

- Exempt keys with the structured captain-hold- prefix, decided from the
  key alone.
- fm-captain-hold.sh hold --until now publishes a structured
  [until=YYYY-MM-DD] field on the relayed line; the timed fold view carries
  it and the tick re-arms the key from 00:00 UTC on that date. A malformed
  field re-arms at once; note prose is never read.
- Ledger rows now also record verb and note, so an unchanged republish keeps
  its first opened time, last reminder and next delay, while a changed verb
  or note starts a new episode. Legacy five-column rows still match on their
  opened time and are rewritten in place.

* no-mistakes(review): Keep republish epoch in fold, not reminder ledger

* no-mistakes(ci): Fixes the Greptile P1 bug "repeated hold dates get ignored" (ci-1). The rule that was broken: a keyed parent-channel state update has to be compared with that key's latest line, not with every line in its history. Before the fix, `fm_parent_channel_append_once` searched the whole channel. So holding `--until A`, then `B`, then `A` dropped the final A line, and the parent watcher kept using B. Fix (the edits were in the worktree, uncommitted, when this round started - most likely from round 2's agent, which crashed on a rate limit; I reviewed them and kept them): - `bin/fm-parent-channel-lib.sh`: `fm_parent_channel_report` and `fm_parent_channel_append_once` take an optional `[key]` argument. With a key, the new line (without its `[at=]` stamp) is compared only with that key's latest line, found by the new `_fm_parent_channel_latest_for_key` using the existing `_fm_decision_key` and `_fm_status_untimed`. Without a key, the old history-wide dedupe is unchanged. - `bin/fm-captain-hold.sh`: `publish_parent_hold` passes `captain-hold-<id>-<n>`. It is the only publisher that sends keyed state updates (both the `needs-decision` and the `resolved` lines), so both go through the fixed path. The other callers (inactive-reconcile, pr-check, review-check, merge-outcome, pending-reply) publish one-off events and stay on the old behavior. I also re-wrapped one overlong line in the header comment. - `tests/fm-captain-hold-lifecycle.test.sh`: a behavior test that runs the real `hold` command A -> B -> A and checks that the latest line for the key carries `[until=A]`, plus a test that an exact retry adds no line (count stays 3). Verification is not finished: when this result was required, the full lifecycle test run and the shellcheck/`bash -n` run were still going in the background with no output yet. So I cannot yet confirm the tests pass or that shellcheck is clean, and I have not checked that the new test fails without the fix
…kunchenguid#8286)

* feat(capacity): opt-in auto lane budget from measured host vitals

Add an `auto` first line to config/lane-capacity so fm-capacity.sh decides
how many ship and scout lanes a machine can take from its own vitals instead
of a hand-set integer cap. Open lanes are the smallest of a memory, cpu, and
disk budget built from learned per-lane footprints (p90 of this machine's
last 30 lanes once five are recorded), with an optional max-lanes ceiling.
Lanes younger than 180 s reserve a full lane, growth is damped to two lanes
per publish, and every local home on the machine is counted.

Gates for cpu, load, memory pressure, swap-in, io pressure, the Windows host
under WSL2, thermal limits, battery, and optionally GPU memory close
admission at once and reopen after three clean publishes. The published
fm-lane-capacity.v1 document gains additive budget, footprint, vitals,
gates, and a recommend-only reclaim list of idle lanes.

fm-spawn.sh applies the verdict only when the home declares admit-spawns,
under a machine-wide lock, deferring with exit 75 like a project-capacity
deferral; FM_SPAWN_IGNORE_LANE_CAPACITY=1 overrides one spawn. Probes live
in the new read-only bin/fm-lane-vitals-lib.sh. Fixed mode and homes
without the new keys are unchanged.

* no-mistakes(review): native Windows vitals, damped admission, drop capacity pins

* no-mistakes(review): label damped refusals, drop Cygwin alias, refresh scripts table

* no-mistakes(document): note lane-capacity spawn deferral in AGENTS.md, reflow headers

* no-mistakes(document): restore AGENTS.md line, say MSYS /proc not Cygwin

* test(capacity): end-to-end lane capacity integration suite and review fixes

Add tests/fm-lane-capacity-integration.test.sh, which drives the auto lane
budget through the real firstmate paths: bin/fm-spawn.sh admitting, deferring
with exit 75 and a queued backlog item, and re-admitting real spawns on the
verdict; eight spawns in one publish interval admitting exactly the damped
budget; the real bin/fm-watch.sh publish cycle damping growth across two
publishes and feeding the next spawn; idle-lane reclaim judged from real
worker processes without stopping any; the fixed-cap path compared byte for
byte against the merge base; and an opt-in live case that loads the host CPU
and records the verdict before, during, and after with timestamps.

Fixes found while testing and in review:
- a config/lane-capacity that exists but cannot be read now refuses the spawn
  gate instead of admitting, since it cannot show it does not ask for it
- in auto mode a pressure-file beat can only lower the live memory reading
- under WSL2 the Windows host's power reading closes the battery gate when
  Linux has no power_supply of its own
- the report names the first three reclaim candidates with their class, idle
  age, next step, and evidence

* no-mistakes(review): hold closed gates on unknown readings, pin fixed-cap tests

* no-mistakes(review): hold closed battery, thermal, pressure gates on unreadable probes

* test(capacity): inject memory in the portable integration cases

The portable cases sized their room from this host's live available memory,
so the four-lane watcher case failed on any machine with less than about
9 GB free even when the code was right. They now inject the memory reading
through the probe seams the unit suites use: a fake sysctl for hw.memsize
and kern.memorystatus_level on macOS, and on Linux an FM_PROC_ROOT_OVERRIDE
tree whose meminfo is a fixture and whose other entries link to the real
/proc. The spawn gate case asserts the budget reads the injected 11 GB. The
idle-reclaim case keeps the real process table and memory, and only the
opt-in live case reads this host's memory for admission.

* no-mistakes(review): Tighten burst deferral, probe_env watcher stop, reword floor messages

* test(capacity): keep the portable cases off the live Windows host view

* no-mistakes(review): Ignore peripheral batteries; skip unused probes on admission

* no-mistakes(ci): Fixed ci-3 (Greptile "Closed gates expire"). Before this fix, a published auto doc older than 300 s became null, and that dropped every closed gate along with the budget. So if the watcher stopped and powershell.exe stayed unreadable, the next spawn could be admitted on Linux headroom alone, with no clean host reading. Fix in bin/fm-capacity.sh (auto_budget jq): - `$pa` is now the last auto doc at any age. - `$pg` (its gates) comes from `$pa`. - `$pd` (the doc only while it is at most 300 s old) still feeds prev_free, since_publish, damping and the swap rate, so the budget's freshness is unchanged. - gate() now reads the previous gate state from `$pg`. A closed gate keeps its since_epoch and clear_count however old the doc is, and only real clean readings reopen it. Test: added test_closed_gate_survives_a_stale_publish to tests/fm-capacity-auto.test.sh and extended the header's coverage list. The test publishes with a starved WSL host so host-memory closes, ages the doc by 900 s, removes the host cache and makes powershell.exe fail. It then asserts that --spawn-gate exits 75 with "host-memory: Windows host unreadable" and that --json still reports the gate closed with admit false. It failed before the fix (exit 0) and passes after it. Checks run: fm-capacity-auto, fm-capacity, fm-project-capacity and fm-lane-capacity-integration all pass. Shellcheck shows only info-level SC1091 notes because it was run without -x. No em dashes were added. Docs needed no change because none of them tie gates to the 300 s window. ci-1 and ci-2 were not touched, as instructed
…henguid#8294)

* feat(skills): add lavish-url page capture and feedback routing

Add the /lavish-url skill and bin/fm-lavish-url.sh. `snapshot <url>
[--mobile]` renders a public or local page through chrome-devtools-axi,
rebuilds it through a hostile-input sanitizer (bin/fm-lavish-url.py),
injects the universal review layer with [Fix Layout], [Update Text], and
[Mobile Bug] prompt chips plus every matching enhancer (default, odoo,
teatop), proves the Lavish session is listed open, and arms it through
bin/fm-procevent-lavish.sh arm. `path`, `resolve`, and `owns` locate
snapshots and routes; `route <source-id> <sequence> [--file]` presents a
captured feedback wake through the adapter's read and files it once as a
queued item in the backlog of the registered project that owns the URL's
host, refusing inferred, ambiguous, and unrouted mappings.

Document config/lavish-url-domains, point Lavish wakes for snapshots at the
skill, and add tests/fm-lavish-url.test.sh with its serial duration hint and
changed-path selection.

* no-mistakes(review): Preserve CSS comparisons and remove unused matching interface

* no-mistakes(review): Preserve URL commas when parsing responsive image candidates

* no-mistakes(document): Clarify Lavish URL usage and documentation ownership

* no-mistakes(ci): Captain, fixed all four findings: isolated capture sessions with cleanup, atomic snapshot reservations, safe CSSOM preservation with inaccessible-sheet metadata, and collision-resistant review controls. All 8 behavioral tests, targeted fm-lint.sh, and git diff --check passed. No pipeline or publication actions performed

* no-mistakes(ci): Captain, fixed both findings: captured CSS retains stylesheet order, and snapshot reservation retries only on name collisions. Added behavioral regressions. All 9 focused tests, targeted fm-lint.sh, and git diff --check passed. No pipeline or publication actions performed

* no-mistakes(ci): Captain, replaced the permission-dependent regression with an ENOTDIR injection that exercises the production reservation error path regardless of privileges. It verifies prompt nonzero exit without capture or arming. All 9 focused tests, targeted fm-lint.sh, and git diff --check passed

* no-mistakes(ci): Captain, removed the TeaTop enhancer and references, replaced fixtures with example.test hosts, and retained host-matching coverage using a test-only enhancer. All 9 focused tests, targeted lint, documentation checks, and git diff --check passed. No pipeline or publication actions performed

* test(lavish-url): replace tea/teahouse test fixtures and host with generic portal fixtures

* no-mistakes(document): Clarify Lavish snapshot naming, styles, and metadata

* no-mistakes(ci): Captain, fixed ci-1: readable CSSOM replaces original inline style text in place, including empty copies; unreadable sheets retain original text. Sanitization remains intact. Regression failed before the fix; all 9 focused tests, script lint, and diff checks now pass. Rejected enhancer work remains untouched
…kunchenguid#7619)

* fix(pi): rearm the watcher independently of a held wake delivery

docs/watcher-continuity.md promises that each adapter starts the next
watcher arm before delivering the wake prompt. On a Pi primary with a
busy supervision branch that was not what happened: watcher closes
were handled one at a time behind a single 'restoring' flag, so a
freshly restarted watcher that closed again waited in pendingActionables
until the earlier branch delivery settled. For that whole time no
watcher was armed.

One day's arm ledger showed successor arms starting 297 to 1244
seconds after the previous arm closed, and the 'turn would end blind'
guard firing 26 times in that day with the last beat 43 to 1214
seconds old.

Arming and delivery are now separate concerns. Each close restores
continuity in a generation-owned pump that does not wait on the
serialized wake delivery, and the wake queue is still delivered one at
a time. A successor's failure during restoration keeps its bounded
retry once the continuity operation finishes, so a failure that lands
during a held delivery is still retried instead of being skipped.

The regression test holds a branch delivery open, closes the new
watcher, and asserts that the successor arm starts before the delivery
resolves.

* docs(watcher): record the Pi successor-start and delivery split

* fix(pi): confirm the handling handoff inside the continuity operation

* test(pi): make the repeated-close fixture generation-aware

* fix(pi): settle a deferred close with the operation that held the guard

* no-mistakes(document): docs(watcher): record Pi held-delivery restore and handoff coverage

* no-mistakes(document): docs(watcher): fix Pi deferred-retry wording
* fix(watch): surface overdue pauses as decisions

* no-mistakes(review): Classify overdue pauses as blocked stale decisions

* no-mistakes(review): Enforce strict pause ceilings; durable blocked decisions remain unresolved

* fix(watch): make overdue pauses actionable

* no-mistakes(document): Document overdue pause behavior and configuration

* no-mistakes(ci): Invariant: every overdue pause—dated or undated, including a worker classified as working—must open an actionable keyed decision, and leaving that pause must resolve it. The affected paths are the stale `paused` and `working` classifications, plus status transitions that resume or replace a pause. Added the overdue check to the working classification and attempted automatic resolution on resume, with undated coverage. Verification is incomplete: `bash tests/fm-watch-triage-pause.test.sh` fails because the resumed worker still leaves the decision open. This phase is not complete; the fix needs further work

* no-mistakes(ci): Updated the undated pause test to use portable `set_mtime`, refresh `.seen-until_status`, and allow the expected ordinary recheck exit while asserting no overdue decision opens before the ceiling. The focused test script timed out after 120 seconds, before reaching the changed test. The `working` route still reaches `wedge_timer_check` without the overdue check; that selected finding remains unresolved, so this CI phase is incomplete

* no-mistakes(ci): Updated the working-classification route to check both overdue ceilings before the wedge path, and added automatic resolution when a pause is replaced by a fresh, non-overdue pause. `bash -n` passed. Focused dated-resume and undated-overdue tests still fail (decision remains open / is not created); the full test script timed out before reaching them. This CI phase is incomplete

* fix: resolve overdue pause decisions on status changes

* fix: close overdue pauses only on resume

* no-mistakes(document): Document overdue pause behavior

* no-mistakes(ci): Fixed the overdue marker to bind its offset to the status file’s device/inode and clear on replacement or shrink. An open marker now suppresses the ordinary terminal-stale path despite pane changes. `bash -n` and `git diff --check` passed; the focused test script timed out after four of 31 cases, so the new behavior is not fully verified. Behavior tests for pane churn and task-ID reuse remain to be added

* fix(watch): preserve overdue pause markers

* no-mistakes(document): Document overdue pause behavior and configuration

* fix(watch): retire overdue markers on teardown

* no-mistakes(ci): Implemented a shared dated/undated overdue-pause predicate and routed both watcher and daemon pause rechecks through it. The daemon now appends the keyed blocked decision, records the status-file identity/offset marker, and queues one stale escalation. `bash -n` and `git diff --check` pass. The requested daemon behavior test was not added or run; this change is not fully verified

* no-mistakes(ci): Fixed the daemon overdue-pause append path to accept both successful return codes and persist the blocked line’s exact end offset before queuing the wake. `bash -n` and `git diff --check` pass. The focused pause suite timed out after five cases; the requested daemon-path behavior test was not added or run, so verification is incomplete

* fix(watch): test overdue pauses in away mode

* no-mistakes(review): Keep malformed dated pauses on bounded rechecks

* no-mistakes(review): Reconcile daemon overdue decisions on worker resume

* no-mistakes(document): Document overdue worker pause behavior

* no-mistakes(document): Document overdue pause decisions

* fix(supervision): dedupe overdue pause alerts

* no-mistakes(review): Gate overdue pause decisions on away posture

* no-mistakes(review): Preserve unread status events during overdue escalation

* no-mistakes(review): Use shared overdue predicate for watcher classification

* no-mistakes(ci): Fixed daemon-backed quiet mode to apply the overdue pause ceiling while keeping captain-held waits away-only. Added a quiet-mode regression test; the existing away-mode deduplication and unread-event regression passed. The real away-mode daemon lab passed, and `git diff --check` passed. The full daemon test script passed, including all three overdue-pause cases. Linux validation could not be run in this macOS worktree; per instruction, stopping without claiming both OS lanes passed. Final SHA: 79996166d5ce89be222935da046e1bbf2a1a2bf8

* no-mistakes(review): Resolve overdue decisions on any worker status event

* no-mistakes(review): Exercise overdue marker offsets through real status append

* no-mistakes(document): Document overdue pause handling

* no-mistakes(ci): Invariant: an overdue pause is reported only after its stale escalation is queued. The daemon’s overdue housekeeping is the sole affected path; the watcher does not own this daemon escalation. Moved the marker write after successful queueing. Added the requested retry regression, but `bash tests/fm-daemon.test.sh` fails because the test’s recovery attempt does not create the marker. macOS/Linux Lint and behavior lanes were not run; stopping without claiming validation. HEAD remains `2dd9718e2186de6e0292a593f3fcb84e96c5f201`; changes are uncommitted

* no-mistakes(ci): BLOCKED. The retry test now has a real newline and its saved-function rename matches Bash’s `declare -f` output, but `bash tests/fm-daemon.test.sh` still fails: the retry does not create `.paused-overdue-overdue-retry`. I did not proceed to other requested validation. This environment is macOS (`Darwin`); Linux validation cannot be run here, so I cannot satisfy the required two-OS validation. No commit or push was made. The daemon implementation already writes the overdue marker only after `escalate_add` succeeds; the test needs further diagnosis before this phase can pass

* no-mistakes(ci): Implemented retryable overdue alerts: failed enqueues retain pending state, housekeeping retries without duplicating the blocked decision, and reconciliation/teardown clean up pending state. `bash tests/fm-daemon.test.sh`, shell syntax checks, and `git diff --check` passed. The stated synchronized commit 49023a95 was not present in this worktree; these changes are uncommitted

* fix(daemon): keep pending overdue alerts out of the overdue-marker globs

The pending overdue alert record was named .paused-overdue-pending-<task>,
which the watcher's and daemon's .paused-overdue-* loops also matched. The
watcher read the task as pending-<task>, found no status file, and deleted
the record, so a failed alert was lost on the next watcher poll. Rename it
to .overdue-pending-<task> and cover a watcher poll between the failed
enqueue and the retry.

* no-mistakes(review): Discard resumed overdue alerts before retry

* fix(daemon): fold overdue alert retries into the overdue marker

Drop the separate pending record. The overdue marker's second line now holds
the daemon's delivery state, so keyed resolution, resume and retry all run
through one reconcile path. The marker is published atomically before the
blocker is appended, and only a daemon-owned marker hides the blocker from wake
classification, so a watcher-written marker keeps ordinary blocked escalation.

* fix(daemon): drop the overdue alert retry

A failed enqueue now leaves the overdue decision open and the next housekeeping
scan raises it, so the alert has no separate delivery path to race or lose. The
marker's second line only records a queued alert. The blocker is appended before
the marker, and an already-open decision is not opened again.

Measure the undated pause bound from the pause line's own [at=] stamp, falling
back to the file's age for unstamped lines.

* no-mistakes(review): Preserve overdue decisions across unrelated status events

* no-mistakes(review): Treat zero pause ceiling as invalid configuration

* no-mistakes(document): Document overdue pause behavior

* no-mistakes(lint): Fix ShellCheck subshell export warnings

* no-mistakes(lint): Fix ShellCheck subshell environment warnings

* no-mistakes(ci): Updated both overdue reconcilers to ignore unrecognized prose and honor FM_CLASSIFY_PAUSED_VERB; added prose/custom-verb regressions. Watcher tests and shell syntax checks passed. Daemon test suite still fails at the existing “failed queue lost the overdue marker” scenario before reaching the new regression

* no-mistakes(ci): Fixed both overdue reconcilers to use the shared status-event predicate, preserving prose as non-events while recognizing supported legacy completion lines. Added done:/merged coverage. Shell syntax and diff checks pass; watcher test passes. Daemon suite remains blocked by its known earlier failure, “failed queue lost the overdue marker,” before reaching the new regression

* feat(supervision): make the pause ceiling opt-in via config/pause-ceiling

Overdue pauses open a keyed decision only in a home with the config/pause-ceiling
presence flag; without it paused waits keep main's recheck behavior. The classifier,
watcher and away daemon each check the flag. Adds flag-absent and flag-present tests,
fixes a daemon test that never applied its fixture environment (which aborted the
rest of the file), and restores main's T3 discovery test.

* no-mistakes(ci): Fixed both overdue reconcilers to use the configured resolve verb when matching and writing resume resolutions. Added watcher and daemon regressions; focused tests and `bin/fm-lint.sh` pass
…id#8308)

* feat(bin): ask a Claude primary to /stow before compaction

Add an opt-in Stop hook that tells a primary session to run the existing /stow skill when context nears compaction or the last /stow is a day old.

* fix(bin): keep the stow ask off secondmate homes and unread clocks

A Stop block in a secondmate home left the parent recording idle, and a missing python3 still asked by age after a /stow it could not see.

* no-mistakes(review): Let continuation stops trigger stow-guard asks
Azd325 and others added 26 commits November 11, 2026 07:28
…ons (kunchenguid#8236)

* feat(watch): add opt-in silent recheck for unchanged paused declarations

Refs kunchenguid#6932

* no-mistakes(review): Require live agent for silent paused recheck

* no-mistakes(review): Test silent paused recheck for live ship agent

* no-mistakes(document): Document silent paused recheck flag

* no-mistakes(ci): Silence ticking-pane paused rechecks; reorder cheap checks
…he done gate (kunchenguid#8339)

* fix(bin): ignore the no-mistakes gate mirror in the done: reachability check

fm_dod_named_head_reachable_outside_worktree accepted a named head found on
any remote-tracking ref, including refs/remotes/no-mistakes/*, the local
no-mistakes gate mirror. A head that only reached that mirror never left the
machine, so leave the mirror's refs out of the check, as teardown already
does with --exclude='no-mistakes/*'.

* no-mistakes(review): Document gate-mirror exclusion refusing unfetched origin heads

* fix(bin): refresh remote refs before refusing a done claim at PR registration

A no-mistakes pipeline pushes from its own gate clone, so with the gate
mirror excluded a GitLab or Forgejo CI-ready done was refused until someone
fetched by hand. fm-pr-check.sh now opts into one bounded, no-prune refresh
of the non-gate remotes in the worker copy, and in the project clone when it
differs, then checks again. The refresh is teardown's, moved into
fm-dod-lib.sh and shared. A refusal after a failed refresh says the verdict
used the last-known refs. crew-state, inactive-reconcile and review-check
note why they read the refs without refreshing.

* docs(bin): say the watcher registers PRs only when config/pr-register-scan is on

* no-mistakes(review): Bound scan refresh by budget; skip refresh on merge

* no-mistakes(review): Refresh remote refs on merge-time re-record too

* no-mistakes(review): Stop scan after refresh deadline; label skipped refreshes

* no-mistakes(document): Clarify ship-landing guidance for unfetched no-mistakes heads

* no-mistakes(ci): Fixed Greptile P1 r4529290256 in `fm_dod_refresh_remote_refs` (bin/fm-dod-lib.sh). The fix only touches that function. **Invariant:** one remote that hangs must not use up the refresh time of the remotes after it. In particular, origin, which normally holds the named head, must still be fetched within the scan deadline. The refresh is shared by the done-gate (scan, plain pr-check and merge-time re-record) and by teardown, so the fix is in that one shared function. **Change:** - **Origin first:** the function now builds the remote list with origin at the front when it exists, followed by the other non-gate remotes. `no-mistakes` is still skipped. - **Split budget:** when a deadline is given, each fetch gets an even share (rounded up) of the time still left, divided among the remotes not yet fetched. Unused time carries over to later remotes. - **Kept as before:** the 30 second per-remote cap, `--no-prune`, skipping remotes once the deadline has passed, and appending each unfetched remote to `FM_DOD_REFRESH_FAILED` for the last-known-refs message. - **Teardown:** it passes no deadline, so its only change is the fetch order. - **Comment:** updated to describe the new order and the split. The other comments that describe the refresh were checked and are still accurate. **Regression test:** `test_remote_hanging_before_origin_leaves_origin_its_refresh` in tests/fm-dod-lib.test.sh. - **Setup:** a `backup` remote whose helper hangs and that sorts before origin in `git remote`, a 4-second refresh deadline, and origin holding the named head. - **Asserts:** the done claim is accepted, origin's tracking ref is fetched to the head, `FM_DOD_REFRESH_FAILED` is `backup`, and the call ends within the deadline. - **Before the fix:** it failed with "kept origin's head from being accepted". **Verification:** - **Test suites:** tests/fm-dod-lib.test.sh, tests/fm-pr-check-security.test.sh and tests/fm-teardown.test.sh all pass, including the existing scan hanging-remote and budget tests. - **Lint:** `bin/fm-lint.sh` (pinned ShellCheck 0.11.0) passes on both changed files. **Not changed:** in the uncommon case where the worker copy is a separate clone, the project clone's refresh still runs after the copy's own refresh, against the same deadline. Per the instruction to change nothing else, I left that as it is

* test(gotmp): provide fm-dod-lib and its sourced libraries in the teardown fake roots

Teardown now sources bin/fm-dod-lib.sh for the shared bounded remote-ref
refresh, and that library sources fm-brief-heading-lib.sh and
fm-external-review-lib.sh from its own directory. Both fake roots in
tests/fm-gotmp.test.sh symlinked only the siblings teardown needed before,
so the real teardown refused at startup there.

* no-mistakes(review): Split refresh deadline across copy and project clone remotes
…#8310)

* fix(bin): keep a branch wake grant when the branch cannot inspect its host pid

* no-mistakes(document): Document branch drains skipping stale-grant reclaim
…kunchenguid#8014)

* fix watcher pause state supersession

* no-mistakes(ci): Fixed the busy path to check paused-run supersession before the busy-turn age gate, and reused captured crew state for gate classification. Added real busy-pane coverage for recent and old turns. Shell syntax, the targeted test, and `git diff --check` pass

* Preserve pause throttle on busy gate repeats

* Make superseded declared-wait wake opt-in

Gate paused_wait_superseded behind the home-local config/paused-wait-supersession
presence flag and move its crew-state read inside the gate, so a home without
the flag keeps main's declared-wait cadence, wording, and crew-state reads.

* no-mistakes(document): Document opt-in paused-wait supersession

* no-mistakes(ci): Fixed terminal run parsing to stop at the run component, preserving distinct throttles when PR suffixes follow; added coverage for two terminal PR-bearing runs. Documented foreground-only scope and unchanged away-mode cadence in both requested locations. `FM_LIVE=0 bash tests/fm-watch-triage-pause.test.sh` passed the new and opt-in cases, then timed out after 8/31 tests (300s)

* no-mistakes(document): Document superseded declared-wait opt-in

* fix(watch): skip the superseded-wait check in away mode

paused_wait_superseded returned only on the absent opt-in flag, so its
busy-path and secondmate callers still read crew state and could queue a
superseded wake while the away-mode flag existed, contrary to the documented
foreground-only scope. Return before any read while afk_present.
* fix(pr-check): report timed-out scans, take over replaced PRs, read only ready lines

The watcher's PR registration scan had three remaining gaps.
A registration cut at the scan's bound was silent, so a task that always
timed out never produced a notice; it now reports once per task and PR that
the merge watch could not be armed, and runs under the grace-bounded runner so
its cleanup trap finishes.
A recorded pr= was never replaced, so a lane that closed a PR and opened
another kept watching the closed one; a newer ready line now takes over a pr=
its status log named, and a pr= the log never named stays the supervisor's.
Any done line naming a PR registered it; only the newest crew-declared line in
an exact ready shape now counts.

* no-mistakes(review): Treat later crew notes as status updates

* no-mistakes(review): Match recorded PRs as exact URL tokens

* no-mistakes(ci): Updated `pr_for_task` to extract canonical ready-note URLs through the shared parser, while retaining legacy `/pull/<number>` URLs on unconfigured hosts. Added a GitLab merge-request replacement report case. `bash -n` and `git diff --check` pass. `bash tests/fm-inactive-reconcile.test.sh` fails earlier at “ledger fallback did not prefer the terminal ready line PR,” before reaching the new test

* no-mistakes(ci): Fixed the quoted Bash regex in `bin/fm-inactive-reconcile.sh`; the unconfigured-host `/pull/<number>` fallback now matches as intended. Verified with `FM_LIVE=0 bash tests/fm-inactive-reconcile.test.sh` (passed)

* no-mistakes(document): Clarify PR scan documentation

* no-mistakes(lint): Quote done status literal to satisfy ShellCheck

* fix(pr-check): queue a scan notice before marking it sent

The scan wrote its once-only marker before the watcher queued the notice, so a
watcher that stopped or failed to append in that window lost the notice, and
the marker kept later sweeps silent. The scan now queues the wake itself, then
writes the marker, then prints, so a stop between them repeats a notice rather
than losing it. Both the timeout and the refusal paths share this order.

* no-mistakes(ci): Made the outer check timeout durably enqueue its PR-registration scan-cut reason, so an interrupted candidate scan is not only printed. Verified `bash -n bin/fm-watch.sh` and `git diff --check`

* no-mistakes(ci): Fixed duplicate PR-registration timeout wakes by distinguishing the watcher’s outer check cut from scan-generated notices; outer-cut wake append failures now fail the watcher. Added a watcher regression test. `bash -n` and `git diff --check` passed; the security suite passed 43 tests before the 300-second timeout, prior to reaching the new test

* no-mistakes(ci): The requested fix is already present in HEAD: the test captures `real_sed` before invoking the watcher and embeds that path in the fake. `bash -n` and `git diff --check` passed. The full security test script timed out after 60 seconds, before reaching this regression test

* fix(bin): gate the ledger PR replacement behind config/pr-register-scan

Without the opt-in, pr_for_task keeps main's behavior: a recorded pr= always
stands and only a GitHub-shaped ready line fills in a missing one. With
config/pr-register-scan present, a newer ready line can replace a recorded
PR the status log named and any recognized forge URL is accepted.

* no-mistakes(test): Enable PR-provenance test scan opt-in; later bounded-scan test remains flaky

* no-mistakes(test): Restore flag-absent PR provenance coverage

* no-mistakes(ci): Added a retirement/merge-notice recheck under the task metadata lock immediately before replacement, plus a regression test for a merge notice arriving during candidate registration. Targeted security suite timed out after 300 seconds before reaching that test

* fix(pr-check): hold the merge-notification lock across a scan replacement

The scan's recheck of a recorded PR's merge record and its replacement pr=
write now run under the task's existing merge-notification lock, the lock
fm_merge_outcome_report holds while it records a merge, so a replacement can
never interleave with recording the merge of the PR it replaces. The merge
path itself is unchanged: taking the task meta lock there instead would
deadlock a re-arm made during the notice write.

* no-mistakes(document): Document opt-in PR registration scan behavior

* no-mistakes(ci): Exported `STATE` in the merge-race test subprocess so ShellCheck recognizes the state path consumed by sourced helpers. `shellcheck -x tests/fm-pr-check-security.test.sh` and `git diff --check` pass. Full suite is downstream of the failed lint lane; targeted security suite timed out after 300s, after 27 tests passed

* no-mistakes(ci): Fixed scan replacement commit-time eligibility: under the existing metadata and merge-notification locks, the newest status must still report the captured URL as ready. Added a deterministic regression test that waits for the slow pull/8 forge read, withdraws readiness, then checks pull/7 metadata and poll remain unchanged. ShellCheck, bash syntax checks, and git diff check pass. The targeted security suite passed 27 tests but exceeded the 300-second limit before reaching this regression test

* no-mistakes(ci): Fixed the backup invariant: before rewriting metadata, scan replacements now use the existing baseline backup/restore path even when degraded watching is disabled. Added a public scan-interface regression test asserting PR A and its poll survive a failed publication. Shell syntax checks passed; `FM_LIVE=0 bash tests/fm-pr-check-security.test.sh` exceeded 300 seconds before reaching the new test

* no-mistakes(ci): Applied the baseline initialization fix and repaired the failed-replacement regression test. `git diff --check` passed. Security suite timed out after 900s; inactive-reconcile suite failed at the bounded-scan resume assertion, outside the changed code

* no-mistakes(document): Document PR registration scan behavior
* feat(pr-merge): opt-in squash commit text from the PR summary

With the config/pr-squash-summary presence flag, a GitHub squash merge
whose caller passed no subject or body uses the PR title plus (#N) as
the subject and the PR body's ## What Changed section as the body, so
the commit on the base branch describes the change instead of listing
every branch commit. A missing or empty section, an unreadable PR, a
merge or rebase method, caller-supplied commit text (including -t, -b,
and -F after --), and GitLab and Forgejo merges keep the repository's
own squash text.

Opt-in: the behaviour is off by default. Without the flag the merge
reads no PR text and sends exactly today's command; with it, the PR's
summary overrides the repository's squash commit message setting. The
head-match, attestation, and waiver guards are unchanged.

* fix(pr-merge): ignore headings inside fenced code in the squash summary

what_changed_section now tracks fenced code blocks (``` and ~~~,
closed only by a run of the same character at least as long), so a
"## " line inside a fence neither ends the What Changed section nor is
selected as a fenced "## What Changed". Regression tests cover both.

* fix(pr-merge): treat a backtick run holding a backtick as inline code

A backtick-opened fence is valid only when its info string contains no
backtick (CommonMark), so a line such as three backticks, text, three
backticks is inline code. fence_run no longer opens a fence on it, so it
neither swallows later headings and the appendix inside What Changed nor
hides the real section before it. Tilde fences keep no such restriction.
Capture the real explicit-close focus synchronously in Part C so the defective-release assertion does not depend on background sampling. Preserve final exact-focus and focus-preserving-release assertions.

Fixes kunchenguid#8004
* feat(bin): report and archive orphan task records

* no-mistakes(test): Dropped unsupported backlog list field; focused bootstrap test timed out

* no-mistakes(document): Document session-start record hygiene

* no-mistakes(review): Skip symlinked metadata during hygiene scans

* no-mistakes(review): Skip symlinked metadata and report missing endpoints

* no-mistakes(document): Document record hygiene reporting and archival

* no-mistakes(ci): Not complete: applied the platform-aware mtime and duplicate-PR separator fixes, and switched endpoint classification to `fm_backend_target_exists` so failed probes are not treated as confirmed absence. The approved backlog/endpoint read timeouts and behavioral regressions are still missing; verification was not run. Invariant: only confirmed old orphan logs are archived, and duplicate PRs remain detectable across intervening records. The same invariant applies across every status-log and metadata record in the report; endpoint reporting must distinguish missing from unreadable for every supported backend

* fix: bound record hygiene reads

* no-mistakes(ci): Updated record-hygiene endpoint reads to use the shared metadata readers and added behavioral coverage for implicit-tmux and Orca terminal targets. The hygiene tests passed; the full bootstrap test script timed out after other tests continued passing. `git diff --check` passed

* no-mistakes(test): Shared record hygiene reporting with deduplicated heartbeat alerts

* no-mistakes(test): Initialize watcher data path for heartbeat hygiene reporting

* no-mistakes(document): Document heartbeat hygiene reporting and archive behavior

* no-mistakes(lint): Fix ShellCheck directive in hygiene library

* no-mistakes(ci): Fixed the Orca fake’s argument checks and asserted that a healthy Orca endpoint produces no warning. Heartbeat hygiene scans now run in a bounded background child; completed reports are queued as `check:` wakes before the deduplication marker is saved, preserving retry on delivery failure. `bash -n` and `git diff --check` passed; the first four hygiene tests passed. The full bootstrap test run exceeded its time limit, so the heartbeat delivery path remains unverified locally

* no-mistakes(ci): Fixed stale-marker recovery in `bin/fm-watch.sh`: the marker now records the worker PID and process start time, and is reclaimed if the worker is gone, its start time changed, or the marker exceeds 3× the report timeout. Added a watcher behavioral test for a stale marker. `bash -n` and `git diff --check` passed; the bootstrap test suite passed the hygiene tests, then exceeded its 120-second limit later in the suite. The review-thread reply and resolution are outside this CI phase

* no-mistakes(test): Bounded stale-marker test passes; 20-run validation timed out

* fix(watcher): reset hygiene suppression after clean scan

* no-mistakes(document): Document record hygiene reporting and archival

* no-mistakes(ci): Invariant: the remote secondmate parent-reply channel must be excluded from both stale-orphan reporting and archival. The shared status-file loop now skips the path returned by status_scan_parent_channel_exclude; other status paths are unchanged. Added a behavioral regression with an old channel file in a remote-secondmate-style home. Verified with tests/fm-parent-channel-scan-exclusion.test.sh and git diff --check

* test: exercise record hygiene report directly

* no-mistakes(review): Report missing tabs and preserve complete backlog IDs

* no-mistakes(review): Fix worker identity and top-level backlog record matching

* no-mistakes(review): Fix shell continuation in hygiene regression

* no-mistakes(review): Remove out-of-scope endpoint probing

* no-mistakes(review): Align architecture docs with hygiene report scope

* test: cover record hygiene archival of the parent channel

Keep the report-only run and add a mutating run that archives a genuine
orphan status log while asserting the remote parent-replies channel stays
in place. Source the backlog transition library the report uses, and give
the stale-marker watcher test a 30s cap so heavy host load cannot expire
it before the first heartbeat.

* fix(bin): add shellcheck source directives for record hygiene lib

* docs(skills): add record hygiene response to bootstrap diagnostics

* no-mistakes(test): Advance hygiene marker only after wake succeeds

* no-mistakes(test): Restore heartbeat report suppression marker before wake; heartbeat lab unverified

* feat(bin): make record hygiene report opt-in via config/record-hygiene

The session-start record-hygiene report, its orphan status-log archiving,
and the watcher heartbeat scan now run only when the home-local
config/record-hygiene presence flag exists. Without it, session start and
the heartbeat behave as before the feature: no report, no file moves, and
no record reads for it.

* no-mistakes(document): Clarify opt-in hygiene documentation

* fix(bin): start archive retention when record hygiene archives an orphan

The record-hygiene archive moved an orphan status log with mv, which keeps
its old modification time. With config/status-archive also enabled, the
next teardown's 30-day prune deleted an already-old orphan right after it
was archived. Touch the archived file so retention counts from archive
time, and cover the combined case with a teardown test.

* no-mistakes(review): Report archived-log timestamp refresh failures

* no-mistakes(ci): Fixed orphan archival to take the per-task metadata lock non-blockingly, recheck metadata/file/mtime under lock, and release the lock on all archive paths. Added coverage for held-lock skipping and lock cleanup. `tests/fm-bootstrap.test.sh` passed the hygiene cases but emitted a stray `\: command not found` from the newly added continuation (corrected); the full script later timed out at 120s, so rerun verification

* fix: lint the wake-lib source and tighten record-hygiene lock tests

Point ShellCheck at bin/fm-wake-lib.sh for the archive path's lazy source, run the held-lock test with record hygiene enabled and assert the scan still reports the orphan, check the real fm_meta_lock_path cleanup path, and cover a spawn publishing metadata between the absence check and the move.

* no-mistakes(ci): Fixed the previously accepted archive-retention invariant: if refreshing an orphan log’s archive mtime fails, the code attempts to restore it to live state and reports the failure. `tests/fm-bootstrap.test.sh` and `tests/fm-parent-channel-scan-exclusion.test.sh` pass; `git diff --check` passes. The provided CI excerpt omits the actual failed test’s diagnostic, so it does not establish that this change caused the shard failure; the Full suite failure shown is downstream of a failed lane

* Revert "no-mistakes(ci): restore orphan log when archive touch fails" and fix SC2153

Revert 89f9229, an unrequested CI auto-repair that changed archive behavior without a regression test.

Mark DATA as set by the sourcing script on its first use in the archive path: following bin/fm-wake-lib.sh through the source directive made ShellCheck raise SC2153 there.
)

* fix: give suspended extension deadlines one bounded grace

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

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

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

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

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

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

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

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

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

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

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

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

Refs kunchenguid#7938

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

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

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

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

Refs kunchenguid#7938

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Preserve PR poll authentication on relaunch

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

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

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

Refs kunchenguid#7938

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

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

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

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

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

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

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

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

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

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

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

Refs kunchenguid#7938

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

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

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

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

Refs kunchenguid#7938

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Preserve PR poll authentication on relaunch

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

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

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

Refs kunchenguid#7938

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

---------

Co-authored-by: Ian Brown <[email protected]>
* feat(bootstrap): report orphan treehouse pools

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

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

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

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

* fix(bootstrap): parse offset pool timestamps

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

* fix(bootstrap): recognize durable pool leases

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

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

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

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

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

* perf(bootstrap): avoid repeated pool index parsing

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

* Declare pool report clock local

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

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

* Identify duplicate Treehouse pools by origin

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

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

* test: remove unused bootstrap pool local

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

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

* fix: recover stale real-directory lock records

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Closes kunchenguid#8388
…nguid#8422)

* Settle declared captain holds from terminal PR evidence

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

Fixes kunchenguid#8368

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

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

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

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

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

* no-mistakes(ci): Both selected Greptile findings are fixed in the worktree; nothing is committed. Invariants and sites: - ci-2: the contribution poll must never wait on a lock longer than the watcher's 30-second check bound. `settle-pr` takes two locks. The away-record lock was already bounded to 1 second. The task control lock was the only unbounded site, so `command_settle_pr` in bin/fm-captain-hold.sh now takes it with `fm_lock_acquire_wait_bounded ... 1` and returns 0 silently when busy. The policy file stays, so a later poll retries. The other callers of `acquire_task_control_lock` are captain or firstmate commands, not the poll, and are unchanged. - ci-3: a `closed` event and wake go only to a task that is an open captain hold at the moment the event is raised. `terminal_hold_event` in bin/fm-contributions.sh is the single place that raises it (the settled, final and live paths all call it). It now runs `fm-captain-hold.sh open <task>` after the cheap snapshot filter and before `write_record`, so only rows about to raise an event pay for the process. Tests added to tests/fm-contributions.test.sh: - `test_forge_settlement_defers_while_the_task_is_busy`: a held control lock makes the poll and a direct `settle-pr` return 0 with no output inside the bound, keep the policy and the hold, then settle once the lock is free. - `test_settled_task_gets_no_closed_event_for_its_other_pr`: one task with two closed PRs, the first settles the hold, the second raises no poll line, wake or `closed` event. I confirmed it fails without the bin/fm-contributions.sh fix (`not ok - the second closed PR woke a task settled in the same poll`) and passes with it. - The lock-holder fixture of the existing away-record-lock test became a shared `hold_lock` helper. docs/captain-hold-lifecycle.md gained one sentence on the busy-task deferral and an updated test list. Verification: `nice -n 10 bash bin/fm-test-run.sh tests/fm-contributions.test.sh` exited 0 (`FM_TEST_SUMMARY total=1 failed=0`, about 335 seconds). No other suite was run, as instructed. ci-1 (Full suite) remains a recorded CI override: it is only the full-ci label gate, no code or workflow was changed for it, and the hosted full suite did not pass. Not checked and risks: - The busy-lock test was not run against the old code, because the old unbounded wait would hang the test instead of failing it. - When a busy control lock defers settlement of a closed PR, the policy file remains, so that poll still raises the `closed` event and wake for the still-held task. That matches the existing away-deferral behaviour and was left unchanged. - Shellcheck was not run
…ixed 3 root causes in 4 files and verified each one locally. - **Test coverage guard, and tests/fm-test-run.test.sh (parallel 2), which runs the same guard.** - Invariant: no more than 15% of portable serial scripts may lack a duration hint. - Cause: the merge brought in 2 upstream tests with no hint, `fm-remote-inherit-generation` and `fm-supervision-host-herdr-live-e2e`. That moved the count from 44 to 46 out of 306, which is just over 15%. - Fix: added serial hints in `bin/fm-test-run.sh` for both: 3436 ms and 132 ms. These are their passing Ubuntu `FM_TEST_END` timings from this PR's own CI run, 43525853047. - Recorded where the numbers came from in `docs/fm-test-portable-shards.md`. - The guard now reports ok: 44 scripts without a hint, and the largest shard is 1198585 ms against a 1200000 ms budget. - **Serial 8: tests/fm-lane-capacity-integration.test.sh.** - Invariant: every brief for a fresh spawn must have a `# Required skills` section. This is the fork's gate from #26. - Cause: this test is new from upstream, and its `write_brief` fixture had no such section, so `fm-spawn` refused with exit 1. - Fix: added `# Required skills` with `- tdd` to the fixture, the same way `tests/fm-project-capacity.test.sh` does. The one other place this test writes a brief already gets the fix, because it goes through `write_brief`. - **Serial 1: tests/fm-gotmp.test.sh, "teardown exited non-zero".** - Invariant: each fake root's `bin/` must hold every lib that teardown sources. - Cause: the fork's `fm-dod-lib.sh` sources the fork-only `fm-task-branch-lib.sh`, and teardown also reaches the `fm-supervision-engine-lib.sh` lazy source in `fm-lease-lib.sh`. Neither file was linked into the upstream test's fake roots. - Fix: added symlinks for both libs in both fake-root builders in that file. - Other tests that use `fm-dod-lib` source it from the real `bin/` and passed in CI. - **Full suite** was only the roll-up of the failed jobs. Verification, run locally: - `bin/fm-test-run.sh --check-coverage`: ok. - `tests/fm-test-run.test.sh`, `tests/fm-gotmp.test.sh` and `tests/fm-lane-capacity-integration.test.sh`: all pass. Both of the last two failed before the fix. - shellcheck and `git diff --check`: clean
@demy00
demy00 merged commit c2d971a into main Nov 14, 2026
45 of 47 checks passed
demy00 added a commit that referenced this pull request Nov 23, 2026
chore: record upstream ancestry of the #27 sync
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.