Skip to content

chore: sync fork with upstream kunchenguid/firstmate through 427056c4 - #16

Merged
andrew-codes merged 25 commits into
mainfrom
fm/fm-fork-upstream-sync2
Nov 15, 2026
Merged

andrew-codes merged 25 commits into
mainfrom
fm/fm-fork-upstream-sync2

Conversation

@andrew-codes

@andrew-codes andrew-codes commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Intent

Update the fork (andrew-codes/firstmate) against upstream kunchenguid/firstmate and resolve conflicts. The fork is currently synced through upstream commit 913bb7a (tag upstream-synced); upstream HEAD is now 427056c or later. The fork carries Bitbucket Cloud support and other fork-only features listed in FORK.md, and these must keep working after the merge.

What Changed

  • Merged upstream kunchenguid/firstmate (previously synced through 913bb7a7) into the fork. This brings in the new bin/fm-park.sh and its test, bin/fm-record-hygiene-lib.sh, bin/fm-omp-process-lib.sh and bin/fm-extension-deadline.mjs. It also updates the PR check/merge, captain-hold, bootstrap, fleet snapshot, wake and watcher, teardown and DoD scripts, along with the matching skills and docs.
  • Resolved conflicts so the fork-only features listed in FORK.md (including Bitbucket Cloud support) are kept. FORK.md gets a one-line update.
  • Test suites changed with the merge: fm-park, fm-pr-check-security, fm-watcher-lock, fm-contributions, fm-bootstrap, fm-dod-lib, fm-teardown and fm-watch-triage-pause. This also adds a Claude tool-exclude live test and two Grok 1.0.77 terminal fixtures.

Bitbucket gaps

Merges upstream kunchenguid/firstmate 913bb7a..427056c (23 commits) into the fork, keeping the merge commit. Two of the new upstream features are not covered by the fork's Bitbucket Cloud support yet, so each has its own issue:

The other 21 commits need no Bitbucket work.

Risk Assessment

⚠️ Medium: The change is a large upstream merge (about 107 files, +8.4k lines) with only five conflicted files, and the hand-resolved hunks I read keep the fork's Bitbucket thread tracking, Jira reconcile hook and FORK.md pin alongside upstream's hold-settle and record-hygiene code. I did not read the rest of the upstream-originated files line by line, so residual risk stays at medium.

Testing

I ran the three Bitbucket and fork-feature test scripts and they all passed with no failures. I also confirmed upstream 427056c is an ancestor of HEAD and found no leftover conflict markers. I did not run the full suite, and I did not start a Herdr or tmux lab, since the check was limited to the fork-only Bitbucket behaviour.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Bitbucket Cloud PR URL parsing and tracking run via tests/fm-pr-bitbucket.test.sh ✅ pass live tests/fm-pr-bitbucket.test.sh exited 0 with 0 'not ok' lines
Unanswered Bitbucket review comments and PR alerts run via tests/fm-contributions-bitbucket.test.sh ✅ pass live tests/fm-contributions-bitbucket.test.sh exited 0 with 0 'not ok' lines
Merged tree has no conflict markers and contains upstream 427056c ✅ pass live git grep found no conflict markers; git merge-base --is-ancestor 427056c4 HEAD succeeded
Fork-free helpers still behave after the merge ✅ pass live tests/fm-fork-free-helpers.test.sh ran to FM_TEST_COMPLETE

Pipeline

Updates from git push no-mistakes

Run outcome: ✅ pipeline passed on c11e6830.

✅ **Intent** - passed

✅ No issues found.

⏭️ **Rebase** - skipped

Step was skipped.

⚠️ **Review** - medium risk

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Bitbucket Cloud PR URL parsing and tracking run via tests/fm-pr-bitbucket.test.sh ✅ pass live tests/fm-pr-bitbucket.test.sh exited 0 with 0 'not ok' lines
Unanswered Bitbucket review comments and PR alerts run via tests/fm-contributions-bitbucket.test.sh ✅ pass live tests/fm-contributions-bitbucket.test.sh exited 0 with 0 'not ok' lines
Merged tree has no conflict markers and contains upstream 427056c ✅ pass live git grep found no conflict markers; git merge-base --is-ancestor 427056c4 HEAD succeeded
Fork-free helpers still behave after the merge ✅ pass live tests/fm-fork-free-helpers.test.sh ran to FM_TEST_COMPLETE
  • bash tests/fm-pr-bitbucket.test.sh
  • bash tests/fm-contributions-bitbucket.test.sh
  • bash tests/fm-fork-free-helpers.test.sh
  • git merge-base --is-ancestor 427056c4 HEAD
  • git grep for conflict markers
✅ **Document** - passed

✅ No issues found.

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

✅ No issues found.

kunchenguid and others added 25 commits November 10, 2026 17:08
…unchenguid#8318)

* fix: clear per-task away-session markers at return and fresh entry

The five .subsuper per-task families (stale, reported-stale, dialog,
paused, pause-until-due) were episode state with no session scope: a
first-seen-idle clock left behind when a session ended inside the 240s
recheck window was read by the next away session's first housekeeping
pass as its own, reporting a "stale persisted Ns (possible wedge)"
whose duration never happened.

fm_afk_clear_stale_artifacts now drops all five families with the
delivery artifacts on a fresh entry, and fm_afk_launch_stop drops them
at the return. The launch backup/rollback lists cover the same set so a
failed entry still restores prior state. Accepted cost, recorded on the
cleanup's header: a declared wait spanning two away sessions restarts
its recheck window at re-entry.

* no-mistakes(document): Correct away-session lifecycle documentation

* no-mistakes(ci): Initialized pendingBashComponents in the shared Pi test host, fixing the CI renderer crash. Full suite failure was downstream of that lane. Focused behavioral checks, shell syntax, and diff checks pass locally; the newer CI Pi version was not available locally
kunchenguid#8322)

* fix: surface herdr lab server failures and refuse over-long socket paths

The lab helper discarded the herdr server's output and waited the full timeout even after the server exited, so a startup failure such as a socket path over the sun_path limit looked like a plain timeout.

Provision now keeps the server output in a log in the helper state directory, stops waiting as soon as the server process exits, and prints the log tail in the failure message.
Name and prepare now refuse a session whose client socket path would exceed the 103-byte sun_path limit, naming the limit.

* fix: count socket path bytes, check it in provision, and use the documented config default

The sun_path limit is a byte limit, so the length is now counted under the C locale.
Provision runs the check up front so the reuse path is covered.
The config root default is the documented ~/.config/herdr, and an early server exit rechecks status once before failing.

* no-mistakes(review): Cap server log at 64 KiB; drop config-dir override

* no-mistakes(ci): I fixed both Greptile findings in `bin/fm-herdr-lab.sh`. I ran `tests/fm-herdr-lab.test.sh` and every test passed, including the new ones. I did not check that the new pipe-capture test fails against the old collector. **ci-1 (captured provision can hang).** - Invariant: the log collector must never hold the caller's stdout or stderr open. - The collector now runs as `{ head -c "$cap" > "$server_log"; cat; } >/dev/null 2>&1`. The server pid stays in `$!`. - The log cap is 4096 bytes. One shared value, `fm_herdr_lab_server_log_cap`, now sets both the stored log size and the tail shown in the failure message. - I added `test_captured_provision_returns_promptly`, which captures provision's output through a command-substitution pipe and checks it returns promptly. - I updated the cap test to 4096 bytes and the header comment to match. **ci-2 (XDG_CONFIG_HOME ignored).** - Invariant: the socket-length check must use the same config root herdr resolves. - `fm_herdr_lab_config_dir` now returns `$XDG_CONFIG_HOME/herdr` when `XDG_CONFIG_HOME` is set, and `$HOME/.config/herdr` otherwise. `name`, `prepare` and `provision` all go through `fm_herdr_lab_check_socket_path`, so one change covers all three. - I added tests for a long `HOME` with a short `XDG_CONFIG_HOME` (accepted) and a short `HOME` with a long `XDG_CONFIG_HOME` (refused). - The test file now unsets `XDG_CONFIG_HOME` at the top so the other tests don't depend on the CI environment. - I updated the header comment to match

* test: keep the fake server alive so the captured-output test proves the fix

The fake server exited right after reporting running, so the captured-output test passed without the fix.
It now stays alive and is cleaned up afterwards, and the test fails on the old redirection.
The collector now redirects with exec in a subshell, because a group redirect leaves saved copies of the caller's pipe open.
…claim (kunchenguid#8334)

Claude Code delivers an asyncRewake hook's exit-2 rewake to the session
that launched the hook. When Claude continues a conversation under a new
session id - a backgrounded session resumes with --fork-session under the
same lock-holding front end - the Stop auto-arm firing claimed before the
fork stays alive, descended from the session-lock pid, and open, so every
Stop of the continued session deferred to it, and its eventual rewake was
queued into the abandoned session while the live one stayed idle.

Record the Stop payload's session_id in the generation claim and treat an
arming claim recorded under another session as not open for that firing.
The continued session's next Stop takes the next generation and translates
its own close, and the earlier firing goes silent as any superseded owner
does. A firing from the claim's own session still defers, and claims,
payloads, and guard checks without a session id keep the previous behavior.
…guid#8223)

* feat: let Claude workers hide tools listed in config/crew-exclude-tools

A Claude ship or scout launch now honors a non-empty exclusion list by
passing --disallowedTools, which drops each tool's schema from every model
request. The list still refuses on runtimes that cannot hide tools, and a
token-free live guard checks the installed Claude Code removes the schema.

* no-mistakes(review): skip live Claude guard when no request captured

* no-mistakes(document): Fixed one stale measurement claim in docs/verification/runtime-backends.md: the repeat-consistency sentence contradicted the table's two differing request-byte rows. Reworded it to match. Other exclusion docs (configuration.md runtime table, fm-spawn.sh and fm-exclude-tools-lib.sh comments and refusal text) already reflect Claude support. bin/fm-doc-audience-check.sh passes (141 surfaces, 1193 local links).

* fix: isolate the Claude exclusion live guard from real providers

Run the guard's claude launches in a clean environment with a private
config directory and a synthetic API key so they can only reach the local
capture server, map the capture fixture to the guard for --changed
selection, and run fm_test_cleanup from the guard's EXIT trap.

* no-mistakes(document): Point Claude exclusion trimming note to Validation owner

* no-mistakes(document): Align Claude exclusion docs with validation behavior
…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 <742554+zestysoft@users.noreply.github.com>
* feat(bootstrap): report orphan treehouse pools

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

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

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

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

* fix(bootstrap): parse offset pool timestamps

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

* fix(bootstrap): recognize durable pool leases

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

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

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

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

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

* perf(bootstrap): avoid repeated pool index parsing

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

* Declare pool report clock local

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

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

* Identify duplicate Treehouse pools by origin

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

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

* test: remove unused bootstrap pool local

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

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

* fix: recover stale real-directory lock records

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Closes kunchenguid#8388
…nguid#8422)

* Settle declared captain holds from terminal PR evidence

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

Fixes kunchenguid#8368

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

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

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

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

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

* no-mistakes(ci): Both selected Greptile findings are fixed in the worktree; nothing is committed. Invariants and sites: - ci-2: the contribution poll must never wait on a lock longer than the watcher's 30-second check bound. `settle-pr` takes two locks. The away-record lock was already bounded to 1 second. The task control lock was the only unbounded site, so `command_settle_pr` in bin/fm-captain-hold.sh now takes it with `fm_lock_acquire_wait_bounded ... 1` and returns 0 silently when busy. The policy file stays, so a later poll retries. The other callers of `acquire_task_control_lock` are captain or firstmate commands, not the poll, and are unchanged. - ci-3: a `closed` event and wake go only to a task that is an open captain hold at the moment the event is raised. `terminal_hold_event` in bin/fm-contributions.sh is the single place that raises it (the settled, final and live paths all call it). It now runs `fm-captain-hold.sh open <task>` after the cheap snapshot filter and before `write_record`, so only rows about to raise an event pay for the process. Tests added to tests/fm-contributions.test.sh: - `test_forge_settlement_defers_while_the_task_is_busy`: a held control lock makes the poll and a direct `settle-pr` return 0 with no output inside the bound, keep the policy and the hold, then settle once the lock is free. - `test_settled_task_gets_no_closed_event_for_its_other_pr`: one task with two closed PRs, the first settles the hold, the second raises no poll line, wake or `closed` event. I confirmed it fails without the bin/fm-contributions.sh fix (`not ok - the second closed PR woke a task settled in the same poll`) and passes with it. - The lock-holder fixture of the existing away-record-lock test became a shared `hold_lock` helper. docs/captain-hold-lifecycle.md gained one sentence on the busy-task deferral and an updated test list. Verification: `nice -n 10 bash bin/fm-test-run.sh tests/fm-contributions.test.sh` exited 0 (`FM_TEST_SUMMARY total=1 failed=0`, about 335 seconds). No other suite was run, as instructed. ci-1 (Full suite) remains a recorded CI override: it is only the full-ci label gate, no code or workflow was changed for it, and the hosted full suite did not pass. Not checked and risks: - The busy-lock test was not run against the old code, because the old unbounded wait would hang the test instead of failing it. - When a busy control lock defers settlement of a closed PR, the policy file remains, so that poll still raises the `closed` event and wake for the still-held task. That matches the existing away-deferral behaviour and was left unchanged. - Shellcheck was not run
@andrew-codes
andrew-codes merged commit 5a98e69 into main Nov 15, 2026
44 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.