Repository navigation
Merge upstream firstmate main, keeping the Kiro integration - #41
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>
* Guard fm-crew-state overrides by task-name basename bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name. An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory. A snapshot's own override, which names the task it was captured for, is still honoured. This is complementary to kunchenguid#5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task. Regression tests cover a mismatched override being ignored and a matching one being honoured. * no-mistakes(review): Make metadata override tests behaviorally distinct
…kunchenguid#7415) * fix(bin): re-anchor a Claude session's lock so /clear keeps ownership A same-session confirmation over a live lock line 1 outside the current harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor under the claim lock, so a later /clear re-key in the same process is still proven by ancestry instead of being refused as a foreign owner. Fixes kunchenguid#6820 * fix(bin): move task leases with a session-lock re-anchor A same-session re-anchor rewrote lock line 1 off a live pid while task leases still named that pid, so a lease held by main or the supervision branch read as stale and the other actor could claim the task. The re-anchor now takes the lease-command lock after the claim lock and, in the same critical section as the line-1 write, rewrites leases recorded against the old pid to the new anchor (fm_lease_rekey_holder). If the lease-command lock stays busy past a short bound, the confirmation keeps line 1 as before and a later acquisition re-anchors. The foreign-owner reproduction now asserts the re-anchor contract: the same trusted id from a live process outside the owner's ancestry moves line 1 onto that process's CLAUDE_PID, and a different id is refused against it afterwards. The ancestry membership loop is shared through one session-lock lib helper. The earlier commit dropped the ancestry suite's dead-front-end reclaim phase; that coverage lives in the existing reclaim tests (test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's test_reclaims_stale_session_lock_before_arming). * fix(bin): record the lock holder for a lease pinned before a re-anchor The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the start of each engine turn. A same-session re-anchor inside that turn moved line 1 to a new pid while the pinned holder stayed alive, so a later claim or same-actor refresh in the turn recorded the old pid and the lease read stale, letting main claim the branch's task. A claim now records the live line 1 when the pinned holder is alive but is no longer line 1. Another session takes the lock only from a dead owner, so that state comes from a re-anchor; a dead pin is still recorded as before and its lease stays stale. * no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor * no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment * no-mistakes(review): Correct lock takeover and re-anchor signal-window comments * no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence * no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder
* feat(bin): watch a tool's published version through version_url A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry. * no-mistakes(review): Compare published versions against newest installed tool copy * no-mistakes(document): Clarify watched-tool version URL documentation
…mand loads them (kunchenguid#7287) * fix(pi): keep a live session's extension markers when a nested Pi command loads them A short-lived Pi command started from inside a live session, such as the `pi --help` capability probe, auto-loads the two primary extensions. Both treated the session lock as owned because an ancestor holds it, so the child rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with its own pid and exited. Session start then rejected the markers and printed a false `PI_WATCH_EXTENSION: not loaded` alarm. Before writing, each extension now reads the marker's pid and leaves the marker untouched when that pid is a live strict ancestor of the current process. A missing marker, a dead pid, the current pid, or a live pid outside the ancestry still writes as before, so a fresh start and a relaunch over a dead session bind unchanged. Lock ownership and the reader are untouched. Fixes kunchenguid#5202. * fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them
* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart
An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.
* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims
* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid
* no-mistakes(review): exercise real lock recovery in orphan supersession tests
* no-mistakes(review): record lock-holder pid-identity instead of bare pid
* no-mistakes(document): complete autoarm claim-open coverage list
* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix
* no-mistakes(document): Clarify auto-arm claim documentation
) * wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration) * feat: verify the polytoken worker adapter (crewmate + scout) Add polytoken 0.8.19 as a verified crewmate/scout adapter on the captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection and backend parity while the control verbs ride the session daemon's typed REST API. Detection is ancestry alone on the anchored polytoken comm (a tool subprocess's parent is the session daemon, verified live), with the launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed harness-identity set. The launch generates the per-task worker config dir (mirrored operator config with the unattended permission posture enforced, because a project config.yaml fully replaces the global config), the worker role-contract facet (no model pin, delegation and facet switching denied at the tool registry), and the worktree hook layer binding the verified busy pair - pre_user_prompt and pre_model_turn open, stop closes - to a no-argv generated writer. The readiness gate binds the session id, port, and credential into task metadata through sessions --format json and fails loudly on any first-start dialog, because the license terms are a blocker by captain decision and --accept-license-terms is never passed. Interrupt is POST /turn/cancel with its typed settle (the TUI has no interrupt chord, so no key is ever improvised), exit is /quit, and a cancelled turn's busy close is written by the control plane because no stop hook fires. The composer is the verified separated shape with polytoken as its second owner, and Enter mid-turn queues, so the busy-queued conversion applies. Crewmate and scout only: a secondmate launch is refused, and a project's own .polytoken/hooks.json is refused rather than clobbered. * no-mistakes(review): Fix polytoken launch flag order, token argv, live guard * no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant * no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim * no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing * no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files * no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring * no-mistakes(document): Note teardown as consumer of harness wiring-path table * no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring * no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms * no-mistakes(document): Note relaunch also skips git-tracked wiring paths * test: stub polytoken in the refused-relaunch fixture The refused relaunch onto polytoken resolves the polytoken binary before its hook-layer refusal, so the case failed on CI hosts without the real CLI installed. A no-op stub on the fixture PATH stands in; it is never launched. * no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths * no-mistakes(review): Snapshot busy record after cancel settles before idle close * no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck * no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary * no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal * test: preserve Polytoken hook refusal coverage with explicit pins * no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker * no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker * fix: scope worker wiring cleanup to Polytoken * fix(bin): point Polytoken workers away from tool_flow for the task directory Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read refuses the Firstmate task directory while the direct file tools reach it under the generated bypass matcher. The worker facet now says so, and the verification record carries the live evidence. * fix(bin): leave the pool as found when a fresh spawn fails A fresh spawn that fails and leaves no task record now closes the endpoint it opened before its launch was delivered, so the shell whose treehouse get leases the slot ends and the pool gets the slot back. It also removes the harness wiring, task temp root, and staged launch file it wrote, and drops its slot claim under a retaken project lock after metadata publication. * no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes * fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken The failed-spawn pool cleanup and the Running-for busy row now apply only to Polytoken, so every other harness keeps main's abort behavior, header text, operator messages, and harness-less busy union. Tests prove the Polytoken path cleans up and a non-Polytoken refused launch behaves as on main. * no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity * no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window * test: track the spawned window in the Polytoken harness tmux stand-in Main now requires exact tmux window membership before sending keys (aa9ab04), and the Polytoken harness stand-in listed no windows, so the merged spawn could never deliver Enter. Record the created window, list it, and forget it on kill, as tests/fixtures.sh does. * no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns * no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change * no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions * no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ne (kunchenguid#7450) Port the reported-check fallback and regressions from df60538. Preserve required-only reporting when required checks exist and refuse failed fallback reads.
* fix(tests): clean read-only relaunch fixtures Use the shared fixture cleanup so generated read-only Git hook directories do not leave permission errors and temporary trees behind. * fix(accounts): support durable per-secondmate account pins Resolve optional primary-home secondmate account files through the worker pin parser and checks. Preserve existing defaults when no override exists and re-read the selected pin on spawn, relaunch, and recovery. * no-mistakes(review): Name the rejected pin file in account refusals * no-mistakes(document): Document per-secondmate account pins in relaunch and layout docs
…unchenguid#6958) * feat(watch): consult opt-in operator guards before a wedge escalation Add config/wedge-evidence-guards, an opt-in list of operator-owned guard executables that the watcher's at-threshold wedge branch consults after the wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX consecutive deferrals recorded beside the other wedge-window records, and the escalation that ends a capped run names the guard and its reason. Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an untrusted config or guard is never run. With the config absent the ladder is unchanged. Refs kunchenguid#6919 * no-mistakes(document): Document wedge-evidence-guards in home layout index * no-mistakes(document): Align jev-guards CRITICAL verdict with bounded deferral
…guid#7460) * fix(bin): make the brief's inbox listing succeed on an empty inbox The worker brief told crewmates to list the inbox with a bare *.msg glob. On an empty inbox that glob fails: bash ls exits 2 and zsh aborts with 'no matches found'. Use find piped to sort -V so the listing is silent on an empty or absent inbox and keeps numeric order past 999. Refs kunchenguid#7244 * no-mistakes(review): Make relaunch note inbox listing safe when empty
…unchenguid#7394) * fix(bin): fit remote second-mate convergence inside the startup network bound The deferred startup network stage (120s) timed out once four second mates were remote: the mates already converge concurrently, but each mate's inheritance push sent its fifteen allowlisted items one SSH round trip after another, so a single mate's convergence took 64-76s after a ~16s liveness pass. - fm-remote-inherit-push.sh validates and snapshots every item locally first, so a local refusal now sends nothing, then sends the items up to FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in allowlist order. A failed item still fails the push with its own error, and no further item is started after it. The receiver is unchanged: each item is its own file and generation record, and the host's job worker still runs one home's commands one at a time. - fm-bootstrap.sh gives each remote mate's convergence its own budget, FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry marker, instead of holding the whole stage past its bound. * fix(bin): nudge a remote second mate to re-read only when something changed Each remote convergence attempt records its retry marker before it starts, so a sweep cut off by the startup network bound or failing before any change left a marker that made the next session start nudge every remote mate even though its instructions and inherited files were unchanged. The marker now records whether a re-read is owed, set only once an attempt actually changed the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/, or .agents/skills/ no longer counts as a change. * fix(bin): keep a remote mate's re-read owed when its convergence is cut short A convergence step stopped by the per-mate budget loses its output, so a push that had already applied an item reported nothing and left the retry marker with no re-read owed; the next start then saw every item unchanged and never told the mate to re-read. A step cut off by the budget now marks the re-read owed, and so does a failed push whose output shows items it had already pushed or removed. The lifecycle e2e suite runs every remote leg through the real entrypoint and job worker on the test machine, so it now gives convergence ample time; the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose budget and failure cases are also made independent of machine load. * no-mistakes(review): Keep re-read owed on partial or unknown completion * no-mistakes(review): Persist owed re-read when killed mid-mutation * no-mistakes(document): Fix stale remote re-read owed docs * test: send inherited items one at a time in the remote lifecycle e2e fixture Behavior portable serial 5 failed on the watcher auto-relaunch leg of tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push started overlapping its sends. Across 14 recent main CI runs that suite's remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range, while legs that push nothing were only 5-10% slower. The watcher relaunch is a remote spawn, and the only changed code on that path is the inheritance push. This fixture's transport has no network latency and its job worker runs one home's commands one at a time, so overlapping sends cannot hide any round trip there and only add submission overhead to every remote spawn. The suite now sends one item at a time, as it did before; the overlapped scheduler stays covered by tests/fm-bootstrap-network-parallel.test.sh, and the production default of four is unchanged. The watcher leg's failure now also prints the watcher's output. * no-mistakes(document): Clarify remote re-read obligations and consolidate documentation * fix(bin): record a remote mate's re-read as owed before convergence can change its home A live run against a real remote second-mate home showed the owed re-read still lost when the startup network bound stopped the stage. That bound stops it the way `timeout -k 1` does: TERM to the stage's process group, then KILL one second later. Bash defers a TERM trap while the convergence worker waits in a command substitution, and the remote call runs in its own timed process group, so the KILL landed before the trap could record the re-read. The remote home had already applied the change, the next start saw every item unchanged, sent nothing, and deleted the marker, so the mate was never told to re-read. Bootstrap convergence and config-push now write the record owed before any remote step can change the home, and write it back only after the attempt has reported: removed after confirmed unchanged convergence or a successful send, and back to owed=0 when a failed attempt's outcome proves nothing changed. A kill at any point therefore leaves the re-read owed. The TERM/INT traps are gone. The kill regression now sends TERM and then KILL one second later, as the startup bound does; it fails on the previous head and passes here. * no-mistakes(document): Clarify convergence timeout scope and consolidate reread documentation
…d#6987) * fix(bin): refuse spawn into a project with an unborn HEAD Spawn into a repository with no commit waited 60s for treehouse and then reported that the worktree was the spawning project itself, never naming the cause. Refuse before the wait and name the unborn HEAD and the remedy. The project-management skill now states that a new local repository needs a first commit. * docs(skills): tell the captain a new project needs a first commit The Create a project step no longer reads as firstmate committing into the project. It states that spawn refuses an unborn HEAD and that the captain is told the project needs a first commit. * test: give spawn fixtures a first commit for the unborn-HEAD refusal * no-mistakes(review): Commit foreign consent fixture so spawn guard passes
…log items for GitLab MRs (kunchenguid#7462) * feat(bin): add an attended GitLab --allow-no-pipeline merge waiver A GitLab repository that deliberately runs no merge request pipeline could never be merged through fm-pr-merge.sh: the guard requires a successful head pipeline at the current head, and GitLab has no per-check waiver. --allow-no-pipeline waives only the pipeline condition, and only when GitLab reports head_pipeline as present and null. A failed, running, canceled, or stale pipeline still refuses, every other condition (open, mergeable detailed_merge_status, no conflicts, discussions resolved) still holds, and the verified head is still passed to glab as --sha. The flag is attended-only (refused while the away-posture record exists), GitLab-only, and takes no value; without it the default refusal is unchanged. * fix(bin): close a GitLab merge request task's backlog item with a note tasks-axi accepts a --pr link only as a GitHub or Forgejo pull request, so after a GitLab merge request landed, teardown could never complete the backlog Done transition and left the close pending forever. Extend the existing Gerrit carve-out in fm_backlog_done and fm_backlog_retain, and the captain-hold answer replay that shares it, to record a GitLab merge request URL as a "GitLab merge request <url>" note, until tasks-axi accepts GitLab merge request URLs. GitHub and Forgejo pull requests are still recorded as pr links. * no-mistakes(document): Note GitLab --allow-no-pipeline waiver in merge-watch record
…henguid#7451) * fix(tests): tolerate slow orphan-storm source launches * no-mistakes(document): docs: pin orphan-storm row to pacing, not lease expiry
* fix: respect gh-resolved base in publication target selection * no-mistakes(document): Document gh-resolved publication target selection
…4728) * feat(bin): add Paseo as an experimental session backend Modeled on the cmux adapter, with Herdr's one-workspace-per-task UX: terminal NAME is the routing authority, workspace title is decoration only. tmux stays the default; Paseo is opt-in via config/backend, FM_BACKEND=paseo, or PASEO_AGENT_ID/bundle-id auto-detection. * no-mistakes(document): docs(paseo): register Paseo across backend inventories and lists * no-mistakes(document): docs(paseo): list paseo in AGENTS.md config/backend entry * fix(bin): give Paseo one shared workspace per project with a tab per task Paseo's sidebar is project > workspace > terminal tab. The adapter used to create one workspace per task, so a fleet showed up as a pile of sidebar entries. It now mirrors Herdr's container shape: one shared `firstmate` (or `2ndmate-<id>`) workspace per project, adopted by cwd and title or created once, with each task as a terminal tab inside it. Kill closes only the task's tab; the shared workspace is never archived and the adapter never runs a `paseo project` command, so Paseo reuses the project registered for the path instead of multiplying projects. Live findings folded in: the CLI prints an Electron warning on stderr when firstmate itself runs inside a Paseo agent, so parsed `--json` calls no longer merge stderr into stdout; `workspace ls` reports the cwd normalized but not symlink-resolved, so adoption matches the raw, logical, and physical path; a bare Escape stays pending in zsh's emacs keymap and fuses with the next key, so the smoke test verifies labels with Enter and sends Escape last. The smoke test now owns a throwaway project directory and deletes the project it registered, so a captain's real sidebar is never touched. Both paseo suites get a portable-serial duration hint and a `paseo` family so the coverage guard stays under its unhinted cap. * test(bin): teach the backend-list suites about paseo CI serial shard 5 failed because tests/fm-bootstrap.test.sh still expected the known-backend list to end at cmux. Add paseo to that expectation and to the sibling lists in the control, trace-context, and teardown-safety suites (with a valid paseo endpoint record), and scrub PASEO_AGENT_ID and __CFBundleIdentifier in the bootstrap suite's hermetic unset so running the tests from inside a Paseo agent cannot flip a default-backend case onto paseo the way $TMUX or HERDR_ENV would. * no-mistakes(review): Fix paseo control keys, secondmate fallback, docs, and tests * no-mistakes(review): Send paseo C-u as raw byte, refuse untokenized keys * no-mistakes(document): Sync Paseo docs for key tokens, secondmate fallback * no-mistakes(lint): Use prefix-form PATH in paseo autodetect tests * fix(bin): make paseo explicit-only and adopt the tab's own workspace Paseo stamps its markers into every descendant process: an agent exports PASEO_AGENT_ID, a terminal tab exports PASEO_TERMINAL_ID and PASEO_WORKSPACE_ID, and both carry __CFBundleIdentifier=sh.paseo.desktop. A tmux server started from a Paseo tab inherits all of them, so their presence never proves the captain chose Paseo (the same finding recorded on kunchenguid#4484 and kunchenguid#3884). fm_backend_detect now ignores every Paseo marker; paseo is reachable only through config/backend, FM_BACKEND=paseo, or --backend paseo, exactly like zellij and orca. That also retires the auto-detected-paseo secondmate fallback to tmux, which only existed because of auto-detection: an explicit paseo still refuses --secondmate, and an unconfigured home inside Paseo stays on tmux silently. Once Paseo has been selected explicitly, PASEO_WORKSPACE_ID is still useful: a firstmate running inside a Paseo tab adopts that tab's own workspace as the project's shared workspace when its cwd is the project, before falling back to the firstmate-title lookup (herdr's launcher-identity rule). Verified live that CLI-created tabs export PASEO_WORKSPACE_ID and no PASEO_AGENT_ID. Docs also note that `paseo run --cwd` is ignored when PASEO_AGENT_ID is set; the adapter never uses `paseo run`. * no-mistakes(test): Drop stale Paseo auto-detect mention from fm-spawn help * no-mistakes(document): Document Paseo own-workspace adoption order * no-mistakes(ci): Fixed ci-3 with a test-only change. The unconfigured-spawn case in test_secondmate_spawn_refuses_explicit_paseo_only failed on CI with "error: no launch template for harness unknown". CI runners have no agent process above the test, so harness detection returned unknown before the spawn reached the home check. The fix pins the harness with `printf claude > "$dir/config/secondmate-harness"` just before that spawn call, with a two-line comment explaining why (tests/fm-backend-paseo.test.sh). I verified locally that tests/fm-backend-paseo.test.sh passes, including the secondmate test, and that shellcheck is clean on the file. I did not rerun it detached from the agent process chain; your earlier report of it failing without the pin and passing with it is the evidence for that part. As you instructed, I made no change for ci-1 or ci-2 (the fork approval gate) or for the Lint 2 runner shutdown, which was infrastructure * fix(bin): let the adapter precheck load paseo Main now checks that a backend's adapter and its sibling libraries are readable before sourcing it, and refuses any backend it has no sibling list for. Paseo had no entry, so every paseo call failed to load the adapter and fell back to 'unknown'. Paseo sources the same siblings as cmux, so it shares that entry and sources through the checked path. * no-mistakes(document): Make fm_backend_source adapter-count comment count-free * test(bin): prove the Pi branch claims paseo stale wakes The watcher keys a non-Orca stale wake by the task's window= value, and the Pi supervision branch resolves a stale row to its task only through window= (Orca's terminal= key is not indexed, which is how Orca stale wakes ended up waking main). Paseo records window=<terminal-uuid>:<workspace-uuid>, so pin that a stale row keyed by that value is claimed by the branch for the right task. * no-mistakes(document): Note Paseo adapter in composer capture-window config doc * fix(bin): refuse a paseo spawn when its inventory is unreadable Paseo allows duplicate workspaces and terminal names, so the adapter looks up the project's shared workspace and checks the task's terminal name before creating either. Both lookups treated a failed or unreadable listing as empty, so a transient daemon error during spawn created a second workspace for the project or a duplicate task terminal. The spawn now refuses instead, and creates nothing, when either inventory cannot be read. * docs(paseo): note why capture reads the whole scrollback Paseo caps terminal scrollback at 1024 lines, so reading all of it and trimming locally stays bounded however long a task runs. A bounded `--start -<n>` read is not a drop-in replacement: it counts the blank screen rows below the prompt as the tail, so a quiet terminal captures as empty. * no-mistakes(document): Document Paseo spawn refusal on unreadable inventory * no-mistakes(lint): Rewrite paseo workspace inventory check as explicit if-block * feat(bin): keep paseo tasks from cluttering the sidebar Every project a firstmate worked in got its own "firstmate" workspace in Paseo, and those workspaces and their projects stayed in the sidebar after the work was done. When firstmate itself runs inside Paseo, task tabs now go into its own workspace, whatever the project. A terminal tab names that workspace through PASEO_WORKSPACE_ID; an agent session only has PASEO_AGENT_ID, so its workspace is the one live workspace whose folder is the firstmate home. Otherwise the per-project shared workspace is still used, and closing its last task tab archives it and deletes its project when the folder is one of the home's own clones. Archiving a workspace also archives its agents and leaves the project listed, so cleanup skips firstmate's own workspace, workspaces titled by someone else, workspaces with an agent in their folder, and projects outside the home, and does nothing when an inventory cannot be read. * no-mistakes(review): Retire paseo workspace when tab already gone; rename spawn vars * no-mistakes(document): Align Paseo doc workspace wording with own-workspace placement * fix(bin): serialize paseo spawns with workspace cleanup Cleanup checked that a per-project workspace had no tabs, made more Paseo calls, and then archived it. A spawn could open a tab in that workspace in between, and the archive would then take a live task's tab with it. Spawning (choosing or creating the workspace and opening the tab) and cleanup now share one home-wide lock, the stale-owner lock from fm-wake-lib.sh that herdr already uses. A spawn that cannot get it refuses and cleanup skips. Cleanup now only archives a workspace for one of the home's own clones, which only this home spawns into, so a per-home lock covers every spawn that could use it. * no-mistakes(document): Scope Paseo workspace retirement to home clones in architecture * test(paseo): fix shellcheck SC2031 lint warning in fm-backend-paseo test The workspace-lock holder helper read $! after backgrounding the holder, which ShellCheck's dataflow analysis flags as SC2031 because the helper only runs inside command substitution. The holder now records its own PID ($$, the same process $! named) before signalling readiness, and the helper returns that. No behavior change. * test(paseo): keep the smoke test from archiving a workspace it did not create Run from a Paseo tab or agent, PASEO_WORKSPACE_ID/PASEO_AGENT_ID steered create_task into the caller's own workspace, which cleanup then archived. The smoke test now unsets both before sourcing the adapter, archives the workspace create_task returned only while its cwd is the test's own temp dir, and runs cleanup once. Test-only; assertions are unchanged. * no-mistakes(document): List paseo in FM_BACKEND and README backend lists * no-mistakes(document): Add paseo to backend dependency docs and lists * no-mistakes(document): docs: list paseo among Command Code refused backends * no-mistakes(document): Note Paseo as unstyled in opencode footer record
…g budget (kunchenguid#7545) (kunchenguid#7558) Claude Code lists skill descriptions within a budget of 1% of the context window and drops the least-invoked skills' descriptions first, which are the rarely-loaded recovery skills whose descriptions AGENTS.md section 13 uses as the trigger index. - Remove the decision-hold-lifecycle redirect stub; nothing on main points briefs at it any more (captain-hold-lifecycle owns the policy and docs/captain-hold-lifecycle.md still documents the fm-decision-hold.sh shim). - Tighten the longest skill descriptions to their load triggers, keeping every trigger. Total description size drops from 11312 to 6142 characters across the listing. - Document /doctor, /skill-doctor, skillListingBudgetFraction, and skillOverrides "name-only" in the Claude harness adapter notes as opt-in, home-local vendor settings. No session-start budget warning or other default-on surface is added.
…enguid#7563) * fix(extension): launch lifecycle helpers through verified Bash The extension host spawned bin/fm-procevent.sh directly with shell:false, which native Windows Node rejects with spawn EFTYPE because it cannot run a script through its shebang. Resolve an absolute Bash from $BASH or PATH, verify it with a short probe (on Windows it must report an MSYS or Cygwin OSTYPE, so WSL bash.exe is skipped), and pass the script as its first argument. The child keeps shell:false, the sanitized environment, literal argv, and the existing failure mapping. Fixes kunchenguid#7559 * no-mistakes(review): Harden lifecycle Bash interpreter verification * no-mistakes(document): Document lifecycle Bash verification contract * fix(extension): try exported BASH only on Windows for lifecycle helpers
…nchenguid#7348) Sites that run one no-mistakes daemon per isolated workspace keep each task's runs in a per-workspace NM_HOME that cannot be derived from the shared gate remote, so crew state, pipeline spend, and teardown read the wrong home. When NM_HOME is unset and config/nm-home-resolver names a site-provided executable, fm-nm-run-lib.sh now calls it with the task copy path and exports the printed home for that one call. Only host reads (axi status, the axi overview, axi logs, runs, daemon status, the state database) and axi abort --run use it. An explicit NM_HOME always wins, and with no file behaviour is unchanged. Fixes kunchenguid#7309
…ds-decision line (kunchenguid#7361) * feat(bin): let a worker's own open blocked: or needs-decision: line defer wedge escalation behind config/wedge-defer-worker-wait Opt-in only: absent the flag the wedge ladder is unchanged. Counts only the worker's own newest line (reserved keys excluded via status_own_open_decisions), defers onto the existing bounded recheck with a verb-specific clearing action and no escalation-count increase, and ends on any newer status line or a newer acknowledged inbox record. The away daemon honors the same evidence before escalating an enriched wedge. Refs kunchenguid#6899 * no-mistakes(document): Document worker-wait deferral in wait-evidence lists
* feat(bin): pin per-mate secondmate runtime overrides in config/secondmate-harness A single default pin line gives every secondmate one runtime, so raising the default pin silently migrates a mate the captain ruled onto its own runtime. config/secondmate-harness now accepts optional "mate <secondmate-id>: <harness> [<model>] [<effort>]" override lines, and fm-harness.sh secondmate, secondmate-model, and secondmate-effort take the secondmate id as an optional second argument that selects that line. Spawn, the control-plane relaunch, and the secondmate restart each pass the mate id they already know, so all three resolve one decision. A malformed pin file is refused with its line number and prints no token instead of resolving around it to the default runtime. * no-mistakes(review): Bypass unused pins during explicit secondmate relaunch * no-mistakes(document): Correct and consolidate per-mate runtime pin documentation * fix: preserve legacy secondmate pin parsing without overrides * fix(bin): keep legacy secondmate pin files opt-in config/secondmate-harness is documented as "the first non-empty, non-comment line is parsed". The per-mate override grammar made the whole file strict, so a second default line or a fourth token started refusing every secondmate spawn, relaunch, and restart - even in a home that never wrote a mate line. That changed how an existing, already-valid file is read, so the feature was not opt-in. Scope the strict whole-file parse to files that declare at least one "mate <secondmate-id>:" line. A file with no mate line parses exactly as before: first non-empty, non-comment line, the rest ignored, a fourth token ignored, nothing refused. A file that does declare a mate line keeps the strict parsing, so a duplicate override, a malformed entry, or an extra token still refuses loudly with its line number. Coverage: a legacy file with a second default line and a fourth token now spawns, relaunches, and restarts a mate onto its first line; a declaring file that is malformed refuses each of those paths with the offending line; and an explicit --harness/--model/--effort relaunch succeeds whatever the pin file holds, because the config read stays behind the explicit-harness guard. * no-mistakes(document): Document per-mate secondmate runtime pins * no-mistakes(ci): Fixed `tests/fm-backend-herdr-presentation-e2e.test.sh` teardown to restore write permission on fixture directories before removal. This addresses the read-only git-hook cleanup errors in the failed Herdr check. The real-Herdr presentation E2E test passed locally (exit 0)
…unchenguid#6973) Adds bin/fm-capacity.sh, a read-only, network-free report of open ship/scout lanes against an optional config/lane-capacity target plus host load, memory and disk headroom. Without config/lane-capacity it reports counts only and gives no dispatch-hold advice. Docs, operational-home-layout skill entry, a gated AGENTS.md pointer, and tests/fm-capacity.test.sh.
… panes (kunchenguid#7437) * fix: bound unknown-live watcher alarms * no-mistakes(review): Gate unknown-alive stale bound on progress; fix arm CONFIG * no-mistakes(review): Keep watch.env loading only in the watcher arm * no-mistakes(review): Seed worktree progress before first unknown-alive alarm in test * no-mistakes(document): List config/watch.env in operational home layout * no-mistakes(review): Narrow watch.env docs to arm-launched watchers --------- Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>
Bring in the 89 upstream commits since the last sync base 5838f10 (kunchenguid/firstmate main at 8eb9be5). Every conflict keeps both sides' intent: upstream's fixes and features land, and the fork's Kiro behavior stays. Conflict resolutions that change more than a union of both sides: - .github/workflows/ci.yml and tests/fm-ci-workflow.test.sh stay deleted: the fork runs no GitHub Actions (#4), so upstream's CI edits and the fork-skip repository variables do not apply here. - bin/fm-brief.sh: both sides added a rule 8. The fork's tool-gap rule keeps 8 and upstream's no-leading-cd rule becomes 9 in both ship and scout briefs; its test anchor follows. - bin/fm-pr-merge.sh: the fork's --stack-base and --adopt-external refusals were written against GitLab only; upstream added Forgejo, so both now refuse every non-GitHub forge, where the guard and adoption they need do not exist. - bin/fm-fleet-snapshot.sh keeps the fork's general file transport for backlog-sized JSON, which already covers upstream's narrower contribution-input argument-size fix. - bin/fm-bootstrap.sh keeps the fork's single verified-adapter owner (fm_control_harnesses), which now also lists commandcode and polytoken. - .pi extensions take upstream's live-ancestor marker guard, read through the fork's structured lock ownership. - bin/fm-watch-checkpoint.sh takes upstream's INT-then-kill bound and keeps the fork's foreground-checkpoint environment. - bin/fm-watch.sh takes upstream's interruptible capture and keeps the fork's foreign-endpoint escalation and Kiro idle-composer doorbell. - bin/fm-teardown.sh runs both the Kiro V3 project-config removal and upstream's Polytoken wiring removal.
…iro and teardown rules Fixes the regressions the targeted test run found after the upstream merge. - bin/fm-pr-lib.sh: the fork's recorded-PR merge proof now reads Forgejo through upstream's tea reader, so a merged Forgejo PR can be cleaned up and an unmerged one still refuses. - bin/fm-pr-merge.sh: the --stack-base and --adopt-external refusals keep naming GitLab and also name Forgejo. - bin/fm-watch-checkpoint.sh: upstream already exports FM_WATCH_FOREGROUND_CHECKPOINT, so the fork's extra env prefix is dropped; it broke the Perl timeout fallback on a minimal PATH. - Kiro test fakes (supervision host, primary doorbell, Kiro harness, daemon) answer upstream's exact tmux window-membership check. - Upstream tests that tore down a ship with a recorded PR or no worktree now stage the forge's merged verdict or use the captain discard path, as the fork's merge-proof rule requires.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Merges
kunchenguid/firstmatemain(89 commits, from the last sync base5838f105through8eb9be51) into the fork, keeping every Kiro behavior of the fork.The fork stays the single place that carries both the Kiro fixes and upstream's updates.
Merge this PR with a merge commit (
gh pr merge --merge), not squash or rebase, so8eb9be51becomes an ancestor ofmainand the next upstream sync has the right merge base.Two commits:
a411cac1is the real merge commit (git merge upstream/main), with every conflict resolved.70ce997ffixes the regressions the test run found after the merge (listed under "Post-merge fixes").Upstream commits brought in
89 commits.
Notable ones:
commandcode(feat(bin): add a verified Command Code (commandcode) crewmate/scout adapter kunchenguid/firstmate#6679) and Polytokenpolytoken(feat(bin): add Polytoken crewmate/scout worker adapter kunchenguid/firstmate#7321), crewmate and scout only.tea(feat(bin): support Forgejo/Gitea as a forge via the tea CLI kunchenguid/firstmate#4395),forge=externalreview rail that never pushes task branches (feat(bin): add a forge=external review rail that never pushes task branches kunchenguid/firstmate#7368), GitLab--allow-no-pipelinewaiver and GitLab backlog closing (feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs kunchenguid/firstmate#7462).fm-capacity.shlane and host headroom report (feat(bin): add fm-capacity.sh to report open lanes and host headroom kunchenguid/firstmate#6973).firstmate-self-reposkill (fix: require explicit authority for Firstmate upstream contributions kunchenguid/firstmate#7172).cd(feat(brief): forbid leading cd in generated scout and ship briefs kunchenguid/firstmate#7481); Herdr opt-in project groups (feat(herdr): opt-in project groups with status tags and a sorted agents view kunchenguid/firstmate#7434) and resume lock wait (feat(bin): add opt-in --herdr-resume-lock-wait to fm-spawn kunchenguid/firstmate#6649); daily startup growth check (feat(bin): add armable daily startup growth check kunchenguid/firstmate#6725).Conflicts and how each was resolved
37 files conflicted (35 content conflicts and 2 delete/modify).
Cases where both sides changed the same behavior differently (upstream's structure kept, the fork's need re-applied on top):
.github/workflows/ci.yml,tests/fm-ci-workflow.test.sh(delete/modify). Kept deleted: the fork runs no GitHub Actions (Remove every GitHub Actions workflow from the fork #4). Upstream's CI edits and its fork-skip repository variables inCONTRIBUTING.mddo not apply here;.no-mistakes.yamlkeepsno_ci: trueand takes upstream's lint line (bin/fm-lint.sh && bash tests/fm-pi-primary-types.test.sh), with its comment corrected because this fork has no CI lane.bin/fm-brief.shrule 8. Both sides added a rule 8. The fork's tool-gap rule keeps 8 and upstream's no-leading-cdrule becomes 9 in ship and scout briefs; thetests/fm-brief.test.shanchor follows.bin/fm-pr-merge.sh--stack-base/--adopt-external. The fork refused them only on GitLab; upstream added Forgejo, so both now refuse every non-GitHub forge, naming GitLab or Forgejo. Upstream's--allow-no-pipelineand its--allow-missingGitLab/Forgejo refusals sit beside them.bin/fm-fleet-snapshot.sh. Kept the fork's file transport for backlog-sized JSON, which already covers upstream's narrower contribution-input argument-size fix (fix: avoid argument-size failures in fleet contribution snapshots kunchenguid/firstmate#6830); upstream's guard test passes.bin/fm-bootstrap.sh. Kept the fork's single verified-adapter owner (fm_control_harnesses) instead of upstream's second hand-written list; that owner now also listscommandcodeandpolytoken, and the bootstrap test carries both upstream's Command Code case and the fork's same-verdict-with-or-without-key case..pi/extensions/fm-primary-pi-watch.ts,fm-primary-turnend-guard.ts. Took upstream's live-ancestor marker guard (fix(pi): keep a live session's extension markers when a nested Pi command loads them kunchenguid/firstmate#7287) and read it through the fork's structured lock ownership (lockOwnership().kind).bin/fm-watch-checkpoint.sh. Took upstream'srun_bounded <seconds> INT 5bound; upstream now exportsFM_WATCH_FOREGROUND_CHECKPOINT=1itself, so the fork'senvprefix was dropped (fixed in70ce997f).bin/fm-watch.shinbox doorbell. Took upstream's interruptiblewatcher_capture, kept the fork's foreign-endpoint escalation and Kiro idle-composer doorbell.bin/fm-tmux-lib.shcomposer state. Took upstream's Command Code cursorless reclassification, kept the fork's[harness]argument through every classify call.bin/fm-teardown.sh. Runs both the fork's Kiro V3 project-config removal and upstream's Polytoken wiring removal; the PR-merge proof comment covers Forgejo and multiplepr_merged=entries; the state cleanup list carries bothunclosed-relayand upstream's Claude/Polytoken files.bin/fm-dod-lib.sh. The fork's unread-steering-inbox gate runs first, then upstream'sforge=externaldone path.docs/configuration.mdstale/resurface bounds. Took upstream's wording forFM_STALE_ESCALATE_SECS,FM_BUSY_TURN_MAX_SECS, andFM_PAUSE_RESURFACE_SECSand re-added the fork's "or a needs-decision not yet resolved" bound.Additive unions (both sides kept as written):
bin/fm-control-lib.sh(12 hunks),bin/fm-spawn.sh(16 hunks),bin/fm-harness.sh,bin/fm-busy-lib.sh,bin/fm-composer-lib.sh,bin/fm-supervision-engine-lib.sh,bin/fm-test-run.sh:kiro-clipluscommandcode/polytokeneverywhere both appeared, including the Kiro launch, effort, KIRO_HOME build, launch gate, and busy arm next to upstream's Polytoken and Command Code arms; the Kiro arm now reads upstream'sWIRING_HARNESS.bin/fm-spawn.shalso keeps the fork's worker pipefail and provider-limit post-launch watch next to upstream's Orca environment source, external-review state, Herdr resume lock wait, upstream-consent relaunch refusal, and Herdr group tagging.bin/backends/herdr.shkeeps the fork's systemd start and Kiro env scrub and adds upstream's</dev/null.bin/fm-pr-check.sh,bin/fm-pr-lib.shkeep--adopt-externaland the branch-family helper and add upstream's capacity and Forgejo notes.agent-skill-trigger-index,bootstrap-diagnostics,captain-hold-lifecycle,harness-adapters,operational-home-layout,stow),CONTRIBUTING.md,docs/scripts.md,docs/verification/runtime-backends.md: upstream's new wording plus the fork's Kiro, tool-gap, unclosed-relay,note-rewrite, and real-Herdr-lane text.fm-bootstrap,fm-brief,fm-control-relaunch,fm-pi-watch-extension: both sides' cases kept.One non-conflicting upstream addition also needed the fork's harness:
fm_control_interrupt_transportlistskiro-clias a key-plane harness.Post-merge fixes (
70ce997f)bin/fm-pr-lib.sh: the fork's recorded-PR merge proof (fm_pr_read_record_for_url, Refuse teardown while a ship's recorded PR is not merged #39) now reads Forgejo through upstream'steareader, so a merged Forgejo PR can be cleaned up and an unmerged one still refuses (upstream's Forgejo teardown case exercises both).bin/fm-watch-checkpoint.sh: drop the redundantenvprefix that broke the Perl timeout fallback on a minimal PATH.fm-supervision-host"kiro served",fm-primary-doorbell,fm-kiro-harness,fm-daemonKiro placeholder case) now answerlist-windows.--force).Kiro behaviors re-checked
tests/fm-primary-doorbell.test.sh20/20tests/fm-watch-checkpoint.test.sh,tests/fm-supervision-host.test.shpasstests/fm-kiro-harness.test.sh42/42 (see note below),tests/fm-task-inbox.test.shpasstests/fm-composer-lib.test.shpasstests/fm-daemon.test.shpass.kiro/steering/firstmate-dispatch.mdunchanged by the mergetests/fm-spawn-quota-guard.test.shpass (the live guard is opt-in and skipped)tests/fm-teardown.test.shrecorded-PR cases on GitHub, GitLab, Gerrit and now Forgejo passtests/fm-task-browser-stop.test.shpass; the teardown bridge case fails identically onorigin/mainon this host (below)fm-kiro-harnessnote: run inside a Kiro worker, the session's ownKIRO_DUMP_REQUESTSleaks into the "unchecked session" case and it fails on both this branch andorigin/main; with that variable unset all 42 cases pass.Test results
bin/fm-lint.sh: pass. Full canonical lint (CI=true bin/fm-lint.sh): findings only inbin/fm-backlog-pruner.sh,bin/fm-kiro-turnend-hook.sh,bin/fm-tool-gaps.sh,tests/fm-kiro-harness.test.sh,tests/fm-pr-merge.test.sh, the same findingsorigin/maingives for those files.bin/fm-doc-audience-check.sh:ok surfaces=128 local_links=875.LC_ALL=C bin/fm-test-run.sh --check-coverage:FM_TEST_COVERAGE ok total=285.tests/*kiro*,tests/fm-primary-doorbell*,tests/fm-teardown*,tests/fm-procevent*,tests/fm-spawn*. 21 are live or backend-specific guards that skipped here (no credentials or backend installed).All pass except the following, each of which fails the same way on
origin/mainon this host (run from a clean export oforigin/main):fm-captain-hold-lifecycle: "the PR merge entrypoint refused a home carrying no backlog".fm-teardown: "task-boards-browser: fixture bridges did not start" (every other case passes, including the ones after it).fm-procevent: "the listener under test was not reparented away from its session".fm-public-followup: "the outcome text was not bounded, got 1200 characters".fm-session-lock-ancestry: "the pty-host was not reparented to init after the daemon ended".fm-test-run: "--jobs on a proven family must be admitted".fm-spawn-dispatch-profile: "no-profile claude launch did not use the canonical launch kind".fm-kimi-harness: the kimi launch carries the worker pipefailBASH_ENVprefix.fm-calm-pi-extension,fm-agy-harness,fm-bootstrap(Herdr missing-CLI case),fm-live-lab.fm-cursor-harness: "resolve with no candidates must fail"; this host has/usr/bin/cursor-agent, and the case fails onupstream/maintoo.Rerunning these with the worker's Kiro and Herdr session variables removed gives the same result.
But for real
kiromentions (one description line upstream removed fromharness-adapters); Kiro tests above pass8eb9be51is the second parent ofa411cac1; every line upstream added to a conflicted file is present or was deliberately adapted (listed above)a411cac1has parentse57f6a3cand8eb9be51origin/mainexport70ce997f; each fixed test rerun and passingThe whole diff against
origin/mainwas reviewed for the conflicted files; the remaining diff is upstream's own content.AGENTS.md's verified-harness line does not listkiro-clialthough the code verifies it for all four kinds; that predates this merge and is left unchanged.Prova: não provado no jogo (mudança no Firstmate, sem jogo envolvido).