Repository navigation
feat(bin): sync fork main with upstream firstmate - #58
Merged
Merged
Conversation
…is warm (kunchenguid#7807) * feat(bin): add opt-in warm-cache compaction for the Claude primary and host engine Refs kunchenguid#7755 * no-mistakes(review): Persist engine compaction marker, run it abortable, match resume predicate * no-mistakes(review): Run engine compaction in host shell; skip marker on abandon * no-mistakes(review): Test abandoned engine compaction is not marked done * no-mistakes(document): Clarify warm-compact episode and engine resume rules * no-mistakes(lint): Fix ShellCheck SC2015 in engine compaction marker * no-mistakes(ci): Test coverage guard and portable parallel 2 failed because the two new warm-compact tests had no timing hint. The runner packed them at the 45000 ms default, pushing the largest serial shard to 1204066 ms, over the 1200000 ms limit. I added measured hints in bin/fm-test-run.sh (fm-warm-compact.test.sh 1500, fm-warm-compact-herdr-live-e2e.test.sh 170). `bin/fm-test-run.sh --check-coverage` now passes (largest serial shard 1194253 ms), and tests/fm-supervision-instructions.test.sh passes. A full run of tests/fm-test-run.test.sh was killed at its time limit and did not finish, so it is unverified. The serial-shard failures in the logs were watcher/timing tests unrelated to warm-compact. I did not reproduce them locally. main also has a failing run. They need a rerun, not a code change
…7810) * refuse remote Rex servers during spawn * no-mistakes(document): Clarify Rex locality requirements and remote-worker guidance
* fix(bin): read a Windows win:<pid> session lock in the supervision host and Claude auto-arm On Git Bash the session lock records its holder as a tagged win:<pid> (kunchenguid#6300), but four readers still passed that value to the numeric-only fm_pid_identity and fm_pid_alive: fm_supervision_host_main_key produced no key, fm_autoarm_claim_next pinned no lock-holder identity and dropped owner_session_id, fm_autoarm_claim_open rejected the non-numeric lock so a live claim never read as open, and fm_autoarm_midturn_healthy read a live holder as lapsed. Add fm_session_pid_alive and fm_session_pid_identity beside the tagged-pid contract in fm-session-lock-lib.sh. A tagged pid is answered from the Windows process table; every other value falls straight through to the existing numeric helpers, so POSIX behaviour is unchanged. The claim read-back checks the lock shape with fm_session_pid_valid. tests/fm-session-lock-windows-consumers.test.sh covers each reader on a faked Git Bash host, including an exited holder, a reissued Windows pid, and the tag off Windows, plus a parity case proving untagged values get exactly the numeric helpers' answers. Fixes kunchenguid#7739 * no-mistakes(document): Document tagged Windows session-lock consumers * no-mistakes(ci): Fixed tests/fm-afk-return.test.sh partial host fixtures to copy fm-session-lock-lib.sh alongside fm-supervision-engine-lib.sh in all three affected paths. The focused host/latch tests and tests/fm-session-lock-windows-consumers.test.sh pass; the full afk-return suite exceeded the 180s local timeout after earlier cases passed
) * test: fail required watcher-triage cases without tasks-axi * no-mistakes(document): Document required watcher-test dependency and failure rationale * no-mistakes(ci): Rebased onto 2ba4c45 successfully. New HEAD: 5902c09. Preserved all changes in the relocated pause suite. No conflicts or tracked changes remain. Missing-dependency regression, syntax, and diff checks passed. Command guards blocked the installed-dependency test loop and backup cleanup. Untracked .ci-rebase-backup.bundle remains * Untrack pipeline backup bundle * no-mistakes(review): Untrack pipeline backup bundle; exclusion remains blocked * Untrack excluded pipeline backup bundle * no-mistakes(document): Document watcher test prerequisite and remove stale count * no-mistakes(ci): Fixed SC2329 with a one-line annotation for the function exported to child Bash. Tier 3 applies because static analysis cannot trace that indirect use. Focused lint, all four missing-dependency cases, syntax, and diff checks passed
…unchenguid#7875) * fix(scout): authorize task-scoped empty-inventory completion (#103) Allow scouts to run only their generated complete --none command for an empty inventory, without granting metadata or backlog edit authority. Keep non-empty inventories and refused attestations with firstmate. Fork carry for kunchenguid#7862 pending upstream validation. * fix(scout): allow scoped empty-inventory attestation * no-mistakes(document): point lifecycle doc at scout brief boundary test
* Add opt-in reminders for overdue open worker decisions * no-mistakes(document): Align overdue-decision documentation with watcher behavior * no-mistakes(ci): Fixed ci-1 with a tier-1 structural correction: AWK now compares both task and key as exact strings. Added behavioral regressions for keys 1/01 and task IDs 1/01, including independent backoff. Reproduced the failure before the fix. All focused reminder, decision-key and cursor tests passed, as did stock /bin/bash verification, canonical lint and git diff --check. Only the two intended files changed. No scratch files remain. Publication and PR updates remain with the outer executor
* fix(pi): contain repeated successful unchanged primary reads Add an off-by-default Linux Pi primary safeguard with bounded configurable limits, verified ownership, durable stopping, and deliberate user reset. Preserve ignored legacy guards and require explicit collision migration. Cover policy, SDK compatibility, installed RPC behavior, and test selection. Refs kunchenguid#7805. * no-mistakes(test): Fixed locale-dependent coverage checks; coverage and shard packing passed
…uid#7886) * fix(bin): reclaim a lock whose dead holder's pid was reused The generic lock in fm-wake-lib.sh judged a record stale only by asking whether its pid was alive. Once the holder died and the kernel handed that pid to an unrelated process, the lock read as held forever and every acquirer spun and gave up - each watcher re-arm paid for it while trying to append to the cycle ledger. Acquisition now records the holder's start time beside its pid, and a record whose live pid no longer has that start time is stale, so the ordinary stale-owner takeover reclaims it and reports the pid it took over. Start time alone is the key because a holder may exec another program, which keeps its pid and start time but replaces its command line. A record without a start time, or a pid whose start time cannot be read, keeps the old pid-liveness answer. The bounded wait's handoff drops the helper's start time before the pid changes hands and records the caller's after. Refs kunchenguid#7885 * no-mistakes(document): Note reused-pid lock staleness in FM_LOCK_STALE_AFTER
… work (kunchenguid#7352) * feat(bin): add opt-in config/spawn-base-primary-checkout for local landings A fresh pooled task worktree is reset to origin/<default>. A local-only project lands work on the primary checkout's default branch through fm-merge-local.sh and never pushes, so that ref stays frozen at the last push and every fresh task starts behind work already landed, loading the project's instruction files from the stale tree. The always-on fix proposed in kunchenguid#3812 replaced the specified origin-only refresh for every home; this rework keeps that rule as the default and moves the new base behind an explicit, default-off presence flag, following the existing config/<flag> pattern. With config/spawn-base-primary-checkout present: - fm-spawn.sh starts a fresh local-only ship, or a scout without --base-branch, from the primary checkout's <default> when it strictly contains origin's tip. Publishing modes and named base branches keep origin's tip, because that work is delivered against origin. A diverged primary keeps origin's tip and prints a note counting both sides. The commit is read from the local object store, so nothing extra is fetched, and the clean-slot refusal still runs first. - fm-review-diff.sh anchors a remote-backed task without base_branch= on the branch it delivers to: publishing modes stay on origin/<default>, while a local-only ship or a scout is compared against whichever of the local <default> and origin/<default> meets the branch later, so the review shows the task's own work instead of every locally landed commit. - fm-promote.sh tells a scout promoted to a publishing mode to return to origin's default branch, because in this home the scout may have started from the primary checkout's branch, whose unpushed commits would otherwise be published with the work. fm-dod-lib.sh gains fm_mode_publishes as the one predicate those three readers share. Without the flag every path is unchanged: the spawn resets to origin's tip, the review anchors on origin/<default>, and promotion keeps its wording; the existing tests run unmodified. Treehouse 3 (verified on 3.1.3) already hands a slot out at whichever of the local and remote default branch is further ahead, so with the flag the refresh keeps that slot where Treehouse put it for a local landing instead of rewinding it, and a project without origin is untouched as before. Supersedes kunchenguid#3812. * no-mistakes(document): Drop change-relative wording from spawn-base config docs * no-mistakes(ci): The Greptile Review check failed on two review findings, not on a broken build or test. I fixed both as the user directed, and the tests and lint pass. ci-1 (bin/fm-promote.sh): promotion must name origin's default branch only when spawn could actually have started the scout from the primary checkout. Spawn does that only when the project has an origin remote and is recorded on the task. Before this fix, the opt-in flag alone made promotion to no-mistakes or direct-PR say "copy of origin's default branch...", even on a project with no origin. - The new wording now also requires a recorded project (`[ -n "$PROMOTE_PROJECT" ]`) whose `git remote get-url origin` succeeds. That is the same check bin/fm-review-diff.sh already makes. The empty-project guard is needed because `git -C ""` would run in the current directory. Otherwise the existing "default-branch base" wording stays. - The three places that read the flag now agree: spawn, review-diff and promote. - I updated the header and inline comments in fm-promote.sh, and the promote line in docs/configuration.md, to say this applies only to a project with an origin remote. - Test: `test_promote_names_origin_for_a_publishing_mode_in_an_opted_in_home` in tests/fm-task-delivery.test.sh now records a real `project=` with a registry entry, and covers flag on/off × origin/none × direct-PR/no-mistakes/local-only. Only flag on + origin + a publishing mode gets the new wording. The named-base case is unchanged. - Before the fix, the test fails with "not ok - flag on, remote none, direct-PR: the promotion changed the default-branch wording". With the fix, it passes. ci-2 (tests/fm-spawn-pool-base-freshen.test.sh): with the flag set, both publishing modes must start from origin's tip and print no divergence note. - The opted-in spawn test now covers no-mistakes as well as direct-PR, local-only and scout. - The expectations no longer single out direct-PR. Both publishing modes now expect origin's tip, no "note: pooled worktree", and a review anchored at the slot's start, in the leading, diverged and trailing cases. Verification: - `bash tests/fm-task-delivery.test.sh`: exit 0. - `bash tests/fm-spawn-pool-base-freshen.test.sh`: exit 0. - `bin/fm-lint.sh` on the three changed shell files: exit 0 (ShellCheck 0.11.0, pinned, with extended analysis)
…enguid#7915) * fix(teardown): distinguish unavailable content-landed proof * no-mistakes(document): Clarify teardown proof failure documentation * no-mistakes(ci): Captain, CI failed in unchanged watcher recovery code, independent of this PR. The focused failing case passed locally with exit 0. The full suite stalled earlier and was stopped. No tracked changes. Command guard rejected cleanup; scratch remains at .ci-7915/ and tests/.ci-7915-cycle.sh * chore: untrack CI validation scratch
…kunchenguid#7876) * feat(dispatch): prefer configured provider family * no-mistakes(review): drop policy_why field and dead auth fixture from preference tests * no-mistakes(document): docs: record preferred_provider in schema, diagnostics, verification
) * fix: pin local-only landing to its accepted done head Persist the accepted local-only commit in task metadata and refuse landing when the branch or the recorded head changes. Merge the full commit ID under the task control and metadata locks. Closes kunchenguid#7782 * no-mistakes(test): Refuse local landing races with atomic ref transactions * no-mistakes(document): Document pinned local landing and recovery contracts * no-mistakes(ci): Applied only the verified incremental patch and preserved existing repairs. Complete diff matches the supplied candidate hash. Both focused test files, default lint, and source-aware lint passed with exit 0. Evidence retained at /tmp/up7782-local-repair/ci-phase-fresh-*. No commits, pushes, or pipeline-control actions performed; publication remains with the outer executor * no-mistakes(ci): Fixed both SC2031 false positives in tests/fm-merge-local.test.sh with narrowly scoped suppressions. Tier 2 lint correction; runtime changes were unnecessary. Default lint, source-aware lint, all 8 focused tests, and git diff --check passed. No commits, pushes, or pipeline-control actions performed
…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 <250559406+mangocabs2025@users.noreply.github.com>
…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 <3233006+kunchenguid@users.noreply.github.com>
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 <pitchperfekt@Pitchs-Mac-Studio.local>
…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 <3233006+kunchenguid@users.noreply.github.com>
* 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 <mehulbhagwani@users.noreply.github.com> Co-authored-by: Pitch Perfekt Collective <pitchperfekt@Pitchs-Mac-Studio.local>
… 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 <225476801+c-c6aw@users.noreply.github.com>
…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 <kunchenguid@users.noreply.github.com>
…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 <1106470+kiatng@users.noreply.github.com> Co-authored-by: Marsjohn-11 <74795701+Marsjohn-11@users.noreply.github.com> * 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 <kunchenguid@users.noreply.github.com> --------- Co-authored-by: kiatng <1106470+kiatng@users.noreply.github.com> Co-authored-by: Marsjohn-11 <74795701+Marsjohn-11@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com>
…d#6777) * fix(captain-hold): refuse a previous origin's answer after an incomplete hold move A hold moved to a new origin wrote its stamp and origin before the backend hold. A process stopped between those writes, or a refused hold whose rollback also failed, left the task associated with the new origin while it carried only the earlier call's answer, and complete and verify accepted that answer. Verification now treats an open, unheld task that leads with a hold-set stamp above a recorded answer as a re-hold that never completed, so the answer no longer satisfies the new origin however the move was interrupted. A refused hold also restores the body the attempt started from, and the origin lookup runs before any write, so a clean failure leaves the earlier answer valid. Closes kunchenguid#6461 * no-mistakes(review): Publish hold origins only after backend success * no-mistakes(review): Publish verified holds before origin writes * no-mistakes(document): Clarify hold-origin durability documentation and regression coverage * no-mistakes(lint): Quote done subcommand to resolve ShellCheck warning * no-mistakes(document): Clarify recorded-origin provenance guarantees
…e backend (kunchenguid#7963) * feat(backends): add experimental explicit-only hc (herdr-core) runtime backend herdr-core is the terminal core under Herdr.app and is not Herdr 1. The adapter follows the tmux shape: one login-shell terminal per task, Treehouse keeps the worktree, and fm-spawn drives it through the same send/current-path primitives. - bin/backends/hc.sh: create, capture, visible capture, send line, typed literal through hc keys, named keys, current path, composer state, submit, native busy state, recovery agent state from the foreground process and its process group, and a close that proves the terminal gone. Targets are <session>:<address>; every call pins that HC_SESSION, and an empty session never reaches hc. Task and home labels gate input and close. - bin/fm-backend.sh, bin/fm-spawn.sh: hc arms, explicit-only selection, endpoint validation, hc_session/hc_terminal metadata, secondmate refusal. - tests: fake-CLI suite and a real-hc smoke test on a private core. - docs: hc-backend.md, configuration, verification record, README links. * fix(hc): submit the spawn launch line by paste and add the hc liveness live guard The launch line always carries a + that hc keys cannot type, so fm-spawn pastes it with hc send and consumes the Enter that follows. The launch environment floor keeps HC_SESSION, HC_TERMINAL_ID, HC_TERMINAL_SOCKET and HC_SCOPE. tests/fm-backend-hc-liveness-live-e2e.test.sh launches every installed harness bare in a private core and requires alive. The verification record gains the end-to-end spawn, steer, peek and teardown run. * no-mistakes(review): Allow hc interrupt keys and drop unused hc send_literal * no-mistakes(document): Sync hc backend inventories and adapter header comment * no-mistakes(ci): Fixed. When an hc task was torn down, the kill function read the task's expected label from the wrong argument, so it ended up accepting any terminal in the same home and could close another task's worker. - Invariant: every hc close must be gated by the task label that teardown passes as the third argument to fm_backend_kill. - Where it must hold: fm-teardown.sh calls `fm_backend_kill <backend> <target> <zellij_tab_id> fm-<id>` at all its sites (around lines 3482, 3491, 3494, 3876, 3986 and 3995). The dispatcher at bin/fm-backend.sh:1156 passes "$@" through to fm_backend_hc_kill, and that function is the only hc close path. So fixing that one function's arguments covers every teardown site. - Fix in bin/backends/hc.sh:279: the signature is now `<target> [unused] [expected-label]` and it reads `expected=${3:-'*'}`, the same shape tern, rex, cmux and paseo use. The label value matches what hc terminals carry: spawn creates them with firstmate.task=$W where W="fm-$ID" (bin/fm-spawn.sh:4545 and 4955), and teardown passes "fm-$ID". - New test in tests/fm-backend-hc.test.sh, test_kill_refuses_another_tasks_terminal, goes through the public fm_backend_kill path. A terminal labeled fm-other is refused for expected label fm-a1, stays alive and gets no `hc kill`. The terminal labeled fm-a1 is closed and removed. Before the fix the test failed ("expected a refusal"), and after it the whole suite passes. - Checks: `bash tests/fm-backend-hc.test.sh` passes every test and `shellcheck -x` is clean on both files. The live smoke and e2e hc tests call kill without a label, which keeps the existing behavior of accepting any task label from this home. I did not run them because they need a real herdr-core. VERIFIED with the unit tests on the fake hc CLI, not against a real hc core * fix(hc): keep the live liveness guard from repointing the operator's claude A real claude started under the guard's scratch XDG_DATA_HOME can self-update into it and repoint ~/.local/bin/claude there, leaving the link dangling once the scratch directory is removed. Export DISABLE_AUTOUPDATER=1, as bin/fm-live-lab.sh already does for its live harnesses. * fix(hc): drop an inherited HC_SOCKET so the session pin holds * no-mistakes(document): Document hc dropping inherited HC_SOCKET for session pin * no-mistakes(ci): I fixed both Greptile findings. The hc unit suite passes all 12 tests, three runs in a row, and `shellcheck -x` is clean on the 4 touched files. VERIFIED with unit tests (a fake hc CLI plus a real process group). NOT VERIFIED against a real hc core, because the live tests need herdr-core. ci-1, live tests could stop an unrelated core - Invariant: every direct `hc` call a test makes must reach only its private scratch core, so an inherited HC_SOCKET (which wins over HC_SESSION in hc 0.1.14) must never be set. - Where it must hold: the two suites that call `hc` directly (`hc server status` at startup and `hc server stop` in cleanup), `tests/fm-backend-hc-liveness-live-e2e.test.sh` and `tests/fm-backend-hc-smoke.test.sh`. Adapter calls already go through `fm_backend_hc_cli`, which drops HC_SOCKET. - Fix: both suites add HC_SOCKET to the `unset HC_TERMINAL_ID HC_TERMINAL_SOCKET HC_SCOPE` line, before any `hc` call. ci-2, a shell wrapper running a live worker was reported as dead - Invariant: `fm_backend_hc_agent_state` may return `dead` only when neither the foreground process nor anything else in its process group is a harness. - Where it must hold: there is one classification path, `bin/backends/hc.sh` around line 326. Before the fix, the `shell` branch returned `dead` before the process-group check ran. Callers such as the inbox ring and the watcher read this value through `fm_backend_agent_state`, so fixing this one function covers all of them. - Fix: the result is now `alive` when the foreground process is a harness. Otherwise the process group is checked, which can also give `alive`. After that a shell gives `dead` and anything else gives `ambiguous`. An idle shell, whose group holds no harness, is still `dead`, and the existing test_agent_state_classifies_foreground_and_absence still passes (`t2=dead`). - New test `test_agent_state_reads_a_shell_wrappers_group` in `tests/fm-backend-hc.test.sh`. It starts a real `bash` wrapper in its own process group with a child that runs as `claude`, and points the fake hc terminal's foreground at the wrapper. With the old code the test fails ("expected 'dead', got 'alive'"). With the fix it passes. The comment in the code was updated. `docs/hc-backend.md` already describes the process-group read, so it did not need a change. Not run: `fm-backend-hc-smoke.test.sh` and `fm-backend-hc-liveness-live-e2e.test.sh`, because they need a real hc core
Brings the fork up to date with upstream (45 commits) while keeping the fork's 26 commits of its own. Conflicts were resolved so both sides' behavior survives: - CI keeps the fork's 20-runner topology (one four-worker pool, 13 serial shards, 4 lint partitions with the coverage guard and repo invariants folded in) and gains upstream's ubuntu-24.04 pins, full-ci label gate, Full suite verdict, newest-main-run cancellation, and TAP-verified macOS counts. - The supervision-host and watch-triage suites take upstream's four- and three-file splits; the fork's added cases, elapsed-time waits, cycle-trace poll waits, and per-case fixture retirement (now an FM_TEST_AFTER_EACH hook in tests/lib.sh) are carried into them. - fm-merge-local.sh applies upstream's pinned local_done_head landing (ref transaction, per-checkout lock) to both the fork's own-task and its secondmate-delegated offer landings. - fm-dispatch-resolve.sh keeps the fork's resolution and dispatch receipts, request-id capture, and jev-1.13.0 pin on top of upstream's systemone and OpenAI providers, credential sources, preferred_provider, and shared_quota. - The hc backend arrives explicit-only and stays unselected.
- fm-merge-local.sh refuses a bound local-only copy before reading the done head upstream now requires, so a child home is told to publish an offer rather than to report readiness it can never use. - Classify upstream's new opt-in warm-compaction live guard in the live-harness-optin family so the safe suite excludes it. - The landing-crew refusal test expects upstream's reworded message, which now also names --pr, and covers --pr on a landing crew.
|
Sorry @twilwa, your pull request is larger than the review limit of 150,000 diff characters |
Owner
Author
|
Review disposition for head 0e5610b:
Landing as a merge commit so the upstream history stays an ancestor of main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
i want to add a lane on syncing our fork and doing an /updatefirstmate pass when we have spare load
Later the same day: "so for now can we either move some lanes to boat for capacity and startup our updatefirstmate here or start updatefirstmate on a boat machine?" and "i don't want us to worry about box load for number of active lanes". After the fork is synced, an hc (herdr-core) trial follows as a separate task.
Context: this home runs from the captain's fork twilwa/firstmate (remote
fork); Ken's upstream is kunchenguid/firstmate (remoteupstream). The fork's main is 45 commits behind upstream/main and carries 26 commits of its own (recent CI sharding and timing, test-first brief rule #56, no-mistakes Test step approval #54, mise trust #49, process-event teardown #48, and more), and the two do not merge cleanly.What Changed
kunchenguid/firstmatemain into the fork's main and resolves the conflicts with the fork's own commits. New upstream capabilities that come in with the merge:bin/backends/hc.sh) that is only used when selected explicitlyshared_quotaopt-out, opt-in systemone/openai decision providers, and provider keys read from a declared credential sourcepr=manualregistry token, and an opt-in spawn base taken from the primary checkout for local-only projectsserver_ensure, and a perl fallback whentimeoutis not GNU coreutils. It also takes upstream's CI changes (Linux jobs pinned to ubuntu-24.04, Bash 3.2 test counts, outside PRs run the full suite only after a gate) and splitsfm-watch-triageand the supervision-host tests into smaller files.fm-merge-local.shrefuses a bound local-only copy before it reads the done head, the new warm-compaction live test is classified as opt-in so the safe suite skips it, and the landing-crew refusal test expects upstream's new wording, which mentions--pr. The hc backend is also added todocs/scripts.mdand to theFM_BACKENDsection ofdocs/configuration.md.🤖 Generated with Claude Code
Conflict resolutions
Every file
git merge upstream/mainleft conflicted, with how it was resolved. "Both" means the fork's and upstream's behavior both survive; "merged intent" marks a contract both sides changed..github/workflows/ci.yml- merged intent: keeps the fork's 20-runner topology (four-worker pool, 13 serial shards, 4 lint partitions with coverage guard and repo invariants folded in) and adopts upstream's ubuntu-24.04 pins, full-ci label gate on every lane, Full suite verdict (needing the fork's lanes), and TAP-verified macOS suites; upstream's standalone coverage/invariants jobs and two parallel shards are not added.tests/fm-ci-workflow.test.sh- merged intent: upstream's full-ci gate tests with the fork's four-tier timeout inventory; an unlabelled outside PR now runs only the Full suite verdict because the quick checks are folded into gated jobs.CONTRIBUTING.md- merged intent: fork's required job list plusFull suite, upstream's newest-main-run cancellation and full-ci section, reworded for the folded quick checks.bin/fm-test-run.sh- both: fork's 13 shards and pool lane; family lists are the union (upstream's new tests plus fork's); hint table keeps fork measurements, taking upstream's for upstream-only files and the re-split suites; drops the fork's-latefile entries.docs/fm-test-portable-shards.md- both: fork's refreshed-hint narrative and four-tier timeout table, describing upstream's four-file supervision-host and three-file watch-triage splits.tests/fm-test-run.test.sh- upstream: its updated watch-triage timing comment.bin/fm-test-isolation-proof.sh- upstream: lists its watch-triage split files in place of the fork's-latefile.tests/fm-supervision-host.test.sh,tests/supervision-host-helpers.sh- merged intent: upstream's four-file split (-drain,-hook,-park) replaces the fork's-latehalf; the fork's added hook cases, elapsed-time waits, resurface-delivery wait, engine-lookup test, and per-case fixture retirement are carried in (retirement via a newFM_TEST_AFTER_EACHhook intests/lib.sh, with its own test).tests/fm-watch-triage.test.sh,tests/watch-triage-helpers.sh- merged intent: upstream's three-file split replaces the fork's-latehalf; the fork's cycle-tracewait_poll_cycleand capture-count fix are kept.docs/supervision-host.md,docs/verification/supervision.md- upstream: name its split files.bin/fm-dispatch-resolve.sh- both: upstream's providers, credential sources, preferred_provider and shared_quota, plus the fork's resolution/dispatch receipts, request-id capture, receipt-writingemit_error, and jev-1.13.0 pin.tests/fm-dispatch-resolve.test.sh- both: upstream's canary curl stub plus the fork's header capture; the absent-key case now clears receipts the earlier upstream cases write.docs/configuration.md,docs/verification/dispatch-resolve.md- both: upstream's credential-source and provider docs plus the fork's receipts section, jev pin, and jq/no-rules behavior.bin/fm-merge-local.sh- merged intent: upstream's pinnedlocal_done_headlanding (meta and per-checkout locks, ref transaction, two-tree checkout) applied to the fork's own-task path, and the same ref transaction for the fork's delegated secondmate offer landing (verifying its import ref).bin/fm-captain-hold.sh- both: upstream's backend-hold body restore and durable-state checks, keeping the fork's rule that a deferred record is not proof of closure.docs/captain-hold-lifecycle.md- both: upstream's hold failure semantics plus the fork's--untilwording and deferred-record guarantee.bin/fm-brief.sh- both: fork's--tests, budgets, landing crew, and TDD rule plus upstream's--pr.bin/fm-dod-lib.sh- both: fork's test-scope section plus upstream'sfm_pr_text_validandno-cidriving block (keeping the fork'sfm-nm-respond.shpath).bin/fm-promote.sh,bin/fm-project-mode.sh- both: header comments name both--testsand--prand the fork's local-only seeding.bin/fm-teardown.sh- both: fork's pane-question and secondmate sleep-marker cleanup plus upstream's kiro-home removal.bin/fm-remote-entrypoint.sh- recomputed:DOCTOR_SHA256is the sha256 of the mergedbin/fm-remote-doctor.sh..agents/skills/harness-adapters/SKILL.md- both: crew-only list keeps the fork's Rovo and upstream's Kiro; AGY moves to full harness per upstream.docs/architecture.md,docs/scripts.md- both: each side's added sentence or table text.tests/fm-bearings-snapshot.test.sh- both: upstream'sfm_test_runregistration including the fork's asleep-secondmate case.tests/fm-spawn-pool-base-freshen.test.sh- both: upstream's primary-checkout base tests plus the fork's custody tests.Full-suite evidence ran off-host on fork CI for this head: https://github.com/twilwa/firstmate/actions/runs/41138432072.
Risk Assessment
Testing
I ran the merged firstmate scripts directly in disposable lab homes and compared outputs with earlier trees. Brief generation was diffed against both the fork base and upstream main. fm-merge-local was run on a bound child home before and after the reconcile fix. I also checked hc backend selection, the safe-suite and CI shard listings, and ran 8 focused existing tests plus the local-handoff suite. One live end-to-end run used the machine's real Claude login: spawn a scout crewmate, let it do the work, register a process-event source, tear down. Every live scenario passed. The mise pre-trust and Kiro adapter scenario is untested live; only its existing tests ran, and they passed. I tore down the lab homes, the private tmux server, the throwaway project's Treehouse pool and the temp trees, and the worktree is unchanged. This is a CLI/shell change with no UI, so the evidence is CLI transcripts and diffs, not screenshots.
Evidence: Brief diff, fork base vs target (ship brief identical; scout gains upstream's empty-inventory attestation; landing-crew --pr now refused)
Source: Brief diff, fork base vs target (ship brief identical; scout gains upstream's empty-inventory attestation; landing-crew --pr now refused)
Evidence: Brief diff, upstream 355a307 vs target (only fork additions; no upstream lines dropped)
Source: Brief diff, upstream 355a3071 vs target (only fork additions; no upstream lines dropped)
Evidence: Landing crew --pr refusal at target
Source: Landing crew --pr refusal at target
Evidence: fm-merge-local on a bound child home, before vs after the reconcile fix
Source: fm-merge-local on a bound child home, before vs after the reconcile fix
pre-reconcile: error: missing or malformed local done head for task t1; report readiness before approval target: error: project app in this home is a bound local-only clone; publish the work with bin/fm-local-handoff.sh offer t1 and have the parent land itEvidence: hc backend selection (explicit-only)
Source: hc backend selection (explicit-only)
Evidence: Safe-suite selection drops the warm-compact live guard at target
Source: Safe-suite selection drops the warm-compact live guard at target
Evidence: Live lab spawn of a claude scout crewmate
Source: Live lab spawn of a claude scout crewmate
Evidence: Live lab teardown transcript
Source: Live lab teardown transcript
Evidence: State after teardown (window gone, procevent source retired, no task state) and the crewmate's report
Source: State after teardown (window gone, procevent source retired, no task state) and the crewmate's report
Evidence: fm-local-handoff suite run
Source: fm-local-handoff suite run
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
Generated ship (no-mistakes and local-only), scout and landing-crew briefs withbin/fm-brief.shat the fork base d7ad7862, at upstream 355a3071 and at the target, each in its own lab home frombin/fm-lab-home.sh create; normalized the paths and randiff -uboth waysbin/fm-brief.sh t-landpr firstmate --landing-crew --pr manualat base and at targetFM_HOME=<lab> bin/fm-merge-local.sh t1against a bound local-only child home with no done head, at eb218c4f (before the reconcile fix) and at the target; then on the target with the binding removed, and with mode=no-mistakesSourcedbin/fm-backend.shand ranfm_backend_name/fm_backend_validate_spawn hcthree ways: with only an inherited HC_TERMINAL_ID, with FM_BACKEND=hc, and with config/backend=hcxargs bin/fm-test-run.sh --list --all < tests/safe-suite-exclusions.txtat eb218c4f and at the target, plus--list --family live-harness-optinbin/fm-test-run.sh --list-lanesand the union of--list --lane portable-serial-{1..13}of13compared against--list --lane portable-serialbin/fm-test-run.sh tests/fm-brief.test.sh tests/fm-brief-tdd.test.sh tests/fm-brief-test-scope.test.sh tests/fm-launch-mise-env.test.sh tests/fm-teardown-procevent.test.sh tests/fm-procevent-retire-task.test.sh tests/fm-backend-hc.test.sh tests/fm-kiro-harness.test.sh(8/8 passed)bash tests/fm-local-handoff.test.shon agit archivecopy of the target tree (28 ok, rc=0, including 'a bound local-only copy refuses to land its own work')Live:bin/fm-spawn.sh live1 <lab>/projects/demo --scout --harness claude --backend tmuxon a private TMUX_TMPDIR in a marked lab home, then waited for the crewmate's done status and reportLive:bin/fm-procevent.sh register-task lavish live1-board live1 -- /bin/true, thenbin/fm-teardown.sh live1, then checked tmux windows,fm-procevent.sh listand the state files✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.