Repository navigation
Merge upstream kunchenguid/firstmate main into the fork - #300
Merged
Merged
Conversation
… work (kunchenguid#7352) * feat(bin): add opt-in config/spawn-base-primary-checkout for local landings A fresh pooled task worktree is reset to origin/<default>. A local-only project lands work on the primary checkout's default branch through fm-merge-local.sh and never pushes, so that ref stays frozen at the last push and every fresh task starts behind work already landed, loading the project's instruction files from the stale tree. The always-on fix proposed in kunchenguid#3812 replaced the specified origin-only refresh for every home; this rework keeps that rule as the default and moves the new base behind an explicit, default-off presence flag, following the existing config/<flag> pattern. With config/spawn-base-primary-checkout present: - fm-spawn.sh starts a fresh local-only ship, or a scout without --base-branch, from the primary checkout's <default> when it strictly contains origin's tip. Publishing modes and named base branches keep origin's tip, because that work is delivered against origin. A diverged primary keeps origin's tip and prints a note counting both sides. The commit is read from the local object store, so nothing extra is fetched, and the clean-slot refusal still runs first. - fm-review-diff.sh anchors a remote-backed task without base_branch= on the branch it delivers to: publishing modes stay on origin/<default>, while a local-only ship or a scout is compared against whichever of the local <default> and origin/<default> meets the branch later, so the review shows the task's own work instead of every locally landed commit. - fm-promote.sh tells a scout promoted to a publishing mode to return to origin's default branch, because in this home the scout may have started from the primary checkout's branch, whose unpushed commits would otherwise be published with the work. fm-dod-lib.sh gains fm_mode_publishes as the one predicate those three readers share. Without the flag every path is unchanged: the spawn resets to origin's tip, the review anchors on origin/<default>, and promotion keeps its wording; the existing tests run unmodified. Treehouse 3 (verified on 3.1.3) already hands a slot out at whichever of the local and remote default branch is further ahead, so with the flag the refresh keeps that slot where Treehouse put it for a local landing instead of rewinding it, and a project without origin is untouched as before. Supersedes kunchenguid#3812. * no-mistakes(document): Drop change-relative wording from spawn-base config docs * no-mistakes(ci): The Greptile Review check failed on two review findings, not on a broken build or test. I fixed both as the user directed, and the tests and lint pass. ci-1 (bin/fm-promote.sh): promotion must name origin's default branch only when spawn could actually have started the scout from the primary checkout. Spawn does that only when the project has an origin remote and is recorded on the task. Before this fix, the opt-in flag alone made promotion to no-mistakes or direct-PR say "copy of origin's default branch...", even on a project with no origin. - The new wording now also requires a recorded project (`[ -n "$PROMOTE_PROJECT" ]`) whose `git remote get-url origin` succeeds. That is the same check bin/fm-review-diff.sh already makes. The empty-project guard is needed because `git -C ""` would run in the current directory. Otherwise the existing "default-branch base" wording stays. - The three places that read the flag now agree: spawn, review-diff and promote. - I updated the header and inline comments in fm-promote.sh, and the promote line in docs/configuration.md, to say this applies only to a project with an origin remote. - Test: `test_promote_names_origin_for_a_publishing_mode_in_an_opted_in_home` in tests/fm-task-delivery.test.sh now records a real `project=` with a registry entry, and covers flag on/off × origin/none × direct-PR/no-mistakes/local-only. Only flag on + origin + a publishing mode gets the new wording. The named-base case is unchanged. - Before the fix, the test fails with "not ok - flag on, remote none, direct-PR: the promotion changed the default-branch wording". With the fix, it passes. ci-2 (tests/fm-spawn-pool-base-freshen.test.sh): with the flag set, both publishing modes must start from origin's tip and print no divergence note. - The opted-in spawn test now covers no-mistakes as well as direct-PR, local-only and scout. - The expectations no longer single out direct-PR. Both publishing modes now expect origin's tip, no "note: pooled worktree", and a review anchored at the slot's start, in the leading, diverged and trailing cases. Verification: - `bash tests/fm-task-delivery.test.sh`: exit 0. - `bash tests/fm-spawn-pool-base-freshen.test.sh`: exit 0. - `bin/fm-lint.sh` on the three changed shell files: exit 0 (ShellCheck 0.11.0, pinned, with extended analysis)
…enguid#7915) * fix(teardown): distinguish unavailable content-landed proof * no-mistakes(document): Clarify teardown proof failure documentation * no-mistakes(ci): Captain, CI failed in unchanged watcher recovery code, independent of this PR. The focused failing case passed locally with exit 0. The full suite stalled earlier and was stopped. No tracked changes. Command guard rejected cleanup; scratch remains at .ci-7915/ and tests/.ci-7915-cycle.sh * chore: untrack CI validation scratch
…kunchenguid#7876) * feat(dispatch): prefer configured provider family * no-mistakes(review): drop policy_why field and dead auth fixture from preference tests * no-mistakes(document): docs: record preferred_provider in schema, diagnostics, verification
) * fix: pin local-only landing to its accepted done head Persist the accepted local-only commit in task metadata and refuse landing when the branch or the recorded head changes. Merge the full commit ID under the task control and metadata locks. Closes kunchenguid#7782 * no-mistakes(test): Refuse local landing races with atomic ref transactions * no-mistakes(document): Document pinned local landing and recovery contracts * no-mistakes(ci): Applied only the verified incremental patch and preserved existing repairs. Complete diff matches the supplied candidate hash. Both focused test files, default lint, and source-aware lint passed with exit 0. Evidence retained at /tmp/up7782-local-repair/ci-phase-fresh-*. No commits, pushes, or pipeline-control actions performed; publication remains with the outer executor * no-mistakes(ci): Fixed both SC2031 false positives in tests/fm-merge-local.test.sh with narrowly scoped suppressions. Tier 2 lint correction; runtime changes were unnecessary. Default lint, source-aware lint, all 8 focused tests, and git diff --check passed. No commits, pushes, or pipeline-control actions performed
…henguid#7928) * fix(procevent): coalesce unhandled extension host errors * no-mistakes(document): Document host-error coalescing and recovery semantics
…uid#7912) * fix: stop wake grants when lock acquisition fails * no-mistakes(document): Document wake grant lock acquisition failure behavior
* fix: send remote steers over stdin * fix: version remote stdin send protocol * no-mistakes(document): document stdin transport for remote steer in fm-send header * no-mistakes(ci): Two tests failed in CI. One is caused by this PR; the other is not. 1. Behavior portable serial 5: `tests/fm-secondmate-reconcile.test.sh` failed with "supervision did not deliver the durable reconcile request later". This PR caused it. The PR now sends a remote steer's body on stdin, using `fm-on.sh --stdin` with the `send-stdin` verb. This test's fake ssh started with `cat > /dev/null`, so it threw the body away before it ran the real `fm-remote-secondmate-control.sh`. `cmd_send_stdin` then read an empty message, died with "remote steer message must be nonempty", and no inbox record was written. Rule that broke: a fake ssh that runs the real remote leg must pass the caller's stdin through, as real ssh does. I checked every fake ssh that runs the real leg. `fm-send-remote-delivery.test.sh` already passes stdin through. `fm-secondmate-sync.test.sh` (`make_remote_leg_ssh_stub`) had the same discard line. The stub in `fm-send-resolve-key.test.sh` never runs the leg, so it is fine. The fix deletes the `cat > /dev/null` line in the reconcile and sync stubs. Calls made without `--stdin` still get /dev/null from fm-on, so nothing else changes. Checks run locally: the reconcile test fails before the fix with the same CI message. After the fix, the reconcile test passes (rc=0) and the sync test passes (rc=0). 2. Behavior portable serial 3: `tests/fm-wake-queue.test.sh` failed in `test_concurrent_append_and_drain` with "wake drain: queue lock could not be acquired safely". This PR did not cause it. The PR does not touch `bin/fm-wake-drain.sh`, the wake tests or the wake helpers. The failure is lock contention: 40 appenders run at the same time as a drain, on a loaded CI runner. Locally the whole test passed (70 ok, rc=0). I made no change for it. It is an existing flake in wake-queue lock acquisition and needs its own fix outside this PR. Open PR kunchenguid#7912 ("preserve wake grants when queue-lock acquisition fails") works in the same area
…owner manages (kunchenguid#7357) * fix(herdr): never start a server an external owner manages or is replacing fm_backend_herdr_server_ensure started a detached herdr server whenever status reported the session not running. When a service manager owns the server, that races a unit restart or a server live-handoff and splits panes across two servers. The session directory reported by herdr session list can now carry a firstmate-server-owner marker (persistent, naming the owner) and a firstmate-server-replacing marker (for the duration of a restart or handoff). While either exists and the server is not running, server_ensure never starts a server: it waits a bounded time (FM_BACKEND_HERDR_EXTERNAL_SERVER_POLLS, default 30s) for the server to report running, and otherwise fails naming the owner or the replacement. A running server is still used at once, and a session with no marker keeps the Firstmate-owned autostart unchanged. Fixes kunchenguid#7320 * no-mistakes(review): Enforce herdr replacement marker on fast path; fixed wait bound * no-mistakes(ci): Both CI failures had one cause in this PR, and I fixed it in code; no test assertions changed. `fm_backend_herdr_server_ensure` had started running `herdr session list --json` on every call to find the session directory for the ownership markers. Two existing tests treat that call as a sign of something else: - `tests/fm-control-relaunch.test.sh` failed with "a herdr reclaim touched a session the record does not name: session list --json", because it allows only `--session fmlab` calls and `status --json`. - `tests/fm-backend-herdr-presentation-e2e.test.sh` failed with "opted-out spawn added presentation-ordering capability or socket calls", because there `session list` means presentation ordering ran. Invariant: `server_ensure` must not make Herdr calls beyond its own `status` read, so ordinary spawns and reclaims stay free of `session list` and only touch the session they name. Every caller goes through `server_ensure`, so fixing it there covers all of them. Fix (`bin/backends/herdr.sh`): the session directory now comes from the `status --json` read `server_ensure` already makes. It is the directory containing `.server.socket`. I removed the `fm_backend_herdr_session_dir` helper. On a running server, the only added work is one check for the replacement marker, which is what the user asked for. I checked this against real Herdr 0.9.5: - `status` reports the socket even when the server is stopped, for both the default and named sessions. - The socket's directory is the same `session_dir` that `session list` reports, and it follows `XDG_CONFIG_HOME`. - With `--session`, an inherited `HERDR_SOCKET_PATH` does not change it. - The read creates nothing on disk. If a Herdr version omits the socket, `server_ensure` keeps the old Firstmate-owned behavior, as the docs already said for a missing `session_dir`. Other changes: the marker-test fakes now report the socket under the session directory, and I removed the `session list` stub this PR had added to the shared fake. `docs/herdr-backend.md` and `docs/verification/runtime-backends.md` ("Session directory") now describe and record the `status`-socket measurement. Verification: - `tests/fm-backend-herdr.test.sh` passes: 239 ok, 0 not ok, including all the externally-managed and replacement-marker tests. - `tests/fm-control-relaunch.test.sh` passes; it was the shard 3 failure. - shellcheck shows only existing info-level notes. Not verified locally: the real-Herdr presentation test. Here it stopped earlier, at an unrelated Treehouse timeout ("treehouse get did not enter an isolated worktree within 60s"). After the fix `server_ensure` no longer runs `session list`, which is the call that assertion caught. No lab session was left running, and I removed the test's temp directory
…mputes (kunchenguid#7931) * fix(bin): reclaim a lock whose recorded pid-identity no longer recomputes kunchenguid#7886 made fm_lock_holder_alive reject a live pid whose start time no longer matches the lock's recorded pid-start. A holder that predates that record still falls back to pid liveness, which leaves issue kunchenguid#7801 open: on a /proc-less host outside UTC, a watcher started before fm_pid_identity pinned TZ=UTC0 recorded a local-time pid-identity. After the update that live holder no longer matches its own identity, so the health predicate rejects it, yet every new watcher stands down beside it and the home stays unsupervised. fm_lock_holder_alive now also requires a recorded pid-identity, when present, to still recompute for the pid, after the existing start-time check and with the same missing-evidence fallbacks: no record, a pid rewritten mid-read, or an unreadable value keeps the pid-liveness answer. Both records go through one helper, _fm_lock_record_matches. Only long-lived holders that never exec write a pid-identity (the watcher, the supervise daemon), so a genuine holder still matches. A watcher replaced this way stands down unsignalled at its next poll through the existing self-eviction. The fm_pid_identity comment and docs/turnend-guard.md claimed the upgrade-window residual is cleared by the post-update restart, which never reaches a primary home's own watcher; they now say the next lock claim clears it. Verification: - Drove: real bin/fm-watch.sh processes with /proc hidden through FM_PROC_ROOT_OVERRIDE and TZ=America/Los_Angeles: a live genuine watcher whose lock record was rewritten to its own local-time ps lstart identity with no pid-start, as a pre-pin build wrote it, then a fresh watcher; plus fm_lock_try_acquire against a live pid with a mismatched, matching, and unrecorded pid-identity and no pid-start. - Observed: on the unchanged library the fresh watcher exits "lock held by live pid ... but heartbeat is stale" and fm_lock_try_acquire returns held for the mismatch. With this change the fresh watcher takes the lock, the legacy holder exits 0 by standing down, the live pid is never signalled, and matching or unrecorded identities stay held. - Re-check: tests/fm-watcher-lock.test.sh cases test_watch_replaces_live_holder_with_legacy_local_time_identity and test_lock_reclaims_holder_whose_identity_no_longer_recomputes. * no-mistakes(review): Limit pid-identity lock reclaim to the watch lock * no-mistakes(document): Correct fm_lock_holder_alive comment on non-watch identity locks * no-mistakes(ci): I made two small fixes. CI and "Require no-mistakes" never ran: GitHub shows both as `action_required`, waiting for approval to run workflows from a fork, so the code didn't cause those. Greptile failed because it scored the PR 4/5 against a required 5/5, with one P2 comment. 1. **Greptile P2, test children left running (`tests/fm-watcher-lock.test.sh`).** The two new lock tests start a `sleep 300` holder that only gets killed after every assertion passes, and the suite's cleanup only reaps processes whose command line contains the fixture root. Each holder now starts as `(exec -a "$dir/holder" sleep 300)`, so cleanup reaps it if the test fails early. To check, I forced a `fail` right after the child starts: on HEAD the `sleep 300` was still running afterwards, and with the fix it was reaped. Both tests pass normally. 2. **Flaky takeover test (`bin/fm-watch.sh`).** This edit was already uncommitted in the worktree. Twelve isolated runs passed without it, so I first dropped it as out of scope, but the full suite then failed on exactly this race. When a successor takes over a live watcher's lock, it deletes the lock and recreates it while holding `.watch.lock.steal`. If the old watcher checks during that gap, it sees no lock `pid` and exits as "state directory was torn down", not by standing down cleanly as the PR intends. That race only happens once this PR lets a healthy, live watcher's lock be taken. The guard treats a missing `pid` as teardown only when no `.steal` marker exists, with a comment explaining why. With it restored, 15 runs of the takeover test (three at a time, to add load) all passed, and all three PR tests passed in the full suite. **Remaining failures:** with the guard restored, I ran the full suite three times and it failed each time, but always on tests this change doesn't touch: "bounded child cleanup regression" twice and "bounded ledger cycle 2 did not start" once. The host's load average was about 100, and these tests depend on timing; one of them runs before any watcher starts. I didn't confirm they also fail on the base commit. shellcheck reports nothing in the test file beyond info notes about files it didn't follow, and one existing warning in `fm-watch.sh` at line 2598, not from this change. I deleted the leftover temporary runner `tests/.tmp-one.sh`. Nothing is committed or pushed * fix(bin): re-read the watch lock holder after the steal check The steal-gap guard read the lock pid, then the steal mutex. A successor that removed and relinked the lock between those reads let the old watcher see no pid and then no steal mutex, so it exited as "state directory was torn down" instead of standing down. Upstream CI hit this in tests/fm-watcher-lock.test.sh (test_watch_replaces_live_holder_with_legacy_local_time_identity). The teardown branch now re-reads the pid after the steal mutex. The steal mutex is held for the whole remove-and-relink, so a steal that finished between the first two reads has already relinked the lock by the third read, and the self-eviction below stands the watcher down. Verification: - Drove: the takeover test (real bin/fm-watch.sh processes) 48 times, six at a time, with and without this change, plus the whole tests/fm-watcher-lock.test.sh file. - Observed: the interleaving is too narrow to hit locally (48 of 48 passed either way); the whole file passes with this change. The failing CI run shows the old watcher's exit 1 teardown message. - Re-check: Behavior portable serial 6 on this PR's CI. * no-mistakes(review): Scope fm_pid_identity residual comment to the watch lock * no-mistakes(review): Align fm_pid_identity residual comment with autoarm reclaim behaviour * no-mistakes(document): Note watch-lock identity mismatch skips lock stale grace * fix(bin): tell a released watch lock from a torn-down state directory A watcher replaced by a successor still exited 1 as "state directory was torn down" on upstream CI. The successor that reclaims the lock delivers its recovery wake and exits, releasing the lock, and on a fast runner that happens before the old watcher's next poll. The old watcher then found no lock holder and no steal in progress, which the teardown check read as a recreated state directory. The watcher now holds its state directory open (fd 6) from startup, and a lock with no holder is a teardown only when the directory at that path is no longer the one it holds; otherwise the lock was released by a successor and the self-eviction stands the watcher down with exit 0. The held descriptor keeps the inode from being reused by a recreated directory. A host that cannot open a directory keeps the old reading. This replaces the steal-marker check and pid re-read, which only covered a successor still relinking the lock. Verification: - Drove: real bin/fm-watch.sh processes. A new regression, test_watch_replaced_holder_stands_down_after_successor_exits, pauses the old holder (SIGSTOP, only while it holds no other state lock) until the successor has delivered its wake and exited, then resumes it. Also a standalone run with the old watcher polling every 5s. - Observed: on the previous head the old watcher exits 1 "state directory was torn down (singleton lock removed)", the CI failure, every time; with this change it exits 0 by standing down. Both takeover tests passed 20 of 20 runs four at a time on one loaded CPU. The teardown tests in tests/fm-watch-arm.test.sh (state directory and home removed) still pass. - Re-check: tests/fm-watcher-lock.test.sh and Behavior portable serial 6. * no-mistakes(test): Hold the watcher's state directory open before claiming the lock * no-mistakes(document): Docs already match watch-lock identity reclaim change --------- Co-authored-by: mangocabs2025 <[email protected]>
…nguid#7911) * Fix non-GNU timeout fallback * no-mistakes(review): Assert INT reaches watcher in non-GNU timeout fallback test * no-mistakes(document): Document GNU-only timeout selection in watch checkpoint * no-mistakes(ci): Greptile flagged that only the non-GNU-timeout-to-Perl path had an isolated test. I added two isolated tests in tests/fm-watch-checkpoint.test.sh, as you asked. The production code is unchanged. The rule being tested: run_bounded must run GNU `timeout` first, then GNU `gtimeout`, then Perl. Whichever GNU command it runs must receive `--signal=INT --kill-after=<bound>s <seconds> <watcher>`. What changed: - **Shared setup:** a new helper, `make_isolated_checkpoint`, copies the checkpoint into a temporary root. It also builds a PATH that holds only the named host tools, so the stubs decide which timeout is found. The existing Perl-fallback test now uses this helper too. Its assertions are the same. - **Stubs:** a non-GNU stub reports `uutils` for `--version` and exits 137 if it is ever used. A GNU stub reports `GNU coreutils` and writes its own name and arguments to `$FM_HOME/timeout-calls`, then exits 124. - **`test_gnu_timeout_runs_the_watcher_bound`:** GNU `timeout` and GNU `gtimeout` are both on PATH. The test asserts exit 124, the quiet checkpoint line, and exactly one call: `timeout --signal=INT --kill-after=5s 1 <root>/bin/fm-watch.sh`. - **`test_non_gnu_timeout_uses_gnu_gtimeout`:** a non-GNU `timeout` is next to a GNU `gtimeout`. The test asserts the same exact call, made by `gtimeout`. - In both new tests, Perl is not on PATH. So if the code picked Perl by mistake, the run would fail with 127. How I checked it: - The full test file passes: all 14 tests. - I broke the code on purpose twice. When I swapped the order to try `gtimeout` first, the GNU timeout test failed. When the code always picked Perl, the run exited 127 instead of 124. I then put the production file back; `git status` shows only the test file changed. - `shellcheck -x` passes on the test file. This is a change to tests only, so there is nothing a user would see to check by hand
* fix: recover ownerless extension readiness and announce cleanup refusals * no-mistakes(review): Reset cleanup failure episodes and classify failure wakes * no-mistakes(document): Document ownerless readiness recovery and cleanup failure wakes * no-mistakes(document): Clarify cleanup failure documentation ownership --------- Co-authored-by: Kun Chen <[email protected]>
kunchenguid#7874) * Keep malformed remote reply captures from wedging * no-mistakes(document): Fix garbled remote reply source failure comment * no-mistakes(document): Document remote reply failure handling --------- Co-authored-by: Pitch Perfekt Collective <[email protected]>
…n PR text (kunchenguid#7937) * feat(bin): per-project pr=manual registry token for hand-written PR text A no-mistakes ship on a project where an outside maintainer reviews the PR let the pipeline's pr step rewrite the hand-written title and body on every validated push. The registry now records pr=manual, resolved by fm-project-mode.sh --pr and carried by fm-brief.sh --pr, fm-spawn.sh and fm-promote.sh like forge=. The generated brief skips pr and ci, and the worker writes and publishes the PR text itself. * no-mistakes(review): Drop pr_text key; fix manual-PR checks wait and base * no-mistakes(review): Remove dead PR_TEXT and timeout example * no-mistakes(document): Fix README pr=manual sentence grammar * test(bin): restore the displaced placeholder comment and rename the spawn agreement test The comment for the leftover-placeholder test sat above the new pr=manual tests. The spawn test said it recorded the PR text, but it only checks that a launch happens.
* fix(teardown): detect untracked work regardless of Git status config * test(watcher): avoid blocking FIFO contention handshakes * no-mistakes(document): Document hidden-untracked teardown safety --------- Co-authored-by: Kun Chen <[email protected]>
* fix: prefer current run over stale overview row * fix: preserve newest run precedence over stale status * no-mistakes(document): Document live-run precedence in crew-state attribution * fix: use ledger order for same-minute run precedence * test: cover both overview orders for same-minute run attribution Document and pin newer-first (recorded AXI) and historical-first overview orders. Same-minute ledger timestamps use row order as the tie-break so an older live bare status cannot hide a newer completed run. * no-mistakes(review): Treat failed as overridable terminal overview status * no-mistakes(review): Fix equal-head live run precedence with identity ordering * no-mistakes(document): Updated run identity ordering documentation * no-mistakes(lint): Fix ShellCheck export warning * no-mistakes(review): Prove same-head ordering or report unknown * no-mistakes(review): Guard failed selected-run reads and drop dead same-head ordering * no-mistakes(ci): I fixed both Greptile findings (ci-1, ci-2) in bin/fm-crew-state.sh. The change is in the working tree. I did not commit it, push it, or reply to the Greptile threads, because those steps belong to the outer pipeline. ci-1. Invariant: a live run from bare `axi status` may replace a terminal overview selection only when it is proven newer than every other run on the same branch. Previously the code compared it only against the selected run. Now crew-state reads each other candidate with `axi status --run <id>` and compares the live run against each one: - If another candidate is also live, it reports `unknown`, "competing live runs". This keeps the competing-live-runs check. - If two runs share a head and a ULID timestamp, it reports `unknown`, "same-head run ordering unverified", as before. - It promotes the live run only when it is proven newer than all other candidates. - If the live run is newer than the selected run but not proven newer than some other candidate, it reports `unknown`, "run ordering unverified", and names every run id. This means neither the stale selected run nor the live run can hide a newer failed run. This branch is the one judgement call: without it, the stale "done" row A would still hide C's failure. - In all other cases the overview's selection stands. The lib helper is now a pairwise compare called `fm_nm_run_is_newer_than` (it was `fm_nm_run_is_newer_than_selected`). The selected run's detail from the loop is reused when the read succeeded, as in the round-1 fix. I updated the sentence in docs/architecture.md to match. ci-2. Invariant: the `no-mistakes runs` ledger is read only to order runs with different heads. It is now fetched lazily, at most once, and only when a candidate's head differs from the live run's head. Same-head ULID comparisons never call it. Regression test: `test_live_run_newer_than_selection_does_not_hide_newer_failed_run` covers A (stale completed, listed first), C (newer failed) and B (live, created between them). All three share one head and use ULID ids. It expects `state: unknown`, C's id in the output, and no `state: working`. Before the fix it fails: with the fixed code stashed it printed `state: working ... run: 01M1...` (run B). On the original base 3fbace9 the overview would select A, so the output would be `done`, which also fails the `unknown` check. I did not run that base case. Verification: `bash tests/fm-crew-state.test.sh` passes in full ("all fm-crew-state tests passed", the new test included). `shellcheck` on the three changed shell files reports only the existing info-level SC1091 "not following sourced file" notes. No end-to-end run against a live no-mistakes daemon was possible here. I checked the change with the crew-state test harness and its fake `no-mistakes` CLI --------- Co-authored-by: mehulbhagwani <[email protected]> Co-authored-by: Pitch Perfekt Collective <[email protected]>
… full-ci label Outside pull requests run only the coverage guard and repo invariants until the full-ci label is added; lint and every test lane wait. A new Full suite check fails naming the full-ci label until it is added, and fails whenever a lane fails or is cancelled. The label starts the full suite, and later pushes run it again; main pushes, own branches and write-access authors run everything as before. Other labels run no job at all: their skipped checks take a 'Not run for label - ' prefix, so they cannot hide an earlier failure or a later pass. Close main pushes keep only the newest run; CONTRIBUTING.md explains the label, and the full-ci label now exists.
…atch resolution (kunchenguid#7664) * feat(bin): add opt-in systemone and openai providers to typed dispatch resolution Extend the FM_DISPATCH_PROVIDER/FM_DISPATCH_MODEL seam with a generic systemone provider (any System One-compatible host at FM_DISPATCH_BASE_URL, optional FM_DISPATCH_API_KEY) and an openai provider that maps the Choice request to OpenAI's Decisions API and its answer back. No provider set keeps the original off line; the never-send check runs on the endpoint and the final per-provider body. Live provider captures are recorded as pending. Refs kunchenguid#7643, builds on kunchenguid#7149. * docs(verification): record the live OpenAI Decisions capture for dispatch resolution Add a dated 2026-10-23 section for the openai provider: 25 hand-labeled synthetic briefs against gpt-6-luna, outcome and latency tables, the usage and header fields actually returned, a calibration note, and one verbatim request and response pair. The systemone live check stays pending. Refs kunchenguid#7643. * docs(verification): record the live Clef capture for the systemone provider Replace the pending systemone section with a dated 2026-10-23 run against Cloudflare Workers AI's @cf/cloudflare/clef, reached through a local test-only relay because Workers AI serves System One at /ai/run/<model> in a {result, success} envelope. Adds the outcome and latency tables, a calibration note compared with the gpt-6-luna run, and one verbatim request and envelope pair. A direct Workers AI option stays out of scope. Refs kunchenguid#7643.
…henguid#7941) * feat(agy): promote Antigravity CLI to full primary and secondmate harness Add tracked .agents/hooks.json, bin/fm-sessionstart-agy.sh, bin/fm-turnend-guard-agy.sh, PreToolUse --agy seatbelt flags, session-lock agy ancestry, autoarm supervision model, and --secondmate agy workspace trust pre-registration and spawn support. * no-mistakes(review): Fix agy Stop-hook park, hooks.json shape, and live coverage * no-mistakes(review): Unbound agy Stop park, raise ceiling, prove live deny * no-mistakes(review): Correct agy verification doc park-bound wording * no-mistakes(document): Document agy as verified primary and secondmate harness * no-mistakes(ci): I fixed all three selected findings, and every check I ran passed, including the live agy end-to-end run. **ci-1 (`tests/fm-agy-primary-live-e2e.test.sh`):** The invariant is that the live Stop-hook test passes only if a real watcher starts and its wake reaches a follow-up turn. The old test passed as soon as `.agy-park-owner` existed. I replaced the Stop-hook park block with the one the user specified. It waits until both `.agy-park-owner` and `.last-watcher-beat` exist, wakes the watcher with a `done:` status line, and asserts that the park owner was recorded, the watcher started, and `DONE` appears in the agy output. **ci-2 (agy away daemon):** The invariant is that `/afk` must not launch a separate away daemon on any primary whose home runs the supervision host. The agy Stop-hook guard already runs the host when it is enabled, but `fm_afk_launch_host_primary` left agy out. I added `agy` there, which is the one shared check all three callers use. I also added agy to: - the header comment in `bin/fm-afk-launch.sh`; - the three harness loops and the pass message in `tests/fm-afk-launch.test.sh`; - the primary lists and counts in `docs/supervision-host.md`, the matching lines in its engine-selection section, and a new Antigravity (`agy`) row in its Arm owners table; - the header comment in `bin/fm-supervision-instructions.sh`. **user-1 (`.agents/hooks.json`):** The invariant is that each hook command stays one script under Windows `cmd /c` and exits 0 when `sh` is missing. All 5 commands now use `sh -c "..." || cd .`. This does not change behaviour on Linux or macOS, because the `--agy` hooks report deny or continue as JSON on stdout and exit 0. The file keeps its live-verified `{"firstmate":{...}}` shape, matchers and 28800s Stop timeout. **Verification:** - `tests/fm-agy-primary.test.sh` passes, including running the SessionStart hook command from both `.agents/` and the repo root. - `tests/fm-afk-launch.test.sh` has no failures, and the new agy check passes. Its rex end-to-end cases were skipped because the rex CLI is not installed. - `tests/fm-supervision-instructions.test.sh` has no failures. - `bin/fm-lint.sh` and `bin/fm-doc-audience-check.sh` pass. - `FM_AGY_PRIMARY_LIVE=1 tests/fm-agy-primary-live-e2e.test.sh` printed all four `ok` lines and no failures, including "Stop hook parks on a real watcher and delivers its wake to a follow-up turn". The output went through `tail`, so the exit code shown is `tail`'s, not the test script's
…kunchenguid#7894) * feat(dispatch): add shared_quota home opt-out from quota-based ranking A home whose Claude and other provider usage draws on one combined AI budget has no meaningful per-provider quota rows, so spendPriority ranking and runway gates pick the wrong candidate. An optional top-level "shared_quota": true in config/crew-dispatch.json now opts the home out: the typed resolver makes no quota-axi call, applies no quota floor or runway gate, ranks nothing by spendPriority, and resolves the matched rule's use profiles in declared order, printing every candidate line with quota ranking off by home declaration. Firstmate's quota-array-dispatch intake honors the same declaration. Without the setting, behavior is unchanged. Non-boolean values are actionable configuration errors in both the resolver and bootstrap. * test(dispatch): cover shared-quota bypass of unmet rule and profile floors The shared_quota opt-out test picked a rule with no quota floor, so the separate rule-floor and profile-floor bypass paths stayed untested. Two cases now run against the same fixture: a rule whose model:fable floor (20%) exceeds the snapshot's 15%, and a profile whose all_models floor (50%) exceeds codex's 31%, each asserting the declared-order pick still wins with no quota-axi invocation. * no-mistakes(review): Narrow shared-quota skill opt-out to quota-only gates * no-mistakes(review): Document preferred_provider under shared_quota opt-out and test it * no-mistakes(document): Document shared_quota in schema example and verification inventory
…henguid#7958) * fix(bin): distinguish recycled reaper PIDs in tombstone cleanup * no-mistakes(ci): ci-2 fixed in tests/fm-watcher-lock.test.sh (test_lock_tombstone_tracks_reaper_start_time). Invariant: no fixture child may outlive a SIGKILLed runner without a bound. (1) The paused reaper's wait loop now also stops when FM_TEST_SUITE_PID is no longer alive or when SECONDS reaches FM_TEST_STUB_MAX_BLOCK_SECONDS. (2) The one sibling child in the same test, the unrelated `sleep 300`, now sleeps for FM_TEST_STUB_MAX_BLOCK_SECONDS so it uses the same bound. Verification, run serially: bash tests/fm-watcher-lock.test.sh. The new test passed on 4 of 4 runs. Red-before still holds: with the base bin/fm-wake-lib.sh from c9da552, the test fails with 'not ok - recycled reaper pid kept an abandoned tombstone alive'. Separately, the known stand-down flake ('the replaced watcher did not stand down on its own', watch-legacy-local-time-identity) failed on every run on this host and also fails on base c9da552 without this change, so the test file still exits 1; left unfixed as instructed. ci-1 (Full suite waiting on the full-ci maintainer label) was ignored per the user's decision
* feat: allow omp as a remote secondmate harness * test: cover omp on the remote secondmate gates * fix: retire a remote secondmate whose busy state left with its home * docs: record omp remote retirement evidence * review: Refresh pinned remote doctor bootstrap checksum
…enguid#7969) * fix(bin): name a consumed branch grant instead of a wiring bug When a supervision branch's own acknowledgement consumes every granted row, the drain removes the branch-eligible row snapshot while the owner record stays live. A repeat drain or acknowledgement in the same turn then refused with a message implying a broken handoff. Say instead that the grant was already consumed; the refusal and its exit status are unchanged. * no-mistakes(document): Document consumed-grant refusal in watcher continuity doc --------- Co-authored-by: c-c6aw <[email protected]>
…rce (kunchenguid#5409) * feat(dispatch): read Typesafe key from Keychain * no-mistakes(review): Share Keychain key lookup with bootstrap; hard-code service name * no-mistakes(review): Use one readable-secret Keychain check for bootstrap and resolver * no-mistakes(document): Point AGENTS key row to owner; record Keychain bootstrap evidence * feat(dispatch): read provider keys from a declared credential source bin/fm-dispatch-resolve.sh took the typesafe.ai and OpenRouter keys only from the environment or $FM_HOME/.env, so a home that keeps its key in the macOS Keychain needed a wrapper to supply it, and the documented direct call reported off. Let the resolver consume an optional, provider-keyed declaration in the effective config directory, config/dispatch-credential-sources.json. It names where a key lives and never holds one. macos-keychain is the first adapter (service, optional account), kept behind a small schema and adapter registry in bin/fm-credential-source-lib.sh so the shared surface binds to no one OS or provider. - Precedence is the environment, then .env, then the declared source, which is read only when neither supplied a key and only for the selected provider. - No entry and no key stays off, exactly as before. An unreadable or invalid declaration exits 2 with a line that names the problem and never a declared value. - A declared source that this host cannot run, that yields no key, or that does not answer within FM_CREDENTIAL_SOURCE_TIMEOUT ends as a structured error outcome with nothing sent, so it is not mistaken for an unconfigured resolver. - The key is captured into the same private variable as before and still reaches curl only as an fd 3 header. The adapter puts only the service and account on argv and discards the tool's stderr. - --supports-credential-source <source> answers supported or unsupported without reading a declaration or running the credential tool, so an installer can refuse an unsupported activation before it writes anything. The resolver tests cover the mapping, effective-home and provider isolation, precedence, the three failure kinds, and secret containment with a stubbed security and uname. Closes kunchenguid#7879 * no-mistakes(review): Gate bootstrap typed checks on declared source; fix timeout * no-mistakes(review): Document storing the declared Keychain item without access dialog * no-mistakes(document): Clarify that only a typesafe declaration keeps resolver on * no-mistakes(document): Merge dispatch key-source precedence into one configuration sentence --------- Co-authored-by: Kun Chen <[email protected]>
…guid#6489) * fix(bin): clean remote reply temp paths on every exit The remote reply adapter left its temporary staging directory and fetch files behind on several exit paths. The ingest staging directory leaked on the continuity-broken return, whose EXIT trap fired after its local tmp left scope. The trap cmd_ingest installed also replaced the lifecycle-lock release of the handle subshell. One EXIT trap now owns every temporary path, each lock subshell runs it before releasing its lock, and the empty hash no longer stages a file. A test under a private TMPDIR covers the continuity return, a die after staging, a locked handle, and a signal during a document fetch. * no-mistakes(document): Document remote-reply temporary-file cleanup * no-mistakes(ci): Fixed ci-1 in tests/fm-remote-reply.test.sh: interrupt the blocked SSH child before waiting, fail if it already exited, and require adapter exit status 143 before checking cleanup. Confirmed the strengthened test rejects an adapter that ignores TERM; the temporary mutation was restored. The full remote-reply suite passed on a serial rerun, and syntax, pinned ShellCheck, and diff checks passed. One earlier run alongside lint timed out waiting for the third reply generation * fix(bin): clean up the staged source-read output on every exit path The source leg stages the remote read's output in a temporary file. Track it with the adapter's other temporary paths so a signal during the read removes it, and extend the regression test and docs to cover that path.
* chore: gitignore Claude Code's per-user local settings file * no-mistakes(ci): Addressed ci-1 by preserving the staged --no-index correction for both Claude settings assertions in tests/fm-gitignore-config.test.sh, making ignore-rule checks independent of tracking state. Reproduced the original false pass with tracked shared settings and an overly broad .claude/ rule; the corrected test rejects it. Verified normal tracked/untracked settings cases and rejection of a missing local-settings ignore rule. Targeted test runner, pinned ShellCheck, Bash syntax check, and diff checks all passed. No unrelated changes were made
…uid#7905) * fix(inbox): prefilter idempotent steering history * no-mistakes(document): Clarify delivery mode in steering retry contract * test(inbox): cover acknowledgement before prefilter opens
…unchenguid#7956) (kunchenguid#7979) * feat(bin): add Kiro CLI as a crewmate/scout harness adapter Port of kunchenguid#7956 onto current main so it gets a fresh CI run. Adds a `kiro` (Kiro CLI, V2 engine) harness adapter, crewmate/scout only (--secondmate launches are refused). fm-harness.sh detects it by kiro-cli ancestry; fm-spawn.sh launches it with a per-task KIRO_HOME under state/<id>.kiro-home (generated userPromptSubmit and stop hooks plus chat.disableTrustAllConfirmation); busy, control, send, watch, procevent, teardown and bootstrap wiring recognise it. Composer ghost-text and busy footer matching is scoped to FM_COMPOSER_HARNESS=kiro, so other harnesses read exactly as before. Adds references/harness/kiro.md, docs/verification/kiro.md, tests/fm-kiro-harness.test.sh and an opt-in live e2e signals guard. Conflicts with main were resolved by keeping main's agy promotion and adding kiro to the crewmate-only lists next to it. Co-authored-by: kiatng <[email protected]> Co-authored-by: Marsjohn-11 <[email protected]> * fix(send): detect kiro on meta-less explicit targets An explicit session:window send has no task meta, so TARGET_HARNESS stayed empty and the kiro composer rules never applied. A finished kiro idle placeholder then read as pending, extra Enters were pressed, and fm-send exited 3 even though kiro accepted the message. Resolve kiro from the live pane's foreground process group when meta is absent, and keep every other explicit-target send on the unknown-harness path. Move the kiro live e2e version probe to after the live gate so an opted-out run never starts kiro-cli. Co-authored-by: Kun Chen <[email protected]> --------- Co-authored-by: kiatng <[email protected]> Co-authored-by: Marsjohn-11 <[email protected]> Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Kun Chen <[email protected]>
…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 <[email protected]>
…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 <[email protected]> --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Kun Chen <[email protected]>
…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 <[email protected]>
…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 <[email protected]>
…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#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
…kunchenguid#8127) * fix(spawn): refuse to relaunch a worker into a primary home or checkout A relaunch trusted the recorded worktree and started the worker there. After a machine restart the restored record could point at the primary home or a repository's primary checkout, so a worker was relaunched inside it. Relaunch now refuses with a named error when the recorded worktree is the home, the code root, or a repository's primary checkout (git dir equals git common dir). * no-mistakes(document): Document relaunch refusal of primary home or checkout worktrees * no-mistakes(ci): Fixed ci-2 (the Greptile P1 finding). ci-1, the Full suite failure, is the expected maintainer-label gate; the user chose to leave it alone, so nothing was changed for it. Invariant: the relaunch refusal must judge whether the recorded worktree is a primary checkout from the directory's own layout on disk. Inherited Git location variables must not be able to change the answer. In this change, the only place that probes Git for that decision is the git-dir and common-dir check in the `--relaunch` refusal in `bin/fm-spawn.sh`. The home and code-root comparison doesn't use git, so it can't be affected. Fix in `bin/fm-spawn.sh`: both probes now run in a single subshell. That subshell first unsets the same Git variables that `bin/fm-claude-trust.sh` clears (`GIT_DIR`, `GIT_WORK_TREE`, `GIT_COMMON_DIR`, `GIT_OBJECT_DIRECTORY`, `GIT_INDEX_FILE`, `GIT_ALTERNATE_OBJECT_DIRECTORIES`, `GIT_CEILING_DIRECTORIES`, `GIT_NAMESPACE`, `GIT_DISCOVERY_ACROSS_FILESYSTEM`, `GIT_CONFIG*`). It then runs one `git rev-parse --path-format=absolute --git-dir --git-common-dir` and splits the two output lines. The unset is scoped to the subshell, so the environment the rest of the script and the launched worker see is unchanged. When git fails, the result is empty and the code falls through exactly as before. Regression test in `tests/fm-control-relaunch.test.sh`: `test_relaunch_refuses_the_primary_checkout_under_inherited_git_overrides`. It records `worktree` as the project's primary checkout, then runs `fm-spawn --relaunch` with `GIT_DIR` set to the linked worktree's git directory and `GIT_WORK_TREE` set to the primary checkout. It asserts exit code 1, the "primary home or checkout" error, and that nothing was launched. The test is registered in the suite's run list. Verification: - `bash tests/fm-control-relaunch.test.sh` with the fix: rc=0, all tests pass, including the new one. - With the `fm-spawn.sh` change temporarily reverted: rc=1, and the new test fails with `missing: 'primary home or checkout'`. So it reproduces the reported bypass. - `shellcheck` on both files reports no warnings or errors --------- Co-authored-by: Trillium Smith <[email protected]>
Resolve all 47 conflicts keeping both sides' behavior. Where both sides fixed the same thing, upstream wins unless the fork carries extra behavior. The per-launch --account value and upstream's config/claude-accounts list now coexist: without a list --account is a per-launch account; with a list it must name a declared entry.
Fork main gained #299, which had already merged most of upstream main, so this takes fork main's account resolution for the five files that conflicted.
Picks up the Codex Stop hook JSON fix, the calm blank row, and the primary-home relaunch refusal.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This was referenced Nov 4, 2026
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.
Summary
This brings the fork's
mainfully up to date withkunchenguid/firstmatemainthrough real merge commits, so upstream is now an ancestor and later syncs only see new upstream work.After this branch,
git rev-list --count HEAD..upstream/mainis0.Fork main landed #299 (a squash of most of upstream) while this branch was in progress, so the branch merges fork main back in and takes #299's account resolution wherever the two differed.
The net change against fork main is 16 files: three upstream fixes that #299 did not include, plus three small leftovers from the first merge.
Each conflict keeps both sides' behavior.
Where both sides fixed the same thing, the merge prefers upstream unless the fork carries extra behavior, and the notes below say which side won and why.
No fork feature is dropped.
What this changes against fork main
.codex/hooks.json,docs/turnend-guard.md,.agents/skills/harness-adapters/references/harness/codex.md,docs/verification/runtime-backends.md, and the live hook-layer test)..claude/mods/firstmate-calm/,docs/calm.md).fm-spawn --relaunchrefuses a recorded worktree that is the home, the code root, or a primary checkout, now probed with inherited Git location variables cleared (bin/fm-spawn.sh,docs/agent-control.md,tests/fm-control-relaunch.test.sh). The fork already had the first version of this check, so upstream's hardened probe replaces it.bin/fm-send.sh: keeps upstream's resend argument for a captain-held key. Under the fork's fm-send: --resolve-key must not close a captain hold #296 refusal that path exits before the resend line prints, so behavior is unchanged.bin/fm-control.sh: removes a duplicated--account requires a non-empty valuecheck left by Merge upstream kunchenguid/firstmate main into the fork #299; the first copy still runs.bin/fm-captain-hold.sh: drops one blank line to match upstream.Conflict resolutions
First merge: upstream main into the old fork main (47 files)
The second merge below then took #299's text for the account files, so the final tree for these files matches fork main except where listed above.
"Ours" means the fork's side and "theirs" means upstream's side.
Skills and CI
.agents/skills/harness-adapters/SKILL.md: ours. Keeps the fork's "Cloud runs" section. Both sides had already dropped the old verified-only line..agents/skills/quota-array-dispatch/SKILL.md: ours. Keeps the fork's agy group-scope line, which upstream does not have..github/workflows/ci.yml: ours. Keeps the fork's pinnedFM_PI_PACKAGE_VERSION/FM_TYPESCRIPT_VERSIONenv block and its 12-shard matrix, where upstream has 11 shards.bin/
bin/fm-backend.sh: merged.FM_BACKEND_KNOWNkeeps the fork'scloudand adds upstream'shc, with upstream's comment.bin/fm-captain-hold.sh: ours, except the origin block. Keeps the fork's summary republish on lock release,warn_sibling_holds, andfm_meta_get_exact. Both sides removed the origin block, so theirs was taken there.bin/fm-claude-stop-autoarm.sh: theirs. Upstream's interrupted-session identity check (session-ended) is a superset of the same suppressed-exit refactor both sides made.bin/fm-control.sh: merged. Relaunch reuses the fork's recordedaccount_request=(or a new--account) and passes it through upstream'sfm_worker_account_relaunch_request, so both the fork's per-launch value and upstream'saccount=list entry survive a relaunch. Duplicate--accountparsing from the auto-merge was removed.bin/fm-dispatch-resolve.sh: ours. Keeps the fork's opt-inFM_DISPATCH_RESOLVE_LOGquestion/answer log, its EXIT trap, and the agy quota scope. Upstream's systemone/OpenAI providers arrived through the auto-merge and are intact.bin/fm-dod-lib.sh: ours. Keeps the fork'sfm_visual_evidence_block.fm_dod_blockis still defined.bin/fm-pr-lib.sh: ours. The fork already had upstream's template-authentication change and adds a named failure reason (fm_pr_poll_fail) to every predicate.bin/fm-procevent-remote-reply.sh: ours. Keeps the fork's empty-stdoutWINDOW_CLOSED_EMPTYcheck. The rest is identical to upstream.bin/fm-remote-doctor.sh: ours. Keeps the fork's configurableFM_REMOTE_HERDR_SESSION(defaultdefault), the dedicated-session switch, and legacy launch-agent retirement. Upstream's rex backend support is kept.bin/fm-remote-entrypoint.sh: ours. The merged doctor is byte-identical to the fork's, so the fork'sDOCTOR_SHA256is correct (rechecked withshasum -a 256).bin/fm-remote-secondmate-control.sh: ours. Keeps the configurable remote Herdr session, lazyrequire_home, thefm-home-libsource, andFM_BACKEND_REX_NO_AUTOSTART=1.bin/fm-review-diff.sh: ours. Keeps the fork'sfm-backend.shsource.bin/fm-send.sh: ours. Keeps PR fm-send: --resolve-key must not close a captain hold #296's refusal of--resolve-keyon captain-held tasks. Upstream'sfm_send_feed_resolved_holdsis dropped because it closes a captain hold from a steer, which fm-send: --resolve-key must not close a captain hold #296 forbids, and nothing calls it.bin/fm-spawn.sh: ours, plus one merged hunk. Keeps the fork'sspawn_worktree_reset_torefactor, theaccount_requestkey, and the hermes and hc meta keys. The account hunk sends the fork's per-launch request through upstream's relaunch resolver. Duplicate--accountparsing from the auto-merge and upstream's parse-time secondmate refusal were removed. The fork lets a local secondmate take a per-launch account and refuses only remote secondmates.bin/fm-subagent-pretool-check.sh: ours. Every line upstream added is already in the fork's file, which also keeps the parlayMonitorexemption.bin/fm-teardown.sh: ours. Keeps the fork's$STATE/$ID.reaphandling.bin/fm-test-run.sh: ours, plus additions. Keeps 12 portable serial shards and thefm-watch-meta-index/fm-primary-failoverentries. Adds affected-path cases forfm-primary-failover.shand upstream'sfm-claude-account-quota.sh.bin/fm-tmux-lib.sh: ours. Keeps the agy composer comment and the owner list "pi, polytoken, commandcode, agy, or hermes".bin/fm-turnend-guard.sh: ours. Every upstream addition is already present, and the fork's usage line adds--pi.bin/fm-wake-lib.sh: theirs. Upstream'sfm_autoarm_write_ownedadds interrupted-session identity arguments on top of the same locked-core refactor. The fork's six-argument callers still work.bin/fm-watch.sh: ours. Keeps the fork's header (captain inbox note, idle simulator, pr-register, rejected-check predicate),terminal_override_evidence_gone,WEDGE_BUSY_BOUND_LABEL, and theheartbeat_reap_finds_actionablebranch.bin/fm-worker-account-lib.sh: merged. With noconfig/claude-accountslist,--accounttakes the fork's per-launch value (ordinary, an absolute root, ortoken:<path>). With a list, upstream's rules apply: the entry must be declared, the list and a pin cannot both exist, and secondmates are refused. Upstream's control-character validation and non-Claude refusal run first.docs/
docs/agent-control.md: both. Keeps the fork's per-launch account line and adds upstream's Claude account list line.docs/architecture.md: ours. Keeps the fork'sfm-reapline.docs/captain-hold-lifecycle.md: ours. Matches PR fm-send: --resolve-key must not close a captain hold #296, which removed the chat channel.docs/configuration.md: ours. Keeps the cloud-run metadata, the dispatch profileaccountfield,FM_DISPATCH_RESOLVE_LOG, and the fork's longerFM_PAUSE_RESURFACE_SECStext. Upstream's "Several Claude accounts" section was edited so--accountwithout a list takes the per-launch grammar instead of refusing.docs/fm-test-portable-shards.md: both. Takes upstream'sfm-live-lab-isolationserial hint and keeps the fork's twelve-shard count.docs/remote-secondmates.md: ours. Keeps the configurableFM_REMOTE_HERDR_SESSION, where upstream hardcodesfm-remote.docs/scripts.md: ours. Keeps thefm-stack-doctorandfm-primary-failoverrows.docs/subagent-guard.md: ours. Keeps the parlayMonitorline.docs/turnend-guard.md: theirs. Upstream's session-ended interruption isolation text is a superset, and the reset-boundary text lives under "Failure progression and block budget".docs/verification/dispatch-resolve.md: ours. Keeps the fork's opt-in log paragraph. Upstream had already rewritten the old lines.docs/watcher-continuity.md: theirs. Upstream's text is a superset.tests/
tests/fm-agy-harness.test.sh: ours. Keepsfm_register_secondmate.tests/fm-backend-herdr.test.sh: ours. Keeps the fork's"$out"diagnostic argument.tests/fm-bootstrap.test.sh: ours. The known backend list includes bothcloudandhc.tests/fm-claude-stop-autoarm.test.sh: ours. Keeps the"$out"diagnostic argument. Upstream's assertions are unchanged.tests/fm-dispatch-resolve.test.sh: ours. Keeps the fork's opt-in log and per-profile account cases. Upstream's side was empty.tests/fm-remote-secondmate-omp.test.sh: ours. KeepsFM_REMOTE_HERDR_SESSION=fm-remotefor the fixture.tests/fm-send-resolve-key.test.sh: ours. Keepstest_steer_never_closes_a_captain_holdfrom fm-send: --resolve-key must not close a captain hold #296.tests/fm-turnend-guard.test.sh: ours, then theirs. Keeps the"$out"argument and takes upstream's per-Stop session identity in the stop driver.tests/fm-watcher-lock.test.sh: theirs. Adds upstream's bounded-deadline lock tests and their run-list entries.tests/fm-worker-account.test.sh: both. Upstream's list tests now expect the merged semantics: no list means a per-launch account, plus the merged refusal messages. A missing closing brace from the auto-merge was restored.tests/fm-x-mode.test.sh: ours. Keeps the"$out"diagnostic argument.Second merge: fork main (with #299) into this branch (5 files)
bin/fm-spawn.sh: theirs (fork main). Merge upstream kunchenguid/firstmate main into the fork #299's account comments, plus the fork's newer quota pool lease wording in the batch deferral message.bin/fm-worker-account-lib.sh: theirs. Merge upstream kunchenguid/firstmate main into the fork #299's account selection: the declared list rules, the per-launch value without a list, and refusing--accountfor every secondmate.docs/configuration.md: theirs. Merge upstream kunchenguid/firstmate main into the fork #299's "Several Claude accounts" text, which already says--accounttakes the per-launch grammar without a list.tests/fm-control-relaunch.test.sh: theirs. Expects Merge upstream kunchenguid/firstmate main into the fork #299's refusal messages.tests/fm-worker-account.test.sh: theirs. Expects Merge upstream kunchenguid/firstmate main into the fork #299's refusal messages and secondmate rule.tests/fm-remote-secondmate-lifecycle-e2e.test.shwas removed by taking fork main's copy.Third merge: newer upstream main (4 files)
bin/fm-spawn.sh: theirs. Upstream fix(bin): refuse to relaunch a worker into a primary home or checkout kunchenguid/firstmate#8127's relaunch primary-checkout probe, which clears inherited Git variables, replaces the fork's earlier version of the same check.docs/agent-control.md: both. Keeps the fork's tmux absence wording and adds upstream's two relaunch-refusal lines.tests/fm-control-relaunch.test.sh: theirs, plus the fork's"$out"diagnostic argument. Adds upstream's inherited-Git-override test.tests/fm-turnend-guard.test.sh: theirs, plus the fork's"$out"diagnostic argument. Takes upstream's single-JSON-object Codex hook assertions.A fourth merge of fork main's newest commits (#287, #288, #291, #293) was clean.
Validation
bash -npasses on every touchedbin/andtests/script.bin/fm-lint.shpasses (ShellCheck 0.11.0, actionlint 1.7.12).bin/fm-doc-audience-check.shpasses.bash, except two host-only failures named in the transcript: one watcher-lock case that fails identically on both parents on macOS, and the live Codex hook test, because this host's codex-cli 0.144.1 lacks--approve-for-me. The transcript is below.Visual evidence
flowchart LR subgraph before[Before] F0[fork main<br/>upstream content partly squashed in by #299<br/>upstream not an ancestor] U0[upstream main] end subgraph after[After] M1[merge 1: upstream<br/>47 conflicts] M2[merge 2: fork main with #299<br/>5 conflicts, #299 wins] M3[merge 3: newer upstream<br/>4 conflicts] M4[merge 4: newest fork main<br/>clean] R[0 upstream commits missing<br/>16 files differ from fork main] end F0 --> M1 U0 --> M1 M1 --> M2 --> M3 --> M4 --> RLocal test transcript: