Repository navigation
Merge upstream firstmate main into merkensoft-iris (2026-11-04) - #17
Merged
Merged
Conversation
…nchenguid#6699) Wrap the cd command in a subshell to comply with the cd-guard policy that blocks persistent top-level directory changes in the primary firstmate checkout. The subshell form (cd projects/<name> && ...) is accepted by the policy as documented in issue kunchenguid#6502. Fixes kunchenguid#6502
* Add daily startup growth check
* no-mistakes(review): watch printed startup memory, retain growth baselines, drop knobs
* no-mistakes(review): delegate budget verdict, report before publish, pin shim home
* no-mistakes(review): baseline first sightings silently, drop mtime, spare secondmates
* no-mistakes(review): cap the wake line, validate budget verdict fields
* no-mistakes(review): guard record schema, check appends, tighten assertions
* no-mistakes(review): drop arbitrary tracked library, make re-arm idempotent
* no-mistakes(review): correct tracked-set wording, restore shim guards, register artifacts
* no-mistakes(review): exit on signal instead of publishing partial record
* no-mistakes(document): correct startup-growth record removal cost in state registry
* no-mistakes(test): sweep orphaned empty startup-growth temp records on due evaluation
* no-mistakes(document): note watcher need for armed startup growth check
* no-mistakes(ci): Diagnosed "Behavior portable serial 5": the shard failed on tests/fm-contributions.test.sh in test_arm_plumbs_a_configured_budget_into_the_check_shim (inherited mode) with "generated check did not attempt a read" and a missing forge/calls file. Root cause: bin/fm-contributions.sh:379-382 computes DEADLINE=$(date +%s)+BUDGET and then gates each read on DEADLINE-$(date +%s) >= OBSERVATION_RESERVE (= min(BUDGET,15)). At the one-second budget this test uses, that gate demands zero elapsed whole seconds, so a wall-clock second boundary crossing between the two date calls makes the poll loop break before any forge read. The test calls wrap_forge (which installs a fake date reading $FORGE/clock only when that file exists) but never seeded forge/clock, so it ran against the real clock. The repo already documents this exact hazard at tests/fm-contributions.test.sh:675-677 and freezes the clock in every other budget-constrained test: test_budget_exhaustion_keeps_prior_record (both modes), test_genuine_failure_near_deadline_is_unavailable, test_reservation_defers_later_url_when_fifteen_seconds_do_not_remain, test_slow_read_deadline_kill_is_budget_refusal, test_budget_is_cut_down_to_the_watcher_check_bound. test_arm_plumbs was the only omission; its single loop body covers both the configured and inherited modes. The remaining wrap_forge users run the default 20-second budget (5 seconds of slack above the reserve) and are not reachable by this race. Fix (smallest, matching the sibling idiom): added the clock freeze `/bin/date +%s > "$home/forge/clock"` plus a two-line comment inside that test's loop, before the poll. Three added lines in tests/fm-contributions.test.sh; no production code and no other file touched. Verification: reproduced the exact CI failure message by running a scratch copy whose fake date advances one second per read (worst case of the unfrozen clock) - missing forge/calls, "not ok - generated check did not attempt a read". With the fix, the single test passes 10/10 standalone and the full tests/fm-contributions.test.sh passes all 46 assertions with exit 0. tests/fm-startup-growth-check.test.sh still exits 0. bash -n and shellcheck -S warning are clean on the edited file; scratch repro files were removed, leaving only the intended three-line change. Note for the author: this flake is not caused by this branch - tests/fm-contributions.test.sh is untouched by the PR and the race is pre-existing, surfacing only on a loaded runner (the shard's neighbouring assertions show 80+ second gaps). It was fixed because it is genuine nondeterminism with an established in-repo remedy and the check cannot otherwise go green. No work was done on the unselected greptile findings (ci-2..ci-5) or the cancelled "Behavior portable serial 2" check (ci-6)
* no-mistakes(ci): Diagnosed "Behavior portable serial 6": the omitted log section (fetched with gh api) shows the shard failed on tests/fm-calm-pi-extension.test.sh in test_hidden_block_geometry_e2e with "Pi Calm hidden-block geometry E2E did not complete the /reload viewport transition" (exit=1, duration_ms=23437; the family line pure-contract-unit count=3 duration_ms=51193 failed=1 matches devin-harness 3203 + calm-pi 23437 + task-delivery 24553). Root cause: tests/fm-calm-pi-extension.test.sh:2831 wait_for_geometry_transition detected the /reload by SAMPLING a single intermediate frame - it polled tmux capture-pane for Pi's transient "Reloading keybindings, extensions, skills, prompts, themes, and context files..." box and only accepted the rebuilt transcript afterwards (elif gated on saw_transient). Pi shows that box only while the reload runs and replaces it via dismissReloadBox when done, so on a loaded runner the box can live entirely between two polls; saw_transient then stays 0 forever and the 600-attempt wait times out although the reload fully succeeded. Reproduced locally under CPU oversubscription with CI's Pi 1.0.4: 1 failure in 8 runs, diagnostics proving the mechanism ("DIAG: transition timeout saw_transient=0 attempt=600") while the captured viewport already showed the completed reload status row and the intact collapsed transcript. Not a Pi-version regression: 1.0.4's handleReloadCommand and both banner strings are identical to the installed 0.85.1, and shard 6 of the previous pipeline run (job 112490351105) passed this same script on Pi 1.0.4. Invariant violated: a TUI E2E assertion must key off a durable state the UI retains, never off one intermediate frame polling may miss. Sibling enumeration: the helper was defined once and called once; grep for transient/saw_/two-stage waits across tests/, bin/ and .pi/ found no other one-shot-frame wait - every other wait in the file keys off durable text presence/absence or off continuously repeating animation frames (the working-ship motion checks) where sampling eventually connects; no doc or other test referenced the helper. Fix (smallest, one helper): renamed it wait_for_geometry_reload and made it wait for the durable status row Pi appends once the reload completed and the chat was rebuilt ("Reloaded keybindings, extensions, skills, prompts, themes, and context files", a persistent chat child via showStatus, present in both 0.85.1 and 1.0.4) together with CALM_GEOMETRY_FINAL. That marker is absent before the reload and never appears if the reload throws, so the check is strictly stronger than before (a failed reload now fails the test instead of passing on transient-then-final). One file changed: tests/fm-calm-pi-extension.test.sh, 2 hunks, no production code. Verification: deterministic before/after - with polls spaced 0.4s apart (the loaded-runner worst case) the pre-fix helper fails with exactly the CI message and the post-fix helper passes; 12/12 consecutive passes of the isolated test under load with Pi 1.0.4; full file 15/15 ok exit 0 under LANG=C.utf8 (matching the runner locale); bash -n, shellcheck -S warning and bin/fm-lint.sh clean; scratch repro files and the temp Pi 1.0.4 install removed, git status shows only the one intended modification. Notes: (1) the flake is not caused by this branch - that test file is untouched by the PR and the race is pre-existing; fixed because it is genuine nondeterminism and the check cannot otherwise go green. (2) Under far harsher load than CI applies a separate unrelated flake appeared in the same test: Pi's "Warning: tmux extended-keys is off..." row occasionally lands between the collapsed [skill] ahoy row and the final response, making assert_geometry_gap see 5 rows instead of 2. Different cause, never seen in CI, and its plausible remedies would change key delivery for the other TUI tests in the file, so it was left alone rather than growing this fix
---------
Co-authored-by: Quartermaster <quartermaster@users.noreply.github.com>
kunchenguid#6708) * fix: reopen a remote-reply continuity break after repair A later break for the same route and reason was swallowed after the operator resolved the first one, because the status line matched for the life of the log. The continuity ingest now appends again when the cursor has moved or retirement has reset that episode, and an unchanged re-read still appends nothing. status_event_recorded is unchanged. Its other callers are the pending-reply escalation, which already decides its own episode, the parent-channel note append, and the remote document transfer note. * no-mistakes(review): seed continuity episode for already recorded break line * no-mistakes(document): document when a remote-reply continuity break reopens * no-mistakes(ci): The adapter now stores the continuity episode record before it appends the `blocked` line, so a failed store appends nothing. The changes are uncommitted in the worktree, in `bin/fm-procevent-remote-reply.sh` and `tests/fm-remote-reply.test.sh`. **Invariant:** a continuity `blocked` line is on the parent status log only when the episode record for that break is already stored. Only the `continuity-broken` branch of `cmd_ingest` appends that line, so the fix is at that one place. **What changed in `cmd_ingest`:** - It decides first whether the break needs a line, then stores the episode record, then appends. - If storing the record fails, it stops with "cannot record continuity episode" and appends nothing. - If the line is already on the log and no episode record exists, it stores the record and does not append. **One addition you did not ask for:** if the append fails after the record is stored, the adapter puts the earlier record back (or deletes the new one when none existed). Without that, the retry would read as the unchanged repeat and append nothing, which is the issue 6701 failure again. **Deviation from your test instruction:** the test does not use `chmod` on the cursor directory. `write_continuity_episode` runs `chmod 700` on that directory before every write, so a read-only directory is made writable again. The test instead makes `mktemp` fail for the episode's temporary file in that directory, the same way the existing receipt-failure test does. **Tests added to `tests/fm-remote-reply.test.sh`:** - Store failure: the second break exits 1, appends no `blocked` line and opens no decision. One retry after storage recovers exits 3 and appends a single line. - Append failure: with the status log read-only, the third break exits 1 and appends nothing. One retry after the log is writable exits 3 and appends a single line. **Verification:** `bash tests/fm-remote-reply.test.sh` ends with "ALL TESTS PASSED" with the fix. Against the script at commit b750c828 the same test file fails at "a continuity break appended its line before its episode was stored". `shellcheck -S warning` reports only an unused loop variable at line 667 of the test file, which this change does not touch. I ran no other test files. The Greptile Review check log could not be retrieved, so I worked from the finding text alone * fix: record a continuity break's reader position on its status line A later break at another cursor is then a different line, so the existing duplicate check appends it and reopens the decision. An unchanged re-read builds the same line and appends nothing. * fix: reopen a continuity break after an identical restore A retirement that puts the same bytes back used to rebuild the recorded line, so the later break stayed closed. The retirement count on that line makes the later break distinct. * no-mistakes(review): remove continuity match for full-prefix line without retirement count * no-mistakes(document): clarify what a continuity break status line records * fix: remove the reply cursor before recording retirement A stop between those steps must leave the count unchanged, so an unchanged continuity break still builds the same line.
…is retired (kunchenguid#6733) * fix(control): drop busy_gen when an incarnation is retired A deliberate exit removed the busy sidecar and left busy_gen in the task record, so the two records disagreed about whether that incarnation was still observable. * no-mistakes(review): drop GNU-only chmod and unreached sidecar-absent branch * no-mistakes(review): correct lock comment to name the deadlock * no-mistakes(ci): The test `test_exit_drops_meta_busy_gen_with_the_sidecar` in tests/fm-control.test.sh now compares the whole task record (the `state/<id>.meta` file), so the Greptile finding is fixed. Invariant: after `exit` retires an incarnation, the task record must equal the record from before `exit` with only the `busy_gen` line removed. This test is the only place in the change that asserts the record survives the rewrite, so it is the only site to fix. The other `busy_gen` tests assert that the line stays, and they do not go through the rewrite. What changed: before `exit`, the test writes the record without its `busy_gen` line to `expected.meta`. After `exit`, the test runs `diff` between that expected copy and the real record, and fails with the diff output if they differ. This one comparison replaces the two earlier checks (no `busy_gen` line left, and the `window` line present), because it covers both. I did not change bin/fm-control.sh or any other file. How I know it works: - I ran `bash tests/fm-control.test.sh`: exit code 0, 45 lines starting with `ok`, no other lines. - I temporarily changed the rewrite in bin/fm-control.sh to also drop the `harness` line. The test then failed with `not ok - exit should drop only busy_gen from the task record:` and the diff `< harness=codex`. The earlier `window`-only check would have passed that rewrite. I restored bin/fm-control.sh afterwards; `git status` shows only tests/fm-control.test.sh modified. - `bash -n` and `shellcheck` on the test file report no new warnings from the edit. The change is not committed; the working tree holds it
…#6484) * test(secondmate-harness): scope fake ps -codex label for pid 5252 to the liveness probe Closes kunchenguid#6456 * no-mistakes(ci): Updated the collision test to log and assert that PID 5252 was queried before selecting 4242. Full fm-secondmate harness suite passes --------- Co-authored-by: YifuGu <ironerumi@users.noreply.github.com>
* fix(calm): share the standalone Pi Calm working-ship widget slot Firstmate Calm and the user-global standalone Pi Calm both install an animated working-ship widget during agent runs. Each claimed its own Pi widget key, so a session loading both (the main Firstmate home) rendered two boats. Pi replaces widgets under one key, so claiming the shared "calm-working-ship" slot keeps dual-install sessions to a single boat while a Firstmate-only session is unchanged. Pins the shared slot contract in the working-ship module test so the key cannot silently diverge again. * test(calm): pin the shared working-ship widget key in CI, document dual-install The key-parity assertion inside the Pi fixture only runs where the @earendil-works/pi-coding-agent package is installed, so CI never exercised it. Add a source-level twin that needs nothing but the tracked file, and note in docs/calm.md that the boat shares the standalone Pi Calm working-row widget slot. * no-mistakes(review): Add executable dual-install widget replacement coverage * no-mistakes(review): Guard shared widget cleanup with disposal ownership * no-mistakes(document): Document shared Calm working-ship slot behavior * test(calm): read the standalone Calm slot from its own module The dual-install check registered both boats itself under the shared slot, so it could only prove that Pi replaces a widget under one key: it would still pass if the standalone Pi Calm extension installed its boat under a different key, which is the two-boat regression the check exists to prevent. Read the standalone extension's own working-ship module when it is installed - FM_STANDALONE_CALM_SHIP, else ~/.pi/agent/extensions/calm - and drive the check with the key that module exports, so a rename on either side registers two widgets and fails naming both keys. A pinned shared-slot contract still covers a machine without the extension, and the run reports which side it used instead of passing silently over an absent extension. Verified: the touched Pi Calm suite passes and reads the installed standalone extension; with a copy of it whose key is renamed to calm-working-ship-v2 the suite fails naming the drift. * no-mistakes(review): Gate stock-row restoration by shared-widget ownership * no-mistakes(review): Removed redundant widget-key source assertions * no-mistakes(document): Document shared Calm working-ship widget ownership
…id#6649) * fix(herdr): make exact-resume presentation-lock wait instead of a bounded timeout The exact-resume path in bin/fm-spawn.sh used the same 50-attempt-then- give-up lock acquire as the new-task-create path, but the two paths are not equivalent on contention: a create has no prior state to strand and can safely fall back to a flat layout, while a resume is recovering a specific existing identity that a concurrent recovery may legitimately be holding the lock for. Giving up there does not degrade gracefully, it hard-fails the resume outright. The suite's own concurrent cross-home recoveries test already asserts both concurrent recoveries succeed with a genuine reclaim, and the file's header comment already (inaccurately) claimed lock contention falls back to the ordinary flat layout for both paths alike, so the intended contract was always that recoveries serialize and both succeed, not that either one refuses under a short bound. Give spawn_herdr_presentation_order_lock_acquire a wait mode that uses this file's own established fm_lock_acquire_wait idiom (already used for its other fleet-shared locks) instead of the bounded loop, and use it only at the exact-resume call site. The new-task-create call site is unchanged and keeps its bounded-then-flat-fallback behavior, which is already covered by its own passing test. Dead-owner PID-liveness reclaim inside fm_lock_try_acquire still bounds the wait against a holder that crashed mid-hold. Adds a deterministic regression test that holds the shared session lock from an unrelated process for well past the old bound, then asserts the resume succeeds with a genuine reclaim and took close to the full hold duration, so a fix that merely widens the bound rather than genuinely waiting is still caught. The existing concurrent cross-home recovery test exercises this under real timing but does not reliably outlast a fixed bound on its own. Corrects the header comment's claim that create and resume share one bounded-then-flat-fallback behavior on lock contention; they no longer do. * no-mistakes(document): Document Herdr recovery waiting for presentation lock * no-mistakes(document): Update stale hard-refusal claim in verification log * no-mistakes(ci): Fixed the Greptile finding on tests/fm-backend-herdr-presentation-e2e.test.sh:1389 by bounding the resume lock-wait regression's spawn_task call. Added an optional 4th `deadline_seconds` arg to the `spawn_task` helper (defaults to empty, so all ~20 other existing call sites are unaffected and unwrapped by `timeout`). The lock-wait test now passes `LOCK_WAIT_HOLD_SECONDS + 60` (90s) as the deadline, and a dedicated check for exit code 124 emits a clear "hung for over Xs instead of waiting out a Ys lock hold" diagnostic before falling through to the existing pass/fail assertions, which are unchanged. No product code was touched. Verified with `bash -n`, `shellcheck -x` (no warnings), a standalone reproduction of the timeout/no-timeout/success paths, the project's `bin/fm-lint.sh --fast` on the file (clean), and the full `tests/fm-lint.test.sh` suite (all 46 assertions pass) * no-mistakes(ci): Replaced the direct `timeout "$deadline_seconds"` call in `spawn_task()` (tests/fm-backend-herdr-presentation-e2e.test.sh) with the repo's portable bounded-execution helper: sourced `bin/fm-timeout-lib.sh` at the top of the file and changed `deadline_cmd=(timeout "$deadline_seconds")` to `deadline_cmd=(fm_run_timed "$deadline_seconds")`. This removes the GNU/BSD `timeout` dependency that would fail with exit 127 on a stock macOS host without coreutils, while preserving identical semantics (exit 124 on bound-hit, command's own exit otherwise), which the existing `[ "$LOCK_WAIT_STATUS" -eq 124 ]` diagnostic check already relies on. Verified: `bash -n` syntax check, `bin/fm-lint.sh --fast` clean, full `tests/fm-lint.test.sh` suite (46/46 pass), and a standalone repro confirming `fm_run_timed` returns 124 on timeout and 0 on success identically to the prior `timeout` call. No other direct `timeout` calls exist in this file or elsewhere in the PR's diff, so no sibling sites remain * fix(herdr): gate exact-resume lock wait behind --herdr-resume-lock-wait Keep refuse-by-default on presentation-order lock contention for Herdr exact resume. Callers that need concurrent recoveries to serialize must pass --herdr-resume-lock-wait; unbounded blocking on a third-party session lock is never the default. Update docs and the real-Herdr e2e suite so the default path asserts the refusal and the opt-in path asserts the wait. * no-mistakes(test): Fix e2e test's lost exit status after if/fi with no else branch * docs(herdr): stop advertising --herdr-resume-lock-wait on --relaunch The relaunch path reuses the recorded endpoint and never takes the presentation-order lock, so the flag is inert there. Drop it from the --relaunch usage line and state where the flag applies. * no-mistakes(review): Clarify lock-wait docs; simplify bash-3.2-safe spawn_task helper * no-mistakes(ci): Fixed ci-1 (Greptile P2). In tests/fm-backend-herdr-presentation-e2e.test.sh, the failure cleanup `cleanup_all` stopped only `LOCK_CONTENTION_OWNER_PID`. It now also stops `LOCK_REFUSE_HOLDER_PID` and `LOCK_WAIT_HOLDER_PID`, the holders of the two new contention cases, so a `fail` before their explicit `wait` no longer leaves them running. Both new PIDs are initialised empty next to the existing one, and each is cleared right after its successful `wait` so cleanup never touches a finished PID. I changed nothing else. `bash -n` passes. The real Herdr e2e run passed both new cases ("default resumed identity refuses session lock contention" and "--herdr-resume-lock-wait waits out session lock contention instead of refusing"). The full run hit my 550s timeout in a later, unrelated case, after the new cases passed
….2 (kunchenguid#6762) * fix(bin): let TERM stop a watcher blocked in a pane capture on bash 3.2 Stock macOS bash 3.2 holds a HUP or TERM until a running command substitution's child exits, and the watcher read every pane through $(fm_backend_capture ...). A blocked backend read therefore held the watcher's stop for as long as the read lasted, and a stopped watcher left the hung read orphaned. tests/fm-watch-triage.test.sh test_term_stops_a_watcher_blocked_inside_a_poll failed on /bin/bash 3.2 for this reason while passing on bash 5. Pane captures now go through watcher_capture, which runs the read as a waited background process group recorded like a check's, so the stop is honored at once and watcher_cleanup stops a read still in flight along with its per-call output file. * no-mistakes(review): Run drain-ring idle capture in watcher shell, add regression test * no-mistakes(document): Document watcher TERM handling for blocked checks and captures * no-mistakes(test): Silence bash 3.2 setpgid race noise from watcher captures * fix(bin): verify the capture group and scope the stop claim to pane reads watcher_capture now confirms its background read leads its own process group, as run_check_capture already does, so watcher_cleanup never relies on a group that set -m failed to create. The comment and continuity doc now say only fm_backend_capture pane reads go through watcher_capture; agent-state and composer-state reads still run inside command substitutions.
* feat(spawn): add per-home worker tool exclusions Add an optional per-home config/crew-exclude-tools file listing tool names to hide from workers, one per line, with blank lines and # comments allowed. It applies to every ship and scout launch and relaunch in that home, is never inherited by another home, and does not affect secondmate agents. Pi and pi-signed apply it through --exclude-tools, which also covers MCP tool names. Any other runtime, and a raw launch command, refuses the launch when the list is non-empty rather than ignoring it. Malformed entries are refused before provisioning, and before a relaunch stops a running worker. Exclusions that match no tool in the worker's loaded registry are reported as unverified warnings in its status record instead of refusing the worker. Closes kunchenguid#6744 * no-mistakes(review): Preserve UTF-8 exclusion paths and verify Pi lifecycle behavior * no-mistakes(document): Clarify worker tool exclusion documentation * no-mistakes(ci): Fixed ci-1 in bin/fm-exclude-tools-lib.sh: a failed read now returns an error before printing names, so all shared launch and relaunch callers refuse rather than silently dropping exclusions. Added deterministic regression coverage for a file disappearing after readability checks across Pi/pi-signed ship and scout launches. Reproduced the original failure; verified 83 spawn checks, 77 relaunch checks, direct parser/runtime failure cases, full targeted lint, Bash syntax, and git diff --check. Relaunch tests passed with existing fixture-cleanup permission warnings. ci-2 remains unchanged per the user's decision; the outer executor owns the fresh CI run
kunchenguid#5343) * refactor(bin): share the local Firstmate home walk from the wake library Teardown's walk over the root home and its registered local secondmate homes moves into bin/fm-wake-lib.sh as fm_local_firstmate_state_dirs, next to fm_firstmate_root_home, so a second consumer can count task records across this machine's homes without a copy. Teardown keeps its exact refusal wording through a thin wrapper. * feat(bin): defer spawns beyond a project's declared machine capacity A project whose machine-local resource only serves a few workers at once had no way to tell Firstmate so: every queued item was launched, and the surplus workers spent full-context turns retrying the resource. config/project-capacity in the root home now declares how many workers each named project admits at once on this machine. bin/fm-spawn.sh counts the ship and scout records on the same project origin across the root and its local secondmate homes, skipping ones whose ready PR is recorded, while holding the shared project lock through publication. A spawn with every place held exits 75 before any brief render, endpoint, worktree, record, or backlog move, so the item stays queued; batches report it as deferred. Undeclared projects keep today's uncapped dispatch, and an unreadable declaration refuses rather than guessing the limit. Refs kunchenguid#4237 * no-mistakes(review): Document that capacity matches the clone directory name * no-mistakes(document): Rewrap stale fm-wake-lib root-home doc comment * no-mistakes(review): Dedupe local state dirs by identity to avoid double-counting * no-mistakes(document): Rewrap fm_local_firstmate_state_dirs error doc comment * no-mistakes(ci): I fixed all four Greptile findings. All 14 tests in tests/fm-project-capacity.test.sh pass, and shellcheck at warning level is clean on the changed files. Each new test failed against the old code and passes now. - **ci-1 (spaced names):** a declaration line must give a name its capacity whenever the name is a valid clone directory name. `fm_project_capacity_lookup` now trims each line, skips blank lines and lines whose first non-blank character is `#`, and takes the last field as the capacity. Everything before that field is the name, so it may contain spaces. The old error cases still refuse: a single field is rejected, and trailing text leaves a last field that is not an integer. The library header and docs/configuration.md now say a name starting with `#` cannot be declared. New test `test_spaced_project_name_is_declared` declares `my heavy project 1` next to an indented comment line and gets a deferral. - **ci-2 (unreadable records):** the holder count must never silently leave out a holder. `fm_project_capacity_occupants` now refuses when a local home's state directory exists but cannot be read or listed, or when a `.meta` file cannot be read. The error names the path, and `fm-spawn.sh` shows it in its existing refusal message. New test `test_unreadable_holders_refuse_admission` covers an unreadable record in the root home and an unreadable state directory in a registered local secondmate home, then checks that the spawn is admitted once both are readable. The test is skipped when run as root. - **ci-3 (Orca lock):** any spawn that can become a holder for a capped project must take that project's lock. The lookup now also reports whether the declaration caps any project at all, and an Orca spawn takes the per-origin lock whenever it does. This covers every capped same-origin clone. It also covers some cases where no same-origin clone is capped, because a spawn cannot find clones under other directory names without searching for them. With no declaration file, Orca still skips the lock. The comments in the library and in the `fm-spawn.sh` header are updated. The Orca test now clones the origin as `project-2`, which has no declaration, and checks that its Orca spawn refuses while the lock is held and publishes no record. - **ci-4 (worktrees):** `assert_nothing_created` now also compares the project's `git worktree list` from before and after a deferred spawn. Both tests that call it take that snapshot first. Files changed: bin/fm-project-capacity-lib.sh, bin/fm-spawn.sh, docs/configuration.md, tests/fm-project-capacity.test.sh * fix(bin): declare capacity for a project name that begins with # A clone directory whose name begins with # was skipped as a comment, so that project stayed uncapped. A line is a declaration when the # is written against the rest of the name and the line ends with a capacity; a # followed by whitespace stays a comment. * no-mistakes(document): Rewrap project-capacity library header comment * no-mistakes(ci): Lint 2 fails because this PR's code pushes ShellCheck past its memory cap. ShellCheck ran out of memory analyzing bin/fm-teardown.sh in CI (reason=memory, rc=251, peak about 8.39 GB). On current main the same file passes at about 7.29 GB. **Cause:** the new `fm_local_firstmate_state_dirs` function in bin/fm-wake-lib.sh had a conditional `. fm-secondmate-registry-lib.sh` with a `# shellcheck source=` directive inside the function. ShellCheck followed that source again, inside a function scope, wherever fm-wake-lib.sh is sourced, and bin/fm-teardown.sh is the heaviest root that sources it. Measured locally with `shellcheck --norc --external-sources bin/fm-teardown.sh`: - current main (fd325b1): 7.29 GB - main merged with this PR: 7.86 GB - the same merge without the in-function source: 7.27 GB **Rule this restores:** this change must not make any lint root heavier than it is on main. That function holds the only new nested source in the change. **Fix:** I removed the in-function source, which no caller needs. Both callers already load the registry library at top level before calling the function: - bin/fm-teardown.sh sources it directly. - bin/fm-spawn.sh, the only user of bin/fm-project-capacity-lib.sh, gets it through bin/fm-ff-lib.sh. I also documented the requirement in the function's comment and in the "Requires" note in bin/fm-project-capacity-lib.sh. No behaviour changes. **Verification:** - ShellCheck on head: bin/fm-teardown.sh peaks at 7.12 GB and bin/fm-spawn.sh at 6.68 GB, both with rc=0. bin/fm-wake-lib.sh and bin/fm-project-capacity-lib.sh lint clean. - tests/fm-project-capacity.test.sh, tests/fm-teardown.test.sh (102 ok) and tests/fm-teardown-endpoint-safety.test.sh all pass. Files changed: bin/fm-wake-lib.sh, bin/fm-project-capacity-lib.sh * fix(bin): release the Herdr session lock when reclaim finishes A concurrent resume in another home waits five seconds for that lock. Reclaim is the last presentation change on the recovery path, so holding the lock through the launch tail made the waiter time out. The contributions arm check also freezes its one-second clock, the same way the budget tests do, because an unfrozen clock can tick past before the first forge read. * no-mistakes(review): Keep Herdr session lock through launch handoff after reclaim * no-mistakes(review): Skip the spawning task's own record in capacity count * no-mistakes(review): Restore release test comment above its test * docs: scope PR-ready re-evaluation to a declared project capacity A ready pull request frees a place only when that project declares capacity, so the always-loaded backlog contract should re-evaluate on that handoff only in that case.
… section (kunchenguid#6785) fm-procevent-lavish.sh read labels tag=message rows SESSION-ENDING MESSAGE only when session_ended is true and CAPTAIN MESSAGE otherwise, but the count line always said session_ending_message_count. Several composer messages on a still-open board were therefore counted as session-ending. The count line now follows the same session_ended switch: session_ending_message_count once the session ended, captain_message_count otherwise. Message rows stay out of the annotation count, per triage. Fixes kunchenguid#6743
…henguid#6780) The Herdr presentation lock namespace was the fixed machine-global /tmp/firstmate-herdr-presentation, so on a host where two OS users run Firstmate on Herdr the first account to create it owned it and every teardown from the other account was refused with no way to clear it. Suffix the namespace with the account uid. The owner-uid and mode-700 checks are unchanged, so a foreign-owned or wrong-mode name at this account's path is still refused and never adopted, chowned, or removed. Fixes kunchenguid#4716.
…te (kunchenguid#6809) The OpenCode session plugin's shouldArm kept its own copy of the need test that only looked for in-flight task records, while the turn-end guard decides with fm_supervision_needed in bin/fm-supervision-lib.sh, which also counts registered process-event sources and trusted custom checks. With an empty fleet but any registered source or check, the guard blocked every turn end while the plugin declined to arm - a loop the guard's own repair line could not resolve because it names the plugin as the fix. The plugin now delegates the decision to the shared predicate through bash, keeping the local away-record decline and the x-mode.env arm override. OpenCode plugin test fixtures now carry the real predicate their arming path sources, and the arm suite gains six cases asserting the plugin's decision against the shared verdict over the same synthetic state directories. Co-authored-by: Mia Sun <mia@Bigs-Mac-mini.localdomain>
kunchenguid#6792) * fix(bin): resolve a pending reply only from its own task's status line Remote reply ingestion handed every corr= token in a mate's payload to fm_pending_reply_try_resolve together with that mate's own status log, so one mate echoing another mate's token resolved the other request. Honor a status-file override only when it is the record's own parent_status, and match the corr= token as a whole word. Fixes kunchenguid#6538 * no-mistakes(document): docs: scope remote reply settlement to the asked mate
…nguid#6784) agent-skill-trigger-index claims to be the complete agent-only trigger index but omitted operational-home-layout, session-start-recovery, validation-supervision, ship-landing, scout-completion, and away-quiet-supervision. Add each with its own description's trigger, placed beside the related entries. The decision-hold-lifecycle redirect stub stays out, per triage. Fixes kunchenguid#6503
…nchenguid#6814) * test: share a rename-safe agent stand-in across liveness suites On Ubuntu 26.04, `sleep` is the uutils multicall binary, which refuses to run when invoked through a symlink named after another utility. The Herdr descendant process-walk tests built their agent-named process as a `pi` symlink to the host `sleep`, so the process exited at once, its parent shell was gone before the walk ran, and both cases read `unknown unreadable` and failed on that host. The suite stops at its first failure, so every later case went unrun. The Herdr control smoke test's `claude` symlink has the same construction. The tmux liveness suite already solved this with a host-compiled spinner and a survival-checked `sleep` fallback. That builder moves into tests/lib.sh as fm_agent_standin, and the tmux suite, both Herdr descendant cases, and the Herdr control smoke test now use it. When no stand-in can survive a foreign name, a case skips with the reason instead of failing. tests/fm-test-fixtures.test.sh gains a portable regression with a fake multicall `sleep`, so it bites on hosts whose own `sleep` is single-purpose. * no-mistakes(document): Correct Herdr verification fixture reference * ci: retrigger cancelled shard
…he Stop hook's group is torn down (kunchenguid#6787) * fix(bin): keep the supervision host's pass-through successor out of the hook's process group The successor a main-only pass-through leaves for main shared the Stop hook's process group, so the harness tearing that group down after the exit-2 rewake stopped it. The stop published downtime and the next park's first cycle announced an empty check: rearm-resurface, which woke main again in a loop. Start that successor in a process group of its own, as the hook's own handling successor already is. * no-mistakes(review): Give the at-turn successor left for main its own group * no-mistakes(document): Document own-group successor for turn-start hand-back too * no-mistakes(ci): I made the change you asked for: both new teardown tests in tests/fm-supervision-host.test.sh now call the existing `stop_home_processes "$home"` just before `pass`. The tests are `test_successor_left_at_the_turn_survives_the_hook_process_group_teardown` and `test_pass_through_successor_survives_the_hook_process_group_teardown`. No production code and no other tests changed. The rule broken was that a test must not leave a home's watcher or arm processes running after it passes. These two were the only cases in the changed area that broke it. The other host+hook tests already stop their home, and `test_successor_close_during_main_turn_is_delivered_at_the_next_turn_end` leaves its watcher behind too, but it is an older test you said not to touch. The only reason anything was left over is that the successor's arm now sits in its own process group, outside the hook's teardown. `stop_home_processes` kills the watcher by the pid in its lock file, which stops it no matter which group it is in. **Checks run:** - I ran just these two tests from a scratch copy of the suite (since deleted). Both pass in about 13 seconds. - After each test, a process listing filtered to that test's home directory came back empty once the processes had about a second to exit after TERM. - `bash -n` on the test file passes. - `shellcheck` is not installed here, so I did not lint the file. - I did not run the full serial-2 suite locally. Whether it now finishes under its 30-minute limit will only show on the next CI run
…ters (kunchenguid#6823) * test: use idle composer readiness for Claude tmux guards * no-mistakes(test): Fix attended supervision test expectations and isolate worker state * no-mistakes(document): Correct live guard coverage and readiness documentation * no-mistakes(ci): Captain, fixed SC2100 by quoting the cursor-agent assignment in tests/fm-host-mirror-live-e2e.test.sh. Reproduced the failure before editing; pinned ShellCheck lint on both PR test files, bash syntax checks, and git diff --check now pass * test: preserve attended successor close assertions * no-mistakes(test): Fix attended live test watcher takeover expectations * no-mistakes(document): Correct stale attended guard documentation * Revert "no-mistakes(document): Correct stale attended guard documentation" This reverts commit 8e59d89. * Revert "no-mistakes(test): Fix attended live test watcher takeover expectations" This reverts commit c0b8510.
* test: order stale watcher-lock fixture races explicitly * no-mistakes(review): Removed duplicate stale-steal reap call
…ting server (kunchenguid#6920) * fix(bin): keep herdr composer probes observable-only without autostarting server - Refuse bare pane identifiers lacking session prefix in fm_backend_herdr_parse_target - Add fm_backend_herdr_target_observable to passively verify server liveness without autostarting - Route visible viewport captures through fm_backend_herdr_target_observable - Detach stdin with </dev/null on background server launch in fm_backend_herdr_server_ensure - Add unit and regression tests in tests/fm-backend-herdr.test.sh * fix(bin): drop parse_target colon restriction to preserve existing fixtures Revert the fm_backend_herdr_parse_target colon check so that single-colon session targets like sess:p1 in secondmate liveness and other fixtures parse properly. The probe path remains observable-only via fm_backend_herdr_target_observable.
…kunchenguid#6956) * test: clear inherited Git repository location in fixture helper An absolute GIT_DIR inherited from the caller (a linked-worktree hook exports one) overrides the discovery that git -C implies, so fixture setup moved the caller's branches and registered fixture worktrees in it. tests/git-config-helpers.sh now unsets GIT_DIR, GIT_WORK_TREE, GIT_INDEX_FILE and GIT_COMMON_DIR alongside the config isolation. Fixes kunchenguid#6953 * no-mistakes(document): Document fixture Git location isolation in CONTRIBUTING
…nchenguid#6830) * fix(bin): stage contribution-input JSON via temp files The contribution-input branch passed the whole canonical backlog document to jq as a single --argjson argv argument. A large fleet's backlog JSON exceeds Linux MAX_ARG_STRLEN (128 KiB), so jq fails with E2BIG (Argument list too long) and the contribution-input snapshot emits empty output, breaking the bearings contribution path. Write both the backlog and task documents to a temp directory and hand them to jq with --slurpfile, matching how the full snapshot path already stages the same pair. Output is unchanged for any backlog that fits in argv. * no-mistakes(document): Correct contribution cleanup trap comment
) * fix(bin): arm the busy contract on secondmate launches A tmux-backed secondmate's active-turn gate can only see a busy verdict from the parent home's record, and those launches never armed it. * no-mistakes(review): Reopen secondmate busy on blocked Claude Stop; drop muse guard * no-mistakes(review): Make Claude secondmate Stop guard the sole Stop-state writer * no-mistakes(review): Record live rewake UserPromptSubmit evidence and add regression * docs: record Claude secondmate Stop guard as busy writer * no-mistakes(review): Keep Stop idle hook for older secondmate guards * no-mistakes(document): Correct stale omp secondmate -e rationale in supervision verification * no-mistakes(document): Fix skill-relative turnend-guard link in Claude harness reference * no-mistakes(ci): Root cause: in shard 9, the pure-contract-unit family ran two scripts, tests/fm-rovo-harness.test.sh (14712 ms) and tests/fm-omp-harness.test.sh (10335 ms). Those two durations add up exactly to the failing family's 25047 ms. The failing one was tests/fm-omp-harness.test.sh. Its test_secondmate_launch_relies_on_discovery still asserted the old contract: that an omp secondmate launch names no -e and gets no state/<id>.omp-ext.ts. This PR (issue kunchenguid#4268) deliberately changed that. bin/fm-spawn.sh now arms the busy contract for omp secondmates, so their launch names `-e state/<id>.omp-ext.ts` and writes that extension. The primary extensions are still left to auto-discovery. The harness reference docs were updated to match, but the test was not. The fix is test-only and touches just tests/fm-omp-harness.test.sh. The test now asserts that the secondmate launch names exactly one -e and that it points at the parent-home state/sm.omp-ext.ts. Because only one -e is allowed, the tracked .omp/extensions files are not named a second time, which would load them twice. The test also asserts that the extension file exists, and the header comment for contract 3 was updated. The posture overlay, --cwd, marker, and supervision-model assertions are unchanged. Verification: the host's load average was about 140 on 8 cores, and the full script timed out locally after 590 s having finished only its first 2 tests. So I ran the one affected test function on its own through the real fm-spawn path, and it passed (`ok - fm-spawn: a real omp secondmate launch loads only the busy -e and auto-discovers its primary extensions`). The remaining omp tests were not re-run locally. shellcheck on the file reports only existing info-level notices. The change is left uncommitted for the outer executor * test: keep the secondmate busy stall gate visible after main's liveness probe The merged watcher treats a window-name inventory miss as a missing endpoint and exits a later checkpoint on the previous quiet run's recovery wake. The fake pane now answers both list-windows formats, and each observation starts without a leftover downtime marker, so a busy mate still defers the stall and an idle mate still surfaces it. * no-mistakes(review): Align fm-spawn secondmate comments with omp -e and devin refusal * no-mistakes(document): Document secondmate busy extensions in configuration reference * no-mistakes(test): Make live busy-contract guard clean up read-only lab dirs * fix(bin): pass Claude secondmate busy hooks through --settings Rewriting a persistent mate home's settings.local.json drops the captain's saved permissions. The hooks now live in a parent-state file Claude Code loads for that session only. * no-mistakes(review): skip busy arm for raw secondmate launch commands * no-mistakes(review): retire earlier busy arm on raw secondmate respawn * no-mistakes(review): retire Stop pointer on relaunch, load --settings in live guard * no-mistakes(document): Document secondmate Claude settings file and raw-launch exception * no-mistakes(ci): The check "Behavior portable serial 9" failed because of this PR, and I fixed it with a test-only change; `tests/fm-spawn-dispatch-profile.test.sh` now passes locally in full. Cause: the one failing test was "claude secondmate launch settings JSON does not disable Claude attribution" in `tests/fm-spawn-dispatch-profile.test.sh`. This PR makes a claude secondmate launch pass `--settings` as a file path (`state/<id>.claude-settings.json`) instead of inline JSON. The test helper `claude_settings_json_arg` handed that path string to jq as if it were JSON, so jq reported a parse error. The product behavior is correct: the file does carry `feedbackDrafts` and the attribution-off policy. Invariant: a test that checks the Claude launch settings must read the settings Claude would load, whichever form `--settings` takes (inline JSON or a file path). The only place this must hold is `claude_settings_json_arg`, the single reader of the `--settings` value in the tests. Its two callers, `assert_attribution_policy` and `assert_attribution_policy_absent`, both go through it. Fix: `claude_settings_json_arg` now prints the value when it starts with `{` and prints the file contents otherwise. No product code changed. Verification: I ran `bash tests/fm-spawn-dispatch-profile.test.sh` in the worktree. It ended with "all fm-spawn-dispatch-profile tests passed", including the previously failing secondmate case and the crewmate and keep-ai-trailers cases that use the inline form. I did not run the other tests of shard 9; they passed in the CI run and this change touches only this test file. The change is uncommitted in the worktree (one file modified)
…ailures (kunchenguid#7036) The large-backlog regression already proved the json and secondmate home-summary modes stay within exec limits. It now also runs the contribution-input mode on the same 1200-record backlog, which is the path kunchenguid#6830 moved off argv. With that fix reverted the test fails with the field error jq Argument list too long at the contribution-input call.
…urn (kunchenguid#5843) * fix(teardown): scrub nested repos before return Treehouse return uses git clean -fd, which leaves a nested git repository in the pool slot. Scout and forced teardown run git clean -ffdq first. A return that stays dirty names the lost slot instead of reporting a clean return. * no-mistakes(review): Report lost pool slots early and scrub forced child copies * no-mistakes(review): Drop misleading no-rerun clause from lost-slot message * no-mistakes(document): Note failed status read in teardown dirty-return header * no-mistakes(ci): I fixed ci-1 and ci-2 in bin/fm-teardown.sh, and I added tests in tests/fm-teardown.test.sh. Invariant (ci-1): a lost-slot finding must only warn. It must never change the teardown exit status. Two places must obey this: the final status block, and the remote success path that a forced remote retirement uses. - The final block no longer runs `exit 1`. When a slot is lost, teardown writes a lost-slot line to stderr instead of the clean "teardown X complete" line. Then backlog_refresh_reminder runs and teardown exits with its normal status. - Before this change, remote_secondmate_teardown discarded the remote output when the remote run succeeded. Now it sends that output to stderr. Without this, the remote lost-slot warning would not reach the operator once the remote side exits 0. - I updated the header comment to match. Invariant (ci-2): after a return that succeeds, teardown must verify every returned copy, or it must warn that it could not. This invariant is enforced inside teardown_note_dirty_return, which both return sites call (the main WT return and the forced-secondmate child return). Before, a copy that was missing or not a readable git worktree caused a silent `return 0`. Now it sets the lost flag and gives the same warning, with the text "cannot verify: the copy is missing or not a readable git worktree after return". Both call sites run only for a copy that existed before the return. The exit status does not change. Tests: - The dirty-return test now expects exit 0 and the warning. - New test (z3d): a forced secondmate teardown whose child return leaves residue. This is the same command that `retire --force` runs on the remote host. The test expects exit 0 and the warning, and it checks that the task record and the home are removed. - New test (z3e): a return that removes the copy's .git. The test expects exit 0, the "cannot verify" warning that names the copy, and no clean completion line. Verification: - I ran the new and updated tests against the old script. Three failed as expected (exit 1, or no warning). With the fix, all of them pass. - The full tests/fm-teardown.test.sh suite passes: 117 ok, 0 not ok. - shellcheck shows no new warnings. - tests/fm-remote-secondmate-lifecycle-e2e.test.sh is still running. It covers the remote success path that now relays output. Up to now it has no failures, but it has not finished, so I cannot report a final result for it * no-mistakes(ci): I fixed ci-1 and ci-2 as one exit contract, as the user asked. The changes are in bin/fm-teardown.sh, tests/fm-teardown.test.sh, and tests/fm-remote-secondmate-lifecycle-e2e.test.sh. Invariant (ci-1): when a returned slot is dirty or cannot be verified, teardown must finish every cleanup step and then exit with exit code 4. Exit 4 is used for nothing else. It must hold in two places: the final status of a local teardown, and the remote secondmate retirement caller. - Local: the existing lost-slot flag now leads to `exit 4` (TEARDOWN_LOST_SLOT_EXIT). This exit comes after the task record is removed, the warning is printed, and backlog_refresh_reminder runs. A clean return still exits 0. Refusals and errors exit 1, and an invalid request exits 2. The header documents all of these codes. Exit 3 is only an internal "not remote" return. The ssh transport uses 255. - Remote caller: remote_secondmate_teardown treats a remote exit 4 as "retired with a lost-slot warning". It does the full local retirement (route, registry line, reply source, records, summary refresh), prints the normal completion line on stdout, and then returns 4. The remote control script runs fm-teardown.sh as its last command, and fm-on.sh execs ssh, so the remote 4 reaches the local side unchanged. Invariant (ci-2): remote output goes to local stderr only when it is a lost-slot warning. - After a clean remote retirement (exit 0), the caller no longer prints the captured remote output. - After exit 4, the caller forwards only the lost-slot warning header and the remaining-path lines. To make those lines easy to find, teardown_note_dirty_return now indents each remaining path by two spaces. Tests: - The dirty-return (z3), forced-secondmate dirty-child (z3d), and copy-removed (z3e) tests now expect exit 4 after cleanup. The clean scout return (z1) still expects 0. - The final remote retirement in the e2e test now uses a fake-ssh mode, retire-lost-slot. In this mode the real remote retire runs, and then the fake reports a lost child slot with exit 4. The test checks the following: exit 4; the remote home, parent metadata, and route are removed; stdout has "teardown ios complete (remote"; stderr has the warning and the remaining path; and stderr does not contain the remote completion text. The remote side producing exit 4 is covered by z3d. Verification: - tests/fm-teardown.test.sh: 117 ok, 0 not ok. - tests/fm-remote-secondmate-lifecycle-e2e.test.sh: ALL TESTS PASSED. - shellcheck shows the same warning count as before on all three files. - Against the previous script, both suites fail as expected. In the local suite, dirty-return expected 4 but got 0. In the e2e test, the stdout local-completion check fails * no-mistakes(ci): Both CI failures came from the lost-slot check that this PR added. Shard 3: tests/fm-secondmate-safety.test.sh "force teardown failed to discard child work". Shard 7: tests/fm-teardown-endpoint-safety.test.sh exited 4. The check ran after the return of every copy. Treehouse return removes a copy that is not a pool slot, so the check reported "cannot verify" and teardown exited 4. Before the fix, both failures happened on my machine. Invariant: only a Treehouse pool slot can be lost by the pool, so the check runs only for a copy that was a pool slot before the return. Fix in bin/fm-teardown.sh: both return sites (the main WT return and the forced-secondmate child return) now run fm_treehouse_pool_slot before the return. They call teardown_note_dirty_return only when the copy was a pool slot. teardown_note_dirty_return lost its pool-slot branch and its unused proj argument; the slot label still comes from the path of the copy. Test fix: in tests/fm-teardown.test.sh, the z3d child copy was not a pool slot. It is now a real pool slot (pool/6/repo plus treehouse-state.json), and the test still expects exit 4 and the warning. Verification: endpoint-safety 27 ok, exit 0. secondmate-safety 79 ok, exit 0. fm-teardown 117 ok, 0 not ok. remote-secondmate-lifecycle-e2e ALL TESTS PASSED. shellcheck count is unchanged (17) --------- Co-authored-by: Nova Agent B <novaagentb@gmail.com>
…nguid#7047) * fix(tests): keep backlog suites hermetic against a local .tasks.toml Fixture homes now write the tracked markdown defaults through a fm_test_tasks_toml helper instead of copying the checkout's .tasks.toml, which an operator may override with a beads backend at a live backlog. The backlog handoff and receive moves pin --backend markdown, because they already name their markdown files and otherwise resolve the backend from the caller's working directory. The atomicity suite runs from its scratch root so its direct tasks-axi fixture calls cannot read the checkout config. * no-mistakes(review): Add decoy-cwd .tasks.toml regressions for handoff and receive * no-mistakes(lint): Reuse sha256_file helper to fix SC2015 in remote handoff test
…nchenguid#7076) * fix(bin): parse whole project name in home seed registry queries Parse the full project name after the dash in fm-home-seed.sh registry lookups. This matches the round-3 bootstrap mirror check parser so spaced names resolve. Cover both the project-less seed refusal guard and registry line lookups in tests. * no-mistakes(review): Match registry rows by name prefix plus separator * no-mistakes(document): Note shared registry row-match rule in fm-home-seed
…d#4490) * fix(codex): preserve announced recovery across checkpoints * no-mistakes(review): Make announced-recovery checkpoint test reproduce the regression * no-mistakes(review): Separate 2026-10-07 checkpoint fixture verification from original run * no-mistakes(test): Defer TERM exit to clean up quiet checkpoint watcher locks * no-mistakes(document): Update checkpoint recovery and signal documentation * no-mistakes(ci): Updated both lock-acquire retry loops to honor the watcher’s TERM stop status, so held-marker cleanup exits while retaining stale lock evidence. Set the --stop test’s watcher poll to 1 second to fit its 5-second stop bound. Syntax checks and the full watch-arm suite passed; the targeted held-marker test passed during the triage suite, which timed out after 600 seconds before completing. Did not change or attempt to fix fm-supervision-host.test.sh * no-mistakes(ci): Removed the cleanup-bound test that incorrectly expected a TERM-stopped watcher to retry a contended lock acquisition. TERM cleanup intentionally stops after the failed attempt; the remaining held-lock test verifies it exits and retains stale lock evidence. The two relevant TERM tests passed, as did shell syntax and diff checks * Revert "no-mistakes(ci): Updated both lock-acquire retry loops to honor the watcher’s TERM stop status, so held-marker cleanup exits while retaining stale lock evidence. Set the --stop test’s watcher poll to 1 second to fit its 5-second stop bound. Syntax checks and the full watch-arm suite passed; the targeted held-marker test passed during the triage suite, which timed out after 600 seconds before completing. Did not change or attempt to fix fm-supervision-host.test.sh" This reverts commit 44ce29bfbfa95149a7785efc200f6a00b5bf3a41. * Revert "no-mistakes(ci): Removed the cleanup-bound test that incorrectly expected a TERM-stopped watcher to retry a contended lock acquisition. TERM cleanup intentionally stops after the failed attempt; the remaining held-lock test verifies it exits and retains stale lock evidence. The two relevant TERM tests passed, as did shell syntax and diff checks" This reverts commit e1e37067a9369f0c38d7bd1c7a0913b1c54fc28a. * Revert "no-mistakes(test): Defer TERM exit to clean up quiet checkpoint watcher locks" This reverts commit 9877bf92134e77414e25cd8e6f122ff4d089473a. * fix: let checkpoint watcher clean up before timeout * no-mistakes(review): Scope checkpoint timeout escalation and restore signal docs * no-mistakes(review): Fix Perl checkpoint timeout escalation * no-mistakes(document): Clarify checkpoint recovery documentation * no-mistakes(document): Document isolated checkpoint regression command * no-mistakes(ci): Tied direct-checkpoint SIGKILL escalation to the effective cleanup bound, preserving the five-second minimum and leaving the supervision-host path unchanged. The targeted checkpoint suite, shell syntax checks, ShellCheck, and diff checks pass. CI was not manually rerun --------- Co-authored-by: jopo <jopo@JP-M2mini.local>
…uid#4395) * feat(bin): add Forgejo (tea) as a third forge alongside GitHub and GitLab Extends the existing provider-tagged PR/MR dispatch in fm-pr-lib.sh, fm-pr-poll.sh, fm-pr-check.sh, and fm-pr-merge.sh with a forgejo arm, following the same pattern already established for GitLab. tea addresses a repository by owner/repo slug only and resolves the host through a named "tea login" rather than a URL, so the login is matched against the PR's host fresh at arm and merge time. tea's own merge subcommand exposes no head-binding flag, so the merge itself calls Forgejo/Gitea's REST API directly via "tea api" with head_commit_id, verified against a real disposable instance to behave like --match-head-commit/--sha; that same verification found that "tea api" reports an HTTP-level failure with exit status 0, so a merge is confirmed only by reading the pull request back afterward, never by trusting the command's own exit code. Adds forgejo as a value of the registry's existing forge= binding (the closed set becomes none|gerrit|forgejo, with its refusals unchanged), so a generated brief and its direct-PR Definition of done name tea before any PR exists and bin/fm-spawn.sh's forge agreement and bin/fm-promote.sh carry it like gerrit. Documents the new value in docs/configuration.md, docs/architecture.md, and a new maintainer-verification doc mirroring docs/gitlab-merge-watch.md. * no-mistakes(review): Redact private Forgejo host/IP from evidence doc * no-mistakes(review): Fix doc's tea-login JSON shape; dedupe host validators * no-mistakes(document): Add Forgejo to README doc index and scripts.md forge list * no-mistakes(lint): {"summary": "fix(bin): drop unused FORGEJO_LOGIN capture in fm-pr-check.sh"} * fix(bin): refuse --allow-red on Forgejo instead of dropping it silently The attended --allow-red waiver landed on main while the Forgejo arm was being written, so its applicability guard only ever classified GitHub and GitLab. On a Forgejo pull request the flag parsed, and then nothing read it: forgejo_verify_mergeable requires the head's combined commit status to be exactly "success", with no per-check name to match a waiver against. The merge still refused, so no red Forgejo merge was ever possible, but it refused without saying the waiver had been ignored. Extend the existing GitLab guard to cover Forgejo for the same reason GitLab has it: both collapse their checks into a single head verdict, so the green requirement is absolute and a named waiver cannot apply. * fix(bin): poll a Forgejo pull request by number through tea api The merge watch listed the 50 most recent pull requests and filtered to the watched index, so in a repository with more newer pull requests a merged watch never fired. Read the one pull request through tea api instead and wake only on a boolean merged field of true, since tea api exits 0 on HTTP errors. Share the tea login match as fm_pr_forgejo_login for every sourcing script and add fm_pr_forgejo_read_record for the state, merged flag, and head. Arming now also requires jq, which the poll needs to read the record. * fix(bin): gate a Forgejo merge on every status page and on draft state The combined-status endpoint computes its state from one page of contexts, so a failing context past the first page could leave the head reading green. Read every page until an empty one and require each to be success. Also refuse a pull request the API reports as a draft. * fix(bin): prove a Forgejo task landed from its merged pull request at teardown pr_is_merged read the recorded pr= only through gh, so a Forgejo task always fell back to the content check and refused landed work whenever that check was inconclusive, such as when later default-branch commits conflict with the merged tree. Read a recorded Forgejo URL through fm_pr_forgejo_read_record and apply the same containment check against its head. * feat(bin): read Forgejo pull requests in crew-state and review-diff fm-crew-state reports a terminal passed run's Forgejo pull request as open, closed, merged, or unknown through fm_pr_forgejo_read_record, and fm-review-diff resolves a /pulls/<n> URL to the refs/pull/<n>/head ref Forgejo serves. Document the by-number read, the paged status gate, and the draft gate, and mark what the evidence instance did not exercise. * fix(bin): parse tea logins as JSON and close the remaining Forgejo gaps The tea login match split each line of `tea login list --output json` on quotes and read field 4, which only works while tea pretty-prints one field per line. A login printed as one compact object put the login name where the url belonged, so arming, merging, and polling refused every Forgejo host. fm_pr_forgejo_login and the static poll's own copy now parse the list with jq, matching each login's url host with scheme, userinfo, port, and path stripped, and still refuse zero or several matches. --allow-missing is now refused on a Forgejo pull request the way --allow-red already is, instead of being parsed and ignored: the merge already requires the head's combined commit status to have succeeded. The forge=forgejo Definition of done read the draft state back with gh-axi pr view and cleared it with gh-axi pr ready although the PR is opened with tea; both publishing modes now read the draft state through tea api and clear Forgejo's work-in-progress title prefix with tea pulls edit. * no-mistakes(review): Retry Forgejo merge confirmation read before failing * no-mistakes(document): Document Forgejo draft gate and merge confirmation retry * fix(bin): merge Forgejo pull requests with the repository's default style When the caller named no merge method, a Forgejo merge always sent Do=merge, so a repository that allows only squash or rebase merges refused every default call. The style now comes from the repository's own default_merge_style, read live through the same tea login, and a merge is refused when that value cannot be read or is not a known style rather than replaced by one chosen here. A method the caller names still wins. --------- Co-authored-by: dna <dna@local>
…henguid#8023) * fix(contributions): keep maintainer-comment polls inside the check timeout In a home with a few hundred contribution records, the contribution poll spent most of the watcher's 30-second check bound on local bookkeeping before its forge budget started: three jq processes per saved record file plus several per already-final URL. The watcher killed the poll before it read most open PRs, so a maintainer comment on an open PR could wait many hours, or never, for its wake. The PR health monitor had the same cost in its enrollment step: it re-enrolled every owned pair on each pass and saved nothing until the end, so a killed pass never converged and a PR on a later task branch was never enrolled. - read_saved validates every record in one jq process and keeps the per-file path only to count unreadable records. - poll skips final URLs that every owner already holds error-free, with one jq pass deciding settled, final and live URLs. - owned reports the tasks holding a durable record for each URL, and the PR health monitor skips enrolling pairs that already have one, so a pass cut short still makes durable progress. * no-mistakes(review): Isolate record validation errors per file in one jq * no-mistakes(review): Read each record file whole to avoid joining * no-mistakes(ci): Fixed ci-2: read_saved in bin/fm-contributions.sh now validates records in bounded jq batches (FM_CONTRIBUTIONS_READ_BATCH, default 100) instead of one jq with every record path, so a long-lived home cannot hit the argument-length limit. Batch results are merged; malformed-record, task-identity, no-trailing-newline behavior and the per-file unreadable count are unchanged. Added test_records_beyond_one_read_batch_are_all_read (5 records, batch 2, jq wrapper rejecting more than 2 record files); it fails on the old code and passes now. The full contributions suite passed before the wrapper was added. I re-ran only the new test afterwards. ci-1 (Full suite) is the maintainer full-ci label gate, so no change was made for it. I did not reply on the review thread * no-mistakes(review): Hard-code contributions read batch at 100 * no-mistakes(lint): Silence ShellCheck SC2016 in contributions test
…nd relaunches (kunchenguid#8069) * fix(pr-lib): preserve authenticated PR polls across updates and relaunches An armed merge poll binds to the hashes and file objects it was registered with, so a repository template update no longer invalidates it. Validation previously required the published check to be byte-identical to the current bin/fm-pr-poll.sh, which an update or a control relaunch silently broke even though the watcher executes the current repository poll with validated data and never executes the registered state-file bytes. Accept control_relaunch_tx among the metadata fields that may follow the PR identity, and pin both behaviours in the security suite: an older registered generation still detects its merge without executing sidecar code, and forged bytes or forged trailing metadata are refused. * no-mistakes(document): Align poll-registration docs with hash-bound validation * no-mistakes(ci): Addressed the selected Greptile finding (ci-2) in tests/fm-pr-check-security.test.sh:3474 (test_registered_poll_survives_template_update_and_relaunch). Problem: for the template-update and combined scenarios, the "historical generation" fixture was bin/fm-pr-poll.sh with a marker line appended after the poll's unconditional exit, so the marker was unreachable and the copy still performed the same gh call. Both the marker-absence and gh-call assertions could therefore pass even if the watcher had executed the registered bytes instead of dispatching the current repository poll. Invariant: the historical registered check bytes are never executed; only the current repository poll runs, and it must be the sole source of the merge result and the sole forge call. Places this must hold: the template-update scenario, the combined (template-update + control_relaunch_tx) scenario, and the relaunch-only scenario (which legitimately has byte-identical check bytes). Fix: for non-relaunch scenarios the fixture is now a self-contained stub whose whole body is reachable — it writes the sidecar marker file and prints the distinct line `historical-generation`, and never touches gh. The relaunch scenario keeps the unchanged cp of the current poll as before. No existing assertion was weakened or changed: marker absence, `task-a.check.sh: merged`, the `pr view ... --json state` gh log entry, poll retirement, and forged-check refusal all remain. Verification (FM_TEST_BASE_PATH=/run/current-system/sw/bin, required on this NixOS host because mkdir is not under /usr/bin): full `bash tests/fm-pr-check-security.test.sh` passes with no `not ok` lines, including the registered-generations case; `bash -n` and `shellcheck -S warning` pass on the file. Negative control: temporarily patching bin/fm-watch.sh to execute the registered check bytes made the same test fail, then the patch was reverted (git status shows only the test-file change). ci-1 (Full suite) was marked ignore by the human decision and its suite passes locally * no-mistakes(test): Prove live that template-update polls stay armed and keep their merge wake
…d#8060) * feat(hc): auto-detect the Herdr app signals for the hc backend Stage 3 of Herdr Core support: a Firstmate running inside the Herdr app now selects the hc backend automatically, while classic Herdr TUI, nested tmux, and bare hc terminals keep their existing verdicts. Two app-owned signals, checked after every other surface marker: - app-terminal: the process's own HC_TERMINAL_ID carries a non-empty herdr.space label in its core's record - the exact condition the app projects a terminal into its window. An app terminal's env is deliberately identical to any other hc terminal's (the core rewrites the app's TERM_PROGRAM=herdr claim to ghostty), so the claim is read from the record via `hc get`, gated by a live unix-connect probe because `hc` autostarts a core on contact with a missing socket. - app-window: a live herdr-app.sock under the resolved app home (HERDR_APP_HOME, else XDG_CONFIG_HOME/herdr-app, else ~/.config), probed by an actual unix connect - the app's own liveness rule. The app is never launched and the core is never contacted for it. Both require a usable hc toolchain (executable FM_HC_BIN or a self-identifying herdr-core/hc on PATH, plus jq); a live window without one records app-window-unusable and fm_backend_name prints a notice naming the missing piece instead of switching. Explicit --backend, FM_BACKEND, and config/backend always win; auto-detected hc prints a loud opt-out notice and meta records backend_detect=app-terminal or app-window alongside the existing herdr.space/herdr.tab presentation labels. Supervisor-endpoint discovery resolves an hc terminal to <session>:<address> and backend hc so the away daemon fails loudly at its supported-backend check instead of silently steering firstmate:0 tmux; full hc away support stays out of scope. Verified against herdr-app 0.1.11 source/binary and an isolated hc 0.1.14 lab session (docs/verification/runtime-backends.md); a real app window's socket and in-window label display remain unverified. * no-mistakes(review): Bind hc auto-detection to the live spawn core * no-mistakes(document): Correct hc selection and supervisor documentation * fix(hc): gate app auto-detection on the adapter's verified core version Greptile on PR kunchenguid#8060: fm_backend_detect_hc_usable accepted any self-identifying 'hc x.y.z', but the adapter's container gate requires FM_BACKEND_HC_MIN_VERSION (0.1.14). A live app window or terminal beside an older core would auto-select hc, then have the spawn abort at the version check - breaking an otherwise usable default spawn. Detection now runs the adapter's own fm_backend_hc_version_check through fm_backend_source (the same source path spawn and the bootstrap tool check use), so an auto-selection can never resolve a binary the spawn would refuse. The duplicated detection-side bin resolver is folded into the adapter's fm_backend_hc_bin, and the unusable notices name the verified minimum. A below-floor binary reports app-terminal-unusable or app-window-unusable, covered by new fake-version assertions. * no-mistakes(review): Make app-detect negative tests reject detection * no-mistakes(document): Point hc metadata guidance to its owner * fix: drop the app-window signal from hc auto-detection The live real-Herdr-app exercise proved app-window cannot distinguish "firstmate inside an app terminal" from "the app is open somewhere on this host": marker-less bare processes selected hc solely because a window existed, binding whatever core the spawn would reach. The app-terminal signal (this terminal's own herdr.space label on the spawn-reachable core) is the only claim that actually places the process inside the app, so it is now the sole auto-select signal. A marker-less process near a live window resolves the default backend silently; explicit --backend/FM_BACKEND/config selection is unchanged. * no-mistakes(document): Correct hc single-signal documentation
…sion (kunchenguid#7525) * Park verified native Codex supervision outside the model * Document native Codex park verification and fallback * no-mistakes(review): Extend Codex park startup grace to ten seconds * no-mistakes(review): Document ten-second Codex park startup grace rationale * no-mistakes(document): Name Codex native park in supervision host header * no-mistakes(document): Add native Codex park script to scripts inventory * Gate native Codex park behind config/codex-stop-park and cover it with behavioral tests The native Codex Stop park now runs only in a home that opts in with config/codex-stop-park; without it the session start, the synchronous guard, and the asynchronous Stop hook behave as before the park existed and the foreground checkpoint stays the default. A fixture-driven suite with a fake codex covers the opt-in and version gates, the single-flight claim, the fallback latch on a failed queue delivery or repeated arm failure, the owner-gone watcher exit, and the retained quiet boundary. * ci: add a tenth portable serial shard for the Codex stop-park suite * no-mistakes(document): Point Codex park verification record at behavioral suite * ci: retrigger checks * Revert the tenth portable serial shard (added by kunchenguid#7838) * no-mistakes(ci): I fixed both Greptile findings (ci-1, ci-2) with the small changes you asked for. No new state, subsystem or protocol change. The changes are not committed, so there is no Co-Authored-By trailer anywhere. **ci-1: a woken turn could lose its rearm (`bin/fm-codex-stop-park.sh`)** - Rule that must hold: when a registered session that still needs supervision hits Stop, a park must end up rearmed. A delivering park that still holds the claim must not make the next hook give up. - The only place that gives up is the claim acquisition in the async Stop hook. `--guard` already accepts a recent delivered record, so it needed no change. - Fix: if acquiring the claim fails, the hook reads the holder pid that the lock library reports. It checks that `.codex-park.json` shows this session, outcome `delivered` and that same pid, and that the pid is alive. Only then does it poll for up to 3 seconds (30 × 0.1 s) until `CLAIM` is gone, and retry the acquire once. Any other busy claim still does the old `exit 0`, so the single-flight case behaves as before. **ci-2: compaction skipped after a quiet boundary (`bin/fm-supervision-host.sh`)** - Rule that must hold: when the park clock restarts, every value measured on that clock restarts with it. `WARM_COMPACT_LAST_TICK` is the only such value. - Fix: one line, `WARM_COMPACT_LAST_TICK=-1`, in the Codex model-free quiet-boundary branch of `boundary_reached`. **Tests (`tests/fm-codex-stop-park.test.sh`)** - New case `test_stop_rearms_after_a_delivering_park_releases_its_claim`: a helper process holds the claim with a delivered record that names it, and releases it after 1 s. The Stop hook must wait, arm once, deliver one wake with no recovery notice, and leave a record that belongs to the new park. - Extended `test_host_quiet_boundary_retains_the_watcher` to use `config/warm-compact`, `FM_WARM_COMPACT_TICK=2` (equal to the 2 s park interval) and a stub engine that fails. The engine record is only written after the first quiet boundary, so compaction (`warm-compact engine failed` in the log, `/compact` passed to the stub) can only happen if the tick runs on the restarted clock. The watcher-retention checks still apply, now across three boundaries. - Mutation checks: with ci-1 reverted, the suite fails ("must rearm … expected '1', got '0'"). With ci-2 reverted, it fails with no warm-compact line in the log. I restored both fixes after each check. **Verification** - The whole suite passes (8 of 8). - `shellcheck -x` is clean on all three files. - `bin/fm-test-run.sh --check-coverage` passes: `FM_TEST_COVERAGE ok`, serial_max_ms=1140457 against a 1200000 budget, with 10 serial shards in the current tree. - Measured cost went up by about 3–4 s: three local runs took 25.6 s, 26.8 s and 24.8 s, against about 22 s recorded earlier. That is still under the 30000 ms hint, so I left the hint as it is * no-mistakes(ci): Fixed the remaining ci-1 gap: a woken turn that reaches Stop while the earlier park is still sending its wake now waits for that park to release the claim, then rearms. Before, it gave up and left no watcher. The changes are not committed. What had to hold: when a registered session that still needs supervision hits Stop, a park must end up rearmed. That depends on two places: the record the park writes while it sends a wake, and the check that decides whether to wait when the claim is busy. Changes in bin/fm-codex-stop-park.sh: 1. Timeout constant: the literal 20 in deliver's fm_run_timed is now DELIVERY_TIMEOUT=20. The busy-claim wait is derived from it: (DELIVERY_TIMEOUT + 5) * 10 polls of 0.1 s, about 25 s. A comment names the constant. 2. New outcome before sending: the wake path now writes `record delivering` just before deliver. Every way out of it already overwrites that: success writes delivered, failure writes delivery-failed, HUP/INT/TERM write interrupted. 3. Wait check: the busy-claim check now accepts delivering or delivered, still for the same session and holder pid, and still only if that pid is alive. 4. One addition not asked for: delivering is added to the outcomes that trigger the recovery notice (with waiting, arming and interrupted). Before this change, a park killed with SIGKILL mid-send left waiting behind and the next park sent a recovery notice. Without this word that notice would silently stop. --guard and the claim model are unchanged. Test: the existing case in tests/fm-codex-stop-park.test.sh now takes two arguments: the outcome the holder records and how long it holds the claim. The holder then records delivered and releases, as a real park does. The suite runs it as `delivered 1` (old case) and `delivering 4` (new case, over 3 s and under the 25 s bound). Both require the Stop hook to arm exactly once, send one wake with no recovery notice, and leave a record that belongs to the new park. Mutation checks: - With the wait check set back to delivered only, the new case fails ("must rearm ... expected '1', got '0'"); fix restored. - Removing the new `record delivering` line fails no test, because the test's holder writes its own record. The delivering recovery trigger also has no test. Verification: - shellcheck -x is clean on all three touched files. - One unexplained failure: the suite passed in 12 of 13 full runs (3 run in parallel). The failed run was a timing run with output discarded, so the failing case is unknown; it did not reproduce in 13 more runs. - Hint raised: measured runs took 29.8 s, 34.0 s and 34.7 s, over the 30000 ms hint, so the hint is now 35000 in bin/fm-test-run.sh. bin/fm-test-run.sh --check-coverage passes: serial_max_ms=1140951 against the 1200000 budget, 10 shards. - The commit-message and comment wording rules don't apply yet, since nothing is committed * no-mistakes(review): Gate latched fallback on supervision need; fix shard doc * no-mistakes(document): Align Codex Stop-guard docs with park behavior * no-mistakes(document): Document latched-fallback Stop block in turn-end guard doc * no-mistakes(ci): Fixed ci-2 and ci-3; ci-1 left untouched and no CI file changed. ci-2 (bin/fm-codex-stop-park.sh): added settle_idle, called at both idle decisions (top of arm loop and inner poll loop) when fm_supervision_needed turns false. If state/.wake-queue is non-empty it records delivering, calls the existing deliver path, then records delivered; on delivery failure it records delivery-failed, latches the fallback and exits 1. With an empty queue it records idle and exits as before. Away mode, lost session lock and unregistered session still exit idle without delivering. The single-flight claim, fallback latch and rearm path are unchanged. ci-3 (bin/fm-supervision-instructions.sh): the codex case of ordinary_wake_line now splits on CODEX_PARK. A parked session is told the Codex Stop hook owns watcher continuity (drain and handle the wake, do not arm another cycle). A non-park Codex session keeps the foreground-checkpoint line unchanged. The existing codex assertions are unchanged and still pass. Verification: tests/fm-codex-stop-park.test.sh and tests/fm-supervision-instructions.test.sh both exit 0. shellcheck -x -S warning is clean on both scripts. No new tests were added, because neither suite had a matching case. Neither the settle_idle delivery path nor the parked ordinary-wake line is exercised by those suites * test: cover the idle settle delivery and the parked ordinary-wake line * no-mistakes(document): Document final-result delivery when Codex park ends --------- Co-authored-by: crewmate <crewmate@localhost>
* fix(timeout): preserve stdin in background runners Explicitly inherit stdin before backgrounding the bounded command so Bash does not replace piped input with /dev/null. Cover inherited input and pipeline functions across timeout, gtimeout, perl, and bash. * chore(document): Document stdin preservation in timed runner
…unchenguid#8082) A dead local second mate was respawned through a fresh --secondmate spawn, which re-read config/backend. With config/backend=hc that spawn was refused, so a second mate whose Herdr pane died stayed down. The liveness respawn now passes the backend the mate's record names, so a changed config/backend only affects new spawns. Remote mates keep their host's routing. Tests: fm-secondmate-liveness passes, including a new pinned-backend case.
…kunchenguid#3701) * fix: stop a stale failed run outranking newer truth bin/fm-crew-state.sh matched a no-mistakes run against the worktree's current code identity, so it inherited whatever run last sat on that head. A terminal failed or cancelled run then outranked every newer record: a declared pause, a crew's own terminal done line, and even a run still in flight on the same branch. That was not merely a misleading state line - the stale failure was promoted into a durable terminal-outcome record and queued for captain presentation, naming a pull request the current run had never opened. Two independent fixes. The reader now proves a terminal failure is current before reporting it. A later run the pipeline's own ledger proves current answers instead; a later self-declared pause or done in the status log answers instead where the ledger's date proves the log was appended after the failed run began; and a later run that cannot be bound here reads as unknown - history, but no proof of the present. Nothing else may, so a stale working, needs-decision, or blocked line still cannot mask a real failure, and with no ordering evidence at all the failure stands. A terminal reading also publishes the pull request its own run opened, or none when it opened none. bin/fm-inactive-reconcile.sh no longer inherits either half of the claim. A terminal outcome is built only when the crew's own last self-declared word does not contradict it, in both directions, and its pull-request identity comes from the same record as its state rather than from a separately recorded task PR. bin/fm-nm-run-lib.sh keeps the one attribution owner: the supersession check reuses its existing rules and adds only the branch's newest ledger row and the one-directional reading of the ledger's date column. * no-mistakes(review): Captain: fix terminal run and PR provenance * no-mistakes(review): Captain: preserve newest terminal run provenance * no-mistakes(review): Captain: consolidate terminal provenance and status snapshots * no-mistakes(review): Captain: enforce precise terminal outcome provenance * no-mistakes(document): Consolidate terminal-state documentation ownership * test(crew-state): expect unknown for an unprovable live replacement f5d7f5f (kunchenguid#4476) raised the attribution bar: the runs ledger carries no run id, so a LIVE replacement cannot be proven current and the reader answers unknown. That moves three cases from rule 2b's case (a) to its case (c), which this branch already documents as the honest answer for a replacement that cannot be bound here. Only the state label changes. Every safety assertion is unchanged and still passing: no false failed state surfaces, and no stale pull request is published. * no-mistakes(review): gate status-log supersession off the attributed run's failure * no-mistakes(review): accept only ready-signal PRs from a status-log outcome * no-mistakes(review): report unknown for an unbindable live replacement run * no-mistakes(review): make ordering and gate regression tests non-vacuous * no-mistakes(review): restore current-run shape for ordering regression tests * no-mistakes(review): require ordered status line to be log's last line * no-mistakes(review): share ledger row validation, match run heads both ways * no-mistakes(review): require a terminal ledger row for status-log ordering * no-mistakes(document): name shared ledger-row validity owner in architecture * no-mistakes(review): let reader ordering evidence keep a failure reportable * no-mistakes(review): establish crew-word ordering from the log alone * no-mistakes(document): record proven-older crew word exception in architecture * no-mistakes(review): remove status-log ordering rules from crew-state reader * no-mistakes(review): let run-step terminal states outrank the crew's own word * no-mistakes(review): state the narrowed corroboration rule in architecture doc * no-mistakes(review): run rule 2b after the socket-down status-log override * no-mistakes(review): name the ledger verdict's own run, document applied precedence * no-mistakes(review): skip rule 2b on coarse path, restore scout PR guard * no-mistakes(document): note scout PR exception in reconcile header contract * no-mistakes(review): extend terminal-reading precedence to done readings * no-mistakes(review): derive ledger status from the run record's status field * no-mistakes(review): drop vacuous checks-passed test, record traced evidence * no-mistakes(review): name the unbindable ledger row, not an earlier run * no-mistakes(review): append run id as a field, keep PR without ledger row * no-mistakes(document): document run-id field and corrected terminal PR rule * no-mistakes(lint): quote keyword literals in terminal-state comparison (SC1010) * Preserve cancellation as unknown in ledger precedence * Align completed-run selection fixture PR identity * no-mistakes(document): Align crew-state rule 2b comment with cancelled-as-unknown * no-mistakes(ci): I fixed the Greptile finding (ci-1): crews in the main home that reported a GitLab or Gerrit review now keep the review link in their completion notice. I left the changes uncommitted in the worktree for no-mistakes to validate and publish to PR 3701. I made no other changes and did not rebase, push or touch history. The rule that was broken: a terminal outcome taken from the status log must carry the review URL that its own ready report names, for every forge the project supports. **What changed** - In `bin/fm-inactive-reconcile.sh`, `terminal_outcome_pr` no longer uses its own regex, which accepted only GitHub-style `/pull/<n>` URLs. It now takes the note, strips the leading `PR `, strips an optional ` checks green` or ` published for review` (the Gerrit ready shape), and passes what is left to the existing `fm_pr_url_parse` in `bin/fm-pr-lib.sh`. That library is already loaded through `fm-dod-lib.sh`. This means GitHub, GitLab merge requests, Forgejo and Gerrit URLs are all accepted. The function returns the parsed URL, still taken only from the state line itself. - The run-step path, the scout rule, the rule against claiming URLs that are only mentioned in prose, and the cancellation-as-unknown and terminal-identity rules are unchanged. - I updated the comment above the function, because it said the rule was the same as `pr_for_task`'s, which is no longer true. **One stricter result you should know about:** a GitHub URL must now pass the shared parser's host check. It must be `github.com` or a host listed in the `github-hosts` config, and it must use `https`. For this reason I changed one fixture in `test_status_log_sourced_outcome_keeps_its_own_pr` from `https://example.test/.../pull/7` to `https://github.com/.../pull/7`. No other test depended on the old pattern. **Test:** I added one regression test, `test_status_log_outcome_keeps_gitlab_and_gerrit_reviews`, in `tests/fm-inactive-reconcile.test.sh`. It uses `PR https://gitlab.example/group/sub/project/-/merge_requests/8 checks green` and `PR https://gerrit.example/c/group/project/+/4201 published for review`. **Verification** - With the old `bin/fm-inactive-reconcile.sh`, the new test fails ("the gitlab terminal outcome dropped its review link"). - With the fix, `bash tests/fm-inactive-reconcile.test.sh` passes completely ("all inactive reconciliation tests passed"). - `shellcheck -x` reports no problems in either file. **Not changed, as you instructed:** `pr_for_task`, the ledger-first fallback in the same file, also accepts only `/pull/` URLs. That is the same problem in a sibling function. If a reviewer reports it, you said to stop and report rather than run another repair round
… --resolve-key refuses (kunchenguid#3983) * fix(supervision): make the OPEN DECISIONS listing name the key that closes it An operator answering a listed decision runs the command the listing itself advises, and that command refused - discarding the steer with it. The two folds never disagreed. Both the whole-file fold and fm-send's resolver read the same status_open_decisions rule, and both correctly keyed `blocked: axi run hung ... [key=no-mistakes-start]` as `default`: the key grammar states a key before the colon or at the head of the note, so a token trailing a summary is prose. The reader that was wrong is the third one, the drain's OPEN DECISIONS renderer. It suppressed `[key=default]` and printed the note verbatim, so the only bracket token a reader could see on such an entry was the one that is NOT the key - and the entry named a key it had not folded. Every entry now states its folded key, `default` included, so the key the listing shows is the key its advised command closes. An unresolvable key still refuses rather than delivering: an answer this send cannot close would leave the decision open behind an answer the operator believes settled it. The refusal no longer costs the message instead - it diagnoses a key that is only mentioned inside an open decision's note, names the keys that are actually open, and prints the resend commands with the message quoted back verbatim. * no-mistakes(review): Remove automatic key selection from resend advice * no-mistakes(document): Clarify operator key selection in resend documentation * fix(send): carry the caller's routing context into every printed resend A refused --resolve-key preserves the operator's message by printing a resend command, but the command could not run: it reused $0 and dropped the routing environment. A one-shot "FM_HOME=<home> bin/fm-send.sh ..." exports nothing to the next command, and a relative $0 is valid only from the directory that invocation ran in, so a copied line resolved to another home's state, to no script at all, or refused with FM_HOME unset - and the preserved message still never reached the worker. The unconfirmed-remote retry path already solved this. Both printed resend paths now share that one statement of it: the absolute home always, the state override only when this invocation was given one, and this script's absolute path. Covered by a test that invokes fm-send through a relative path with a one-shot FM_HOME, then runs what it printed from a different directory with nothing supplied - what an operator copying the line actually does. * no-mistakes(review): remove unprovable decoy-key diagnosis, quote resend key placeholder * no-mistakes(review): scope empty open-set claim to status file, always offer keyed resend * no-mistakes(review): Keep already-accepted keys in the refused-key resend * no-mistakes(review): Check every resolve key before refusing, keep order * no-mistakes(document): Reflow fm-send resolve-key refusal header comment
…sweep (kunchenguid#8086) * fix(pr-check): record every PR a task reports in a done line Merge and health monitoring of a task's PR began only when the supervisor ran fm-pr-check.sh by hand on the ready signal. When that step was missed, for example on a rebase of an existing PR whose done line did not use the canonical wording, the task kept no pr= and no merge poll, so failing checks and maintainer requests on that PR went unnoticed. fm-pr-check.sh scan now records each task whose newest done line naming a supported PR URL ("PR <url>" anywhere in the note) has no pr= yet, through the ordinary registration path, so every refusal still applies. The watcher runs it at the start of each check sweep. A refusal is reported once per task and PR as a check: pr-register: wake and retried silently on later sweeps; teardown removes its marker. * no-mistakes(review): Scan new PR reports before refused retries * no-mistakes(review): Rotate scan start so hung PR registrations cannot starve * no-mistakes(review): Resume PR scan after last attempted task * no-mistakes(lint): Fix SC1007 in fm-pr-check.sh candidates declaration * no-mistakes(ci): Fixed ci-2 and ci-4 in bin/fm-pr-check.sh. ci-2: the scan now treats a task whose pr= equals the reported done-line URL but has no valid published poll as unregistered, so a later sweep republishes the poll. ci-4: scan-driven registrations run with FM_PR_CHECK_SCAN=1 and, under the metadata lock, exit 0 without writing if pr= is now set to a different URL; manual registration is unchanged. Added two tests in tests/fm-pr-check-security.test.sh (test_scan_publishes_a_missing_poll_for_a_recorded_pr, test_scan_does_not_overwrite_a_pr_recorded_meanwhile), and a configurable FM_TEST_GH_SLOW_SECONDS in the slow gh stub. Both new tests fail without the fix and pass with it; the four existing scan tests still pass; shellcheck shows only SC1091 info notes. The full test file aborts earlier on this machine at an unrelated test (GNU stat '%Lp' errors / flaky), so I ran the scan tests as a separate set. ci-1 and ci-3 are declined, with no code change; the ci-3 known-limit line (a refusal notice can be lost if the watcher stops between writing the refusal marker and queueing the wake) still needs to go into the PR description, which I cannot edit from here. Known tradeoff: a merged task whose poll was retired but whose pr= and done line still match would look unregistered and be re-armed until teardown * no-mistakes(ci): Part (1) is fixed. The scan in bin/fm-pr-check.sh now skips a task that has state/<id>.pr-poll-merge-notified or state/<id>.pr-poll-retirement. A merged task's retired poll is no longer re-armed. I added test_scan_does_not_rearm_a_retired_merged_poll to tests/fm-pr-check-security.test.sh. With the exclusion removed, the test fails ("the scan re-armed the poll of a merged task"). With it restored, the test passes. The existing missing-poll and concurrent-PR scan tests also pass. I ran only these three tests, because the full file is slow and was already known to abort early on this machine at an unrelated stat test. shellcheck -S warning is clean. Part (2) needed no change. The scan-only recheck already sits inside the META_LOCK section, right after the lock is taken and the metadata file is re-validated, before the meta rewrite. It exits 0 without writing or publishing when pr= is a different URL. The ci-4 test still passes * no-mistakes(ci): Fixed ci-2. The scan in bin/fm-pr-check.sh now skips a task only when its merge-notified marker or poll retirement receipt names the same PR as the recorded pr=. A new helper, pr_check_pr_retired, does the check. An older PR's marker no longer hides a newer recorded pr= whose poll is missing. Tests, in tests/fm-pr-check-security.test.sh: - Added test_scan_arms_a_replacement_pr_despite_an_old_merge_marker. It uses an old PR 7 merge marker and a recorded pr=9 with no poll. The scan must arm the poll. With the old unconditional skip restored, the test fails ("an older PR's merge marker hid the replacement PR's missing poll"). With the fix, it passes. - test_scan_does_not_rearm_a_retired_merged_poll now writes a valid marker for the same PR. The old marker was a bare version line, which the new check correctly rejects. This test still passes. - The other scan tests pass: publishes_a_missing_poll and does_not_overwrite_a_pr_recorded_meanwhile. - I ran only the four scan tests, because the full file is slow and aborts early on an unrelated stat test on this machine. shellcheck -S warning is clean. ci-1 is declined: only the maintainer full-ci label gate failed. I made no PR description edits, because I cannot edit the PR from here. The earlier requested statements still need to go in the description: the kunchenguid#8023 (comment-wake) coverage of the waiting-author comment case, and the refusal-notice known limit * feat(pr-check): run the done-line PR scan only with config/pr-register-scan The watcher check sweep runs bin/fm-pr-check.sh scan only when the home opts in with the config/pr-register-scan presence flag. With the flag absent, the sweep is unchanged from before the scan existed. The watcher test covers both settings.
…id#8066) Co-authored-by: yeti <yeti@alps>
…henguid#8017) * test: give anchored absence assertions a regex that can match assert_grep and assert_no_grep are fixed-string greps. An anchored pattern handed to them searches for a literal caret, which no line can contain, so every anchored assert_no_grep passed no matter what the file held. Eighteen call sites across six suites asserted their absence that way, so they were silently checking nothing: the merge-local readiness snapshot, the public-followup request and platform links, the secondmate backend and harness records, the restart literal-stop path, the delivery mode and yolo fields, and the remote-doctor launchctl calls. Add assert_regex and assert_no_regex for patterns that describe a line rather than a literal, and convert those sites. The remote-doctor alternation becomes a real ERE group instead of a fixed string containing backslash-pipes. The three suites that run on this host pass unchanged: merge-local 8, task-delivery 34, public-followup 90. The other three fail identically on unmodified main here because their fixtures pin a PATH without tr, sed, or head; that is environmental and unrelated. * no-mistakes(review): Fix regex absence errors and interactive label guard * test(assertions): name lib.sh for ShellCheck source following * no-mistakes(test): Fix vacuous anchored absence guard in fm-pr-merge help test * no-mistakes(review): Restore pre-existing help assertion exactly * no-mistakes(document): Document new assertion suite coverage in its header comment
…r there (kunchenguid#8052) * fix(spawn): lease the Herdr task copy so a restart restores the worker there * test(spawn): align Herdr abort fixture with lease failure * no-mistakes(review): Return Herdr lease when projected abort closes task pane * no-mistakes(document): Note Herdr spawns no longer leave nested treehouse shell * no-mistakes(ci): ci-2 (Greptile, bin/backends/herdr.sh): the invariant is that the projected abort cleanup must report a closed endpoint exactly when the task pane is confirmed gone. fm_backend_herdr_projection_close_pane_focus_preserving can confirm the close and then return 2 only because focus restoration failed. It can also return 2 or 1 after a close that did not happen. The only place where this result becomes SPAWN_ENDPOINT_CLOSED is fm_backend_herdr_projection_cleanup_exact; its single caller is bin/fm-spawn.sh:1691. I fixed it at that shared boundary. When the close call fails, the function now checks the exact pane with the existing fm_backend_herdr_pane_presence_state, and it reports success only when the result is `dead` (pane_not_found). It does not treat a return value of 2 as closed, so a present or unknown pane keeps the lease. I also updated the comment above the function. Tests (tests/fm-backend-herdr.test.sh, test_projection_cleanup_exact_succeeds_only_when_the_task_pane_closed): I added two behavioural cases that run the real cleanup and the real presence classifier against a stubbed herdr CLI response. (1) The close returns 2 and the pane get returns pane_not_found: the result is rc=0, so the endpoint is closed. (2) The close returns 2 and the pane get still shows the pane: the result is rc=1. I also stubbed the CLI in the existing refused-close case so that it cannot reach a real herdr. Before the fix, the confirmed-close-then-failed-restore case failed ("got 'CLOSED w1:p1;rc=1'"). After the fix, the full tests/fm-backend-herdr.test.sh and tests/fm-spawn-herdr-lease.test.sh pass. shellcheck -S warning is clean on both changed files. ci-1 (Full suite): this is not a code defect. The job stopped at the label gate with FM_CI_FULL=false and FM_CI_LANES_FAILED=false, so no lane failed. I did not change code for it. I did not re-run the workflow: this phase must not control CI, and a re-run cannot pass until a maintainer adds the full-ci label to PR kunchenguid#8052, because the gate reads that label. This is still an external label requirement. Note: a temporary copy of the fixed herdr.sh remains at /tmp/herdr.fixed, because my clean-up command was denied by permissions * no-mistakes(review): Release or name Herdr lease after post-launch rollback * no-mistakes(review): Return Herdr lease only when the pane is confirmed gone * no-mistakes(review): Keep dirty Herdr slots leased after failed spawns * no-mistakes(test): Count Herdr pane-death removal in concurrent abort ordering check * no-mistakes(document): Clarify Herdr aborted-spawn lease return condition * test(herdr): allow explicit lab session for presentation e2e * fix(teardown): close Herdr pane before returning its lease * no-mistakes(review): Remove inherited HERDR_LAB_SESSION override from presentation e2e * no-mistakes(document): Document Herdr teardown closing pane before returning lease * fix(teardown): retain leased copy when Herdr close is refused
… agent is live (kunchenguid#8085) * fix(inactive-reconcile): withhold terminal outcome while the agent is alive Fixes kunchenguid#6553 * no-mistakes(review): Bound liveness read; withhold only busy or relaunched agents * no-mistakes(review): Judge incarnation by spawn epoch; use remaining budget * no-mistakes(document): Document live-agent withholding in architecture scan rule * no-mistakes(lint): Fix ShellCheck SC2143 and SC2016 findings * no-mistakes(ci): ci-2 and ci-3 are fixed in tests/fm-inactive-reconcile.test.sh. ci-1 (Full suite) needs no code change, as the captain decided. I ran only the new test in isolation, plus a mutation check; the full test file did not pass in this environment (details at the end). - **ci-2 (macOS sed):** `arm_claude_busy` no longer uses `sed -i`. It writes the edited meta to `<id>.meta.new` and moves it over the original, so it works with both GNU and macOS sed. - **ci-3 (liveness-read timeout):** I added `test_stalled_liveness_read_is_bounded_and_scan_progresses`. - The fake `fm-crew-state.sh` sleeps 1s, then returns `failed` for child `a`. - The fake `tmux` then stalls for 30s, which stalls the liveness read. - With a 2s scan budget, the scan must finish within 4s. - After the stall is cleared, the next scan must still reach child `b`. - **Mutation check:** I removed `fm_run_timed "$timeout"` from the liveness read at `bin/fm-inactive-reconcile.sh:517`. The new test then failed, so it catches a lost timeout. I restored the file afterwards. - **Full test file:** it did not pass in this environment, because the existing `test_stalled_state_read_is_bounded_and_scan_progresses` failed on timing. In one run it exceeded its 3s elapsed bound (4s); in another, its next scan did not reach child `b`. I never ran it against `HEAD` alone; this PR changed that file only by adding the new test and the sed fix. - **Not checked:** I did not investigate why that existing test fails here
…biguous (kunchenguid#7568) * fix(herdr): name a stale launcher pane id as gone instead of ambiguous The launcher pane id a shell inherits outlives the pane itself. When herdr no longer knows that id, `pane get` answers with whatever pane it still has, the exact-id filter in fm_backend_herdr_launcher_identity keeps nothing, and the guard refused with "returned an ambiguous tab or workspace identity". There is no ambiguity to report: the pane does not exist any more, so the id is stale. The refusal now names the stale pane id, says the pane no longer exists in the session, and names HERDR_PANE_ID, HERDR_TAB_ID and HERDR_WORKSPACE_ID as the values to refresh. The return codes, the refusal behavior, the identity-matching logic and the spawn behavior are unchanged, and no other error path changed. tests/fm-backend-herdr.test.sh covers both shapes of this path: a pane id herdr answers with a different pane, and a pane record that names no tab. * fix(herdr): stale launcher pane message covers the no-tab shape too The empty-tab shape is a pane record that still answers but names no tab, so 'no longer exists' was not literally true for it. The refusal now says the pane is stale: it no longer exists or names no tab or workspace in the session. Return codes, refusal and identity matching are unchanged. * no-mistakes(review): Reword unreadable launcher pane error as stale * no-mistakes(document): Document stale launcher pane refusal in herdr backend docs * fix(herdr): keep the could-not-be-read wording when the launcher pane get fails * no-mistakes(test): docs(herdr): describe destroyed panes as unreadable, not stale
…uid#8084) * feat(bin): add verified Hermes TUI worker adapter * no-mistakes(document): Document Hermes owner in tmux composer identity comment * no-mistakes(ci): Fixed ci-4: a Hermes worker that stalls at setup or misses the readiness deadline is now stopped before its task record is removed. Rule that must hold: once the Hermes launch command has been sent, any failure exit from the Hermes readiness gate closes the launched endpoint first. Only after that may the abort trap (spawn_abort_cleanup) roll back a fresh spawn's record and retire its busy generation. Two exits in the gate broke this rule, and both are now fixed in bin/fm-spawn.sh: 1. **Readiness timeout:** after the existing error message, the gate now calls `rovo_endpoint_cleanup`. This is the same close step the rovo launch-then-confirm gate already uses: it calls the backend's kill (just the exact terminal on orca) and sets SPAWN_ENDPOINT_CLOSED. It runs before `exit 1`, so the window is closed while the record still exists. 2. **Failed Enter on the first-run decline:** this used to `exit 1` straight away. It now `break`s out of the poll loop, so it reaches the same close-then-exit path. The ordinary path is unchanged. A ready screen or a hook record sets HERMES_READY=1 and skips the cleanup. Regression test in tests/fm-hermes-harness.test.sh: a fake tmux shows a stalled provider-setup screen, and the test uses tiny poll settings (FM_HERMES_READY_POLLS=2, interval 0). The fake `kill-window` writes down whether the task's .meta file still exists at the moment it is called. The test asserts that the spawn fails with the Hermes diagnostic, that `kill-window` ran while the record was present, and that the fresh record was removed afterwards. I confirmed it fails without the fix ("missing: 'kill-window record=present'") and passes with it. It uses only throwaway fixtures and a generic `example` profile. Checks run: tests/fm-hermes-harness.test.sh and tests/fm-rovo-harness.test.sh both pass with 0 failures, shellcheck on both changed files is clean, and `bash -n` passes. Changes are left uncommitted so the pipeline can record them as their own fix commit, with no squash. ci-1, ci-2 and ci-3 were not touched, as instructed * no-mistakes(ci): I fixed ci-3. If the stalled Hermes worker can't be closed, a failed spawn now keeps its task record, so supervision and teardown can still reach the worker. **What must always hold:** once the Hermes launch command has been sent, the spawn rollback may remove a fresh task record and its busy generation only after the launched endpoint has actually closed. The last round's ci-4 fix tried to close the pane first, but it ignored whether that close worked. The cleanup at exit (`spawn_abort_cleanup`) still saw `SPAWN_FRESH_COMMIT_PENDING=1` and removed the record anyway, leaving a possibly live Hermes worker with nothing pointing at it. **Fix** (`bin/fm-spawn.sh`, the Hermes readiness gate's failure exit): after `rovo_endpoint_cleanup`, if `SPAWN_ENDPOINT_CLOSED` is not 1, the gate clears `SPAWN_FRESH_COMMIT_PENDING`. It also prints a warning that the record is kept and the worker should be inspected and torn down. This uses the existing flag the abort cleanup already relies on, the same way other kept-record paths skip rollback. The readiness timeout and the failed-Enter exit from the first-run decline both reach this single exit, so the fix covers both. Nothing else changes: - When the close succeeds, the record is rolled back exactly as before (the earlier stalled-launch test still passes). - When Hermes becomes ready, this branch is skipped. - On a relaunch, `SPAWN_FRESH_COMMIT_PENDING` is already 0, so nothing changes there. I left the other harnesses' gates alone. Changing how they roll back would go beyond this finding. **New test** in `tests/fm-hermes-harness.test.sh`: a fake tmux shows a stalled provider-setup screen, and its `kill-window` can be made to fail (`FM_FAKE_HERMES_KILL_FAIL`). The test checks four things: - the spawn fails with the Hermes error; - a close was attempted while the record existed; - the kept-record warning is printed; - the `.meta` record survives and still has `hermes_profile=example`. It uses only throwaway fixtures and a generic `example` profile. Without the fix the test fails ("missing: 'task record is kept'"); with it, it passes. **Checks run:** - `tests/fm-hermes-harness.test.sh`: all cases pass, 0 failures. - `tests/fm-rovo-harness.test.sh`: passes. - `shellcheck` on both changed files: only the usual SC1091 info notes about sourced files not being followed (it was run without `-x`), no warnings. As instructed, I didn't touch ci-1 (the full-suite label gate maintainers apply) or ci-2 (stale). The changes are uncommitted so the pipeline can record them as their own fix commit, with no squash * test: include Hermes process helper in partial-bin fixtures * no-mistakes(review): Add Hermes process helper to remaining fm-harness fixtures
* fix: recheck landed work after teardown process reap * no-mistakes(review): Delay backlog close markers until post-reap safety proof * no-mistakes(document): Correct stale pending-close publication references * no-mistakes(document): Clarify initial teardown safety check ordering * no-mistakes(document): Correct teardown ordering comments and stale retention documentation --------- Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>
…unchenguid#8099) * fix(timeout): keep redirected stdin on backgrounded runners Non-interactive bash assigns /dev/null to an async command, so the external timeout and bash runners dropped a piped payload before it reached the command. Restore that stdin with an explicit redirection, leave a terminal or closed stdin on the old assignment, and cover every mechanism the host can select. * no-mistakes(test): Give terminal stdin /dev/null in timed background runs * no-mistakes(ci): No new code change is needed. The fix for ci-1 is already in commit db61d47a, which is HEAD, and the working tree is clean. Greptile pointed out that the old fd 3 check could never fail: fm_run_timed ran inside a pipeline subshell while `echo still >&3` ran in the parent shell. The committed test now calls the runner directly, with stdin redirected from a file, in the same shell that then writes to fd 3. It covers the external-timeout mechanism when one is installed and always covers the bash override. It checks the exit status, that the fd 3 write landed, and that the payload came through. Following the driver's instructions, I kept that commit and did not rework it. I re-ran `bash tests/fm-timeout-lib.test.sh` and it exited 0 with every case passing. The Greptile check is still failing only because the earlier push to the PR hit a GitHub Internal Server Error and never landed. The test code is not the cause. Re-publishing the existing commit through the pipeline will resolve it, and that step belongs to the outer executor
* Bind interrupted auto-arm notices to their producing session * no-mistakes(document): Document session-bound auto-arm interruption recovery * no-mistakes(ci): Fixed all three lint-inventory expectations to exclude hidden scripts, matching the documented shell globs. Tier 2 test correction; production behavior was correct. fm-lint.test.sh passes, with four platform capability skips. Targeted ShellCheck and git diff --check pass * no-mistakes(ci): Repair blocked: the command guard rejected test authoring as “Indirect command execution not allowed.” Stopped dependent work without switching tools. Independently untracked exactly the six authorized files with git rm --cached; verified every physical file remains and every ignore pattern still matches. ci-1, ci-2, and ci-3 remain unresolved. Neither reproduction nor verification ran. No commit, push, or new scratch files were created * Preserve interrupted auto-arm episodes by session identity * no-mistakes(document): Clarify session-bound auto-arm failure documentation * test: keep the exhausted-interruption fixture on one session The integrated Stop driver starts a new fake-claude pid per Stop. Bind those Stops to one recorded session id so a session-scoped interrupted episode can still exhaust its budget and commit the attended alarm. Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com>
…list (kunchenguid#8121) * feat(bin): choose a Claude account per ship or scout from a declared list Add an opt-in config/claude-accounts list of Claude config directories. When it is present, every Claude ship or scout spawn names one declared entry with --account; that entry passes the same root, raw-command, and stripped-environment `claude auth status` refusals as config/claude-account, and is recorded as account= on the spawn line and in the task record. A relaunch or recovery keeps the recorded account, and only an explicit `fm-control.sh <id> relaunch --account <entry>` moves a task to another declared account. Without the list nothing changes and --account refuses. bin/fm-claude-account-quota.sh measures each declared account in isolation with `quota-axi --provider claude --profile-only` and shows the highest known spendPriority, escalating on a tie or when nothing is rankable, so the existing quota-array-dispatch procedure can rank accounts. Refs kunchenguid#7638 * fix(bin): keep quota-axi's reason when an account read is rate-limited quota-axi exits nonzero when it cannot measure a provider, such as when the Claude quota endpoint rate-limits a burst of reads, but still prints a valid snapshot naming that state. fm-claude-account-quota.sh now keeps that snapshot, so the account is reported unmeasured with the vendor's reason instead of as an unreadable root. * no-mistakes(review): Make Claude account quota helper data-only; skill chooses account * fix(bin): close account-list review gaps on --account, runway, and secondmates - Refuse an --account value holding a control character, and match it against each whole declared entry, so a newline can no longer pass membership on one line or split the account= record. - Print each scope's usableRunwaySeconds and the runway's projectionConfidence in fm-claude-account-quota.sh rows, so the runway floor has the time it needs; confidence was previously always dropped because the snapshot carries it under runway. - Refuse --account on every secondmate spawn before the remote route, which previously accepted and ignored it. --------- Co-authored-by: Omkar Bhale <omkarbhale001@gmail.com>
…on branch prompt (kunchenguid#8118) * feat(branch-prompt): append an optional home include to the supervision branch prompt The headless supervision engine runs in safe mode and loads none of the home's hooks, CLAUDE.md, skills or plugins, so a home had no way to give the branch a home-specific rule. fm-branch-prompt.sh now appends the optional local config/branch-prompt-include.md verbatim as its last section, the same way config/brief-include.md extends worker briefs: absent or blank leaves the prompt byte-identical, and an unusable path stops the generator before it emits anything. * no-mistakes(review): Pin byte-stability re-run to a temp home --------- Co-authored-by: c-c6aw <225476801+c-c6aw@users.noreply.github.com>
…not kill the default server (kunchenguid#6422) * fix(bin): bind live-lab tmux calls to explicit sockets so cleanup cannot kill the default server tmux honours TMUX_TMPDIR only while that directory exists; once it is gone, tmux silently resolves the default socket under /tmp/tmux-<uid>. The live lab and its tests addressed their private server through TMUX_TMPDIR alone, so a cleanup aimed at a removed lab directory ran kill-server against the user's own default server and ended every session on it. Every tmux call in bin/fm-live-lab.sh and its tests now names the lab socket with tmux -S, and every kill-server runs only while that socket exists. The lab's stub spawns, the fm-gate-refuse lab-socket test, and the lab cleanup guidance in fm-brief.sh and fm-lab-home.sh follow the same rule. tests/lib.sh gains fm_tmux_isolation_gate: a suite that starts or kills tmux servers runs only when no live server answers in the default socket directory (a private /tmp, or a disposable CI runner), skips with the isolation it needs otherwise, and fails instead of skipping under CI. The live-lab suites open with it. tests/fm-live-lab-isolation.test.sh covers the gate both ways and proves that pane, say, check and down aimed at a missing lab directory leave a decoy server on the default socket alive. * no-mistakes(review): Run live-lab decoy only in private /tmp; drop gate bypasses * no-mistakes(review): Drop inherited temp dirs inside the isolation namespace * no-mistakes(document): Clarify live-lab down contract for socket-guarded server kill * test(live-lab): bound the isolation decoy cleanup and report a decoy it cannot stop * no-mistakes(review): Run bounded decoy cleanup tests on host; bound kill-server * no-mistakes(document): Reflow stop_decoy doc comment in isolation test * fix(tests): treat an exited unreaped decoy as gone in isolation cleanup * no-mistakes(review): Make pid_running fail closed when ps errors * no-mistakes(document): Document pid_running fail-closed ps behavior * no-mistakes(review): add isolation suite serial hint; lane saturated, guard still fails * no-mistakes(review): shorten isolation cleanup polls; hint 3482ms, guard passes * test(tests): bound the tmux isolation gate's server probe fm_tmux_isolation_gate asked each socket's server for its sessions with no deadline, so a stopped or stuck user tmux server held the gate, and with no per-script deadline in the runner, the whole run, before it could skip. Each probe now runs under fm_run_timed for FM_TMUX_ISOLATION_PROBE_SECONDS (default 5), and a server that does not answer in time counts as live: the gate skips and names the silent socket and the deadline. * test(tests): skip the live-lab decoy cases for a checkout under /tmp The isolation suite re-runs itself under unshare -Urm after mounting a fresh tmpfs on /tmp, so a checkout under /tmp lost the script to that mount: the namespace check passed and the re-run failed on a missing file instead of running its decoy cases. The suite now resolves its own physical path, skips the decoy cases with a reason before mounting when that path is under /tmp, and re-runs the physical path otherwise. A copy of the suite under /tmp pins the skip. * test(tests): run only the decoy preflight in the /tmp copy of the isolation suite The copy that pins the /tmp skip re-ran every host case, doubling the suite's runtime and its exposure to their timing bounds. It now goes straight to the decoy preflight it exists to exercise. * test(bin): refresh the live-lab isolation suite serial hint The probe-deadline and /tmp-checkout cases lengthen the suite from about 3.5 s to 4.3-6.5 s in a private /tmp; the provisional hint now carries the slowest of six new samples.
…d#8119) * Fix retriable bounded lock deadline races Preserve retry-later status after an unpublished or exited lock holder at the deadline. Keep malformed lock records as hard failures and cover each classification with deterministic lock fixtures. Closes kunchenguid#8105 * no-mistakes(review): Return 124 when bounded lock is released
…ed work (kunchenguid#7820) * fix(teardown): refuse open-PR ships and ignore the no-mistakes mirror in the landed test Teardown deletes the record that merge recording depends on, so an ordinary ship whose recorded pr= is still open is refused (--force bypasses). The unpushed-commit checks also exclude the local no-mistakes mirror remote, which is not a forge, so work that only reached the mirror is no longer counted as landed. * no-mistakes(review): Exclude no-mistakes mirror from teardown unpushed checks * test: assert the mirror-only teardown refusal retains the task state
* fix: keep Codex Stop responses free of login-shell output * no-mistakes(document): Consolidate Codex Stop documentation under authoritative owners * no-mistakes(ci): Fixed both Pi before_agent_start handlers to narrow prompt-bearing events before accessing event.prompt, addressing the two TS2339 CI errors. Custom events now bypass user-prompt handling; ordinary prompt events and existing message_start paths remain unchanged. Local verification is blocked: tsc is not on PATH. No tools were installed and no other pipeline phases were executed * fix: keep Codex Stop responses free of login-shell output * no-mistakes(document): Consolidate Codex Stop documentation under authoritative owners * no-mistakes(document): Correct Codex verification prerequisites and guard coverage
…nchenguid#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 <5898009+trillium@users.noreply.github.com>
Merge kunchenguid/firstmate main (b329c27) into the fork. The previous sync (#16) was squash-merged, so git's merge base fell back to upstream 9ea0c41 and reported conflicts on 116 files that were really the same upstream content on both sides. The merge was computed against upstream 45dd50a (kunchenguid#7462), the upstream commit #16 synced to, leaving 11 genuine conflicts: - bin/fm-captain-hold.sh, docs/captain-hold-lifecycle.md: take upstream's archived-call handling (kunchenguid#6094), which supersedes the fork's #12; keep the fork's #14 note column on keyed answers. - bin/fm-config-inherit-lib.sh: keep the fork's machine-local lavish-axi-host and version-skew notes alongside upstream's approval-mode, t3code-instances, and absent-item skew handling. - bin/fm-remote-doctor.sh: keep the fork's bounded probe budget and forced worker recovery inside upstream's --backend option parsing; repin DOCTOR_SHA256 in bin/fm-remote-entrypoint.sh to the merged doctor. - tests/fm-supervision-host.test.sh, bin/fm-test-run.sh, docs/fm-test-portable-shards.md: take upstream's four-file split of the supervision-host suite and its shard hints, which supersede the fork's #10 per-case cleanup and timing hint. - tests/fm-timeout-lib.test.sh: keep both the fork's bash 3.2 cases (#9) and upstream's stdin cases. - docs/configuration.md, operational-home-layout skill: take upstream's entries and keep the fork's initiative-tracker and pending-reply archive entries.
…tive tests Upstream's serial lane already sits at the coverage guard's 42-script limit for unhinted members, so the fork's two unhinted tests pushed the merged tree to 44 and failed `fm-test-run.sh --check-coverage`. Record their slowest successful Ubuntu samples from the fork's own green CI runs.
…remote-job budget Two tests failed after merging upstream: - Upstream's archived-call handling (kunchenguid#6094) resolves a live legacy-identity row before consulting the done archive, so an archived call with no recorded answer passed verification when an unrelated live row carried its legacy name. Read the exact entry's archived row first, and refuse an archived call without an answer with the explicit message the fork's archived-call tests expect. - The idle remote-job worker measured 122 external commands per 4-second window (upstream alone 86, fork main 118) against a budget of 120: the fork's per-turn lock-ownership checks plus upstream's heartbeat changes. Widen the budget to 140; the sleep limit that rejects fast polling is unchanged.
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.
Merges kunchenguid/firstmate
main(b329c27, 256 commits) into the fork with a real two-parent merge commit.Why the merge base was overridden
The previous sync (#16) was squash-merged, so git's merge base fell back to upstream 9ea0c41 and reported 116 conflicted files that were the same upstream content on both sides. The merge was computed against upstream 45dd50a (kunchenguid#7462), the commit #16 synced to, which left 11 genuine conflicts. Future syncs get a correct merge base from this merge commit.
Conflict resolutions
bin/fm-captain-hold.sh,docs/captain-hold-lifecycle.md: upstream's archived-call handling (fix(bin): count answered captain holds moved to the Done archive as durable kunchenguid/firstmate#6094) supersedes fix(bin): let the captain-call completion gate see archived calls #12; fix(bin): keep board notes and list-form answers in Lavish captures #14's answer-note column re-applied.bin/fm-config-inherit-lib.sh: comment-only conflict; the fork's machine-locallavish-axi-hostand skew handling coexist with upstream's approval-mode,t3code-instances, and absent-item skew handling.bin/fm-remote-doctor.sh: upstream's--backendparsing plus the fork's bounded probe budget and forced worker recovery;DOCTOR_SHA256re-pinned inbin/fm-remote-entrypoint.sh.tests/fm-supervision-host.test.sh,bin/fm-test-run.sh,docs/fm-test-portable-shards.md: upstream's four-file suite split supersedes test: stop supervision-host fixture processes after each case #10.tests/fm-timeout-lib.test.sh: both sides kept (fix(bin): run fm_exec_timed on bash 3.2 without BASHPID #9 bash 3.2 cases and upstream stdin cases).docs/configuration.md, operational-home-layout skill: upstream entries plus the fork's initiative-tracker and pending-reply archive entries.Merge fallout fixed
fm-fleet-usageandfm-initiativetests (from the fork's own green Ubuntu CI runs); without them the coverage guard sees 44 unhinted scripts against a limit of 42.Fork-only work
#13, #14, #15 and the fork's fleet-usage, initiatives, remote-job, and version-skew work survive; #12 is adapted onto upstream's equivalent; #10 is superseded by upstream's suite split.