Repository navigation
feat: merge upstream kunchenguid/firstmate main into the fork - #54
Merged
Merged
Conversation
…unchenguid#7172) * feat(bin): gate firstmate-upstream publication behind a declared home role Users who clone firstmate and run it as-is got a surprise: when their agent hit a firstmate bug, it could drive a pull request at upstream because nothing distinguished the maintainer's home from an ordinary user's. Every home now resolves to user/operator unless the gitignored config/firstmate-role grants a maintainer scope, or a single task carries the captain's recorded --upstream-consent on the brief, spawn, and promotion. fm-brief, fm-spawn, and fm-promote apply one fail-closed gate in bin/fm-role-lib.sh; the role is never inferred from gh identity, remotes, permissions, or CI, and secondmates honor only receipt-proven inherited grants so a child cannot grant itself. Session start reports the resolved role with no network call. Ordinary project delivery and the clone-and-run setup flow are unchanged. * no-mistakes(review): Harden firstmate role parsing, normalization, and inheritance * no-mistakes(review): Detect firstmate by lineage; drop consent fallback; fix claims * no-mistakes(document): Correct and consolidate Firstmate role documentation
…henguid#7248) * fix: narrow Pi before-agent prompt events * no-mistakes(review): Restore processing-run abort detection and type Pi test events
…guid#6608) * docs: let a home declare authoritative external memory tiers AGENTS.md section 6 routed durable knowledge only to firstmate-local files, so a home whose captain keeps reasoning and facts in external stores had no tracked rule keeping those stores authoritative over the per-machine data/ cache. Add a generic home-declared Memory layering contract (schema in docs/configuration.md), make firstmate the capture path for workers whose harness cannot reach a declared tier, and teach the stow skill to route to declared tiers first and never prune a tier-owned entry without capturing it. * no-mistakes(review): Report missing memory-layering declaration and index tier docs * no-mistakes(document): Narrow memory-tier re-seed step to captain re-declaration * no-mistakes(ci): Environment: 2026-10-05, host wildrobot, Linux 7.0.0-34. Finding ci-1 (Greptile): a tier-owned fact could be lost when its declared tier was unreachable from the session. - The invariant that was broken: until the declared tier holds a tier-owned fact, that fact must stay in a memory file loaded at startup. - Where it could be broken: the declared-tier guard, which said to archive the entry to the never-loaded cold tier; the routing step for new findings, which only mentioned the receipt; and the budget-eviction and offload eligibility rules. Fix, made only in .agents/skills/stow/SKILL.md: - **New marker.** Added `<!--t:NAME-->` to the existing compact marker list, so its meaning lives in one place. It marks a tier-owned entry that tier NAME does not hold yet. Stow never prunes, ages out, evicts, offloads, consolidates away, or archives an entry carrying it, whatever its tier clock says. A later pass that can reach NAME captures the entry there and removes the marker. - **Declared-tier guard.** "still archive rather than delete" now says to leave the entry in place with its pending-capture marker, and the receipt still names it. - **Routing step 2.** When the tier is unreachable, a new finding is written to the startup-loaded local file its class would otherwise use, or kept where it already lives, with the marker. It is still reported as an exception in the receipt. - **Budget eviction and offload eligibility.** Both now exclude entries pending capture, so the convergence pool is counted correctly. - **Receipt bullet.** Changed "finding or pruned entry" to entries left carrying the pending-capture marker, because those entries are no longer pruned. docs/configuration.md ("protects tier-owned entries from pruning") and AGENTS.md section 6 are still accurate, so I left them unchanged. No new file, queue, script, or digest section. One sentence per line, plain dashes. Verification: tests/fm-stow-cascade.test.sh, tests/fm-documentation-audiences.test.sh, and tests/fm-lint.test.sh all pass * docs: keep undeclared memory-tier path silent and close stuck tier markers Drop the stow receipt line reporting a missing Memory layering declaration (AGENTS.md section 6, the stow skill, docs/configuration.md) so a home with no declaration behaves exactly as before. Name pending-capture entries in the exempt floor wording, and say how stow retargets or clears a pending-capture marker whose tier was renamed or retired.
* fix: keep unsupported contributions unmeasured during polling * no-mistakes(document): Clarify unsupported contribution polling documentation * no-mistakes(review): Match literal GitHub hostname and cover unsupported lookalikes * no-mistakes(review): Separate durable ownership compatibility from GitHub observation eligibility * no-mistakes(document): Clarify unsupported contribution coverage and ownership compatibility
…er-strip hooks path (kunchenguid#6341) * fix(bin): keep inherited Git credential helpers when installing the trailer hooks path Problem: Every fleet launch prefixed the worker command with `export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=...`. That replaced any `GIT_CONFIG_*` entries the pane already carried, so a scoped HTTPS credential setup such as `credential.helper=` followed by `credential.helper=!gh auth git-credential` was silently dropped. Git then fell back to the system or global helper (for example `osxkeychain` from the system gitconfig on macOS), so a worker meant to use a scoped token pushed with the user's personal credentials. Reproduction on main: GIT_CONFIG_COUNT=2 GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= GIT_CONFIG_KEY_1=credential.helper GIT_CONFIG_VALUE_1='!gh auth git-credential' sh -c "<emitted launch>; git config --get-all credential.helper" prints none of the inherited entries, only the system helper (`osxkeychain` from Homebrew's system gitconfig on the reporting machine). Fix: The launch prefix now appends `core.hooksPath` at index `GIT_CONFIG_COUNT` and increments the count, resolved in the destination shell after any `config/launch-env-allowlist` filtering. The inherited count is validated as decimal before shell arithmetic, leading zeros are normalized (Git accepts `02`), and a count that cannot be extended within Git's signed int refuses. A refusal uses `return 1 2>/dev/null || exit 1`, so when the pane sources the launch file the error stays visible and the interactive shell survives instead of the pane dying with the message. Tests: `tests/fm-spawn-dispatch-profile.test.sh` gains a behavior test that runs the real emitted launch under sh, bash, and zsh with inherited credential-helper entries and counts `2` and `02`, then asks Git for `credential.helper` and `core.hooksPath`. The same test checks that an invalid or overflowing count refuses, and that sourcing the launch file from an interactive shell keeps that shell alive with the error visible. The exact-launch assertions in the dispatch-profile and Kimi suites now extract the emitted prefix through one `fm_test_launch_git_prefix` helper in `tests/lib.sh` instead of two hand-copied strings, whose content the behavior test covers. Risk: Top-level `return` outside a sourced file is unspecified by POSIX; verified on macOS sh (bash 3.2 in POSIX mode), bash, and zsh, and every path still ends nonzero before the worker command runs. The hook wrapper still unsets only `GIT_CONFIG_COUNT` and index 0, which is sufficient because Git ignores indexed entries once the count is unset. A launch that forwards `GIT_CONFIG_COUNT` without all of its indexed keys now fails in Git instead of being masked by the overwrite. * no-mistakes(review): Keep inherited Git config in hooks and fish-safe launch * no-mistakes(document): docs: describe appended hooksPath keeping inherited Git config * test: run the fish pane launch cases in CI Install fish in the portable serial lane and run the credential-append and invalid-count refusal cases under fish. Under CI the spawn test fails instead of falling back to the static syntax check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test: strip the Git config launch prefix before reading the Claude doorbell The trust suite evaluated the whole launch command to find the final prompt argument, so it now also sourced the per-spawn git-config env file that the fake pane never writes. Drop that prefix the same way the dispatch suite does. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test: share the launch command parser across the spawn suites The trust suite failed in CI because its copy of the launch parser missed the Git configuration prefix the dispatch suite's copies already stripped. Move the prefix and export stripping into tests/lib.sh next to fm_test_launch_git_prefix so the three parsers cannot drift again. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(bin): canonicalize env-file hooks path and tighten launch-config tests env-file now writes the canonical (pwd -P) spelling of the hooks directory, matching what install records, so a symlinked path no longer makes the hook wrapper miss its own entry and silently skip the repository's hook. A new strip test passes a symlinked hooks path through env-file and fails without this change. The launch-env-allowlist test now also asserts the appended core.hooksPath, so a regression that drops the strip-hook entry only on the env -i path is caught. Without fish installed locally, the launch test now prints an explicit fish skip line and limits its pass message to sh, bash and zsh, instead of claiming every pane shell after only a static token check. * no-mistakes(review): Drop CI fish install and CI-only fish refusal * no-mistakes(document): Document GIT_CONFIG_COUNT overflow refusal in configuration docs * test: prove a refused Git config count never starts the worker The invalid-count refusal checks only asserted a nonzero status and the helper's own error text. If the launch line kept going after the refusal, the worker probe's final `git config` also failed under the bad count, so the checks still passed. The probe now prints a marker on stderr, and every refusal case in sh, bash, zsh and fish asserts the marker never appears. Dropping the `|| return 1 2>/dev/null || exit 1` guard from the launch line now fails the test. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…available (kunchenguid#6810) * fix(bin): name the failing read when a contribution observation is unavailable An unavailable contribution observation recorded one constant error and discarded the failing read's exit status and error output on cleanup, so a network failure, a forge refusal and a structural check failure all looked the same and left nothing to diagnose once the next good read cleared it. The record's error and the unavailable line now name the first failing step: the read's label, exit status, budget seconds left and the first line of its error output, or the structural check that refused the observation. Budget refusal stays silent and unmeasured as before. * no-mistakes(review): Label closing head read's structural failure as its own cause * no-mistakes(document): Note structural refusals record contribution errors too
…unchenguid#6365) * fix(spawn): give Orca workers an opt-in scoped environment source Fixes kunchenguid#6339 On the Orca backend, `config/launch-env-allowlist` expands each allowlisted name in the destination pane, and that pane is an Orca terminal whose environment comes from the Orca app and the user's shell startup files. Allowlisted credentials therefore resolve to the user's personal values or to nothing, with no warning, while the same allowlist scopes tmux workers correctly. Add an opt-in `config/launch-env-tmux-session` naming one tmux session. On a fresh Orca spawn, before the worktree or terminal is allocated, fm-spawn reads each allowlisted name from that session's local environment with `tmux -u show-environment -t =<session> <name>`. The worker launches with the existing `env -i` boundary and operational floor, the snapshotted values in place of destination expansion, and `GIT_CONFIG_NOSYSTEM=1` so a system credential helper cannot answer for the worker. The source requires an allowlist, so tmux's automatic update-environment names such as `SSH_AUTH_SOCK` are never forwarded unless listed. A listed name missing from the session, an unreadable session, or a malformed selector refuses before allocation; an explicit `-NAME` record stays a deliberate unset. Values are shell-quoted only in the existing owner-only staged launch file, never terminal input, and the pane deletes that file as sourcing starts; a deletion failure refuses the worker launch and keeps the interactive shell. `-u` is required because tmux's non-UTF-8 client output replaces newlines and non-ASCII bytes in values with underscores. The source is opt-in and nothing changes for homes that do not create the file. When `config/backend` is orca, the allowlist is nonempty, and no source is configured, fm-spawn now prints a stderr warning that allowlisted names resolve from the Orca terminal, so the mismatch is no longer silent. It warns rather than refuses because refusing would stop every existing Orca home that uses an allowlist, which the triage asked not to assume. Other backends, relaunch (already refused on Orca), and secondmate inheritance are unchanged; the selector is not in the inherited configuration list. The scoped Git credential helper case also needs kunchenguid#6341, which stops fm-spawn's `core.hooksPath` entry from overwriting inherited `GIT_CONFIG_*` entries; this change does not depend on it. Tests in `tests/fm-spawn-orca-worktree.test.sh`: - A real-tmux regression on a private socket checks exact multiline UTF-8 values under absent and C locales through sh, Bash, and zsh, refusal of names that exist only server-globally or only inside another value, and exclusion of the automatic `SSH_AUTH_SOCK`. - Fake-Orca spawns execute the real staged launch file under synthetic personal credentials and cover the configured source, an empty allowlist, refusal before allocation for each invalid setting, file privacy and deletion before the worker runs, and the deletion-failure path. - The warning appears for a nonempty allowlist without a source and not for an empty allowlist or a configured source. Risk: the source keeps tmux and the named session as dependencies of Orca spawns, and secret values sit in a 0600 file under a 0700 directory until the pane sources it. It is not a filesystem sandbox; a worker can still read the user's credential files unless the harness restricts that. The hardened path was verified with the regressions above, not with a live Orca spawn. * no-mistakes(review): Harden Orca launch-file cleanup, floor unsets, and stat portability * no-mistakes(review): Scope Orca abort cleanup to the staged launch file * docs: scope Orca source to fresh spawns and qualify pane values Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: state that Orca relaunch is refused Co-Authored-By: Claude Opus 5.5 <[email protected]> * no-mistakes: apply CI fixes * no-mistakes(review): Keep Orca launch file while delivered terminal stays open * no-mistakes(document): Qualify fm-spawn help's destination-pane expansion claim for Orca * fix(spawn): keep launch-send failures fatal and compare tmux bytes per version The Orca launch-file cleanup wrapped both launch sends in a condition, which runs outside errexit. A failed send on tmux and every other non-Orca backend then continued as success, so a post-publication relaunch failure no longer failed closed. Each send failure now exits again, and Orca source mode removes its staged file first. The real-tmux regression asserted that invalid UTF-8 bytes survive tmux itself, which holds on tmux 3.6a but not on the CI runner's tmux. It now asserts that the snapshot reproduces exactly the bytes the installed tmux reports for that name. * fix(spawn): reclaim an Orca launch file the pane never runs In Orca source mode the pane unlinks the credential-bearing launch file as it starts sourcing it. A pane that accepted the source command but never ran it left the file on disk until teardown, because the abort cleanup keeps the file for a delivered, still-open terminal. After delivery, fm-spawn now waits up to 30 seconds for the pane to consume the file; if it has not, fm-spawn removes it and fails the spawn with a status line naming the unrun command. The snapshot already reads and writes tmux output as latin1, so bytes that are not valid UTF-8 reach the launch file unchanged. A deterministic fake-tmux regression now pins that, independent of how the installed tmux stores such values. The live-terminal test now drives a slow pane and fails unless the spawn waits for it, and the controlled-source test reads the file the fake pane consumed. * no-mistakes(review): Keep Orca terminal open when launch file is unconsumed * no-mistakes(review): Refuse Orca worker when launch file already reclaimed * no-mistakes(review): Make Orca spawn's deadline launch-file reclaim exclusive * no-mistakes(document): Document Orca launch-file reclaim keeping the terminal open * fix(spawn): reclaim an interrupted Orca launch file and keep errexit panes open An HUP, INT or TERM after the source command reached the Orca terminal left the credential-bearing launch file on disk: bash ran the EXIT trap with status 0 and abort cleanup kept a delivered file for the pane. Source mode now traps those signals until the pane consumes the file, and abort cleanup reclaims it with the same non-forced unlink arbitration as the consume deadline, refusing the worker when the spawn wins and leaving the terminal open. The delivered source line now keeps a pane shell with errexit set open when the launch is refused, including when the file was already reclaimed. * no-mistakes(review): Trap signals as soon as Orca launch file is published * no-mistakes(document): Record pre-send interrupt coverage in Orca verification notes --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…re, including absolute paths (kunchenguid#7307) * fix(composer): treat OpenCode >= 1.18 right-aligned cwd:branch as furniture OpenCode 1.18.31 draws the worker pane's working directory and branch right-aligned inside the left-bar composer rows above the Build footer, wrapped over up to three rail-width fragments whose final fragment continues onto the footer row's right end. The fragments are RGB 128 grey with luminance exactly on the ghost-luma ceiling, so they survive ghost stripping, and the left-bar classifier read them as unsent typed text: every idle 1.18.31 pane answered pending, which skipped the steering doorbell, the watcher's re-ring ladder, and /exit typing. _fm_composer_leftbar_cwd_start recognises the run structurally and position-gated: contiguous single-token rows immediately above the footer row whose gap after the bar exceeds half the row, whose fragments plus the footer row's gap-separated right-hand tail concatenate to a path, optionally followed by :<branch>. A path-shaped string typed at the composer's left edge is still typed text, so a wrong call can only defer, never inject. Extraction shares the same rule so extracted composer content stays user-scoped. * no-mistakes(review): drop dead footer-tail concat, add live short-cwd fixture * no-mistakes(review): accept only ~/ cwd rail; lone slash stays pending * no-mistakes(review): require footer row for leftbar cwd furniture walk * no-mistakes(review): Require topmost cwd fragment to carry ~/ prefix * no-mistakes(document): Correct cwd furniture recognition doc to topmost-fragment check * fix(composer): gate cwd rail on region width; correct version story Review round on the independent PR review: the position gate now measures the gap against the region's width (the widest trimmed plain row across first..last), so a short space-prefixed home path typed into an otherwise empty composer no longer reads empty; the right-half lone-token residual is pinned explicitly. The cwd:branch furniture is documented as present since OpenCode 1.18.0 (upstream anomalyco/opencode#36457, merged 2026-07-11), not a 1.18.31 layout change. The 1.18.30 capture comment notes it omits the directory footer, and a cropped-composer extraction assertion scopes user content to the typed row above the rail. * no-mistakes(document): correct OpenCode cwd-furniture version framing and doc typos * fix(composer): accept an absolute cwd rail outside $HOME as OpenCode furniture Refs kunchenguid#4632, builds on kunchenguid#5030. * no-mistakes(review): Harden live abs-cwd check waits and qualify rail comment * no-mistakes(review): Fix composer-lib relative path in OpenCode harness doc * no-mistakes(test): Relax live check's DONE wait for wide OpenCode panes * no-mistakes(document): Separate absolute-cwd verification output block from following prose --------- Co-authored-by: Konrad Heimel <[email protected]>
…mpt (kunchenguid#6682) * fix: name the Claude exit picker on existing stale wakes A pane parked on that picker still read as healthy quiet after Enter was refused. The existing stale and wedge reports now carry the dialog name, including through away-mode escalation. Refs kunchenguid#4754 * no-mistakes(review): fix: report exit picker on terminal-status away stales * no-mistakes(document): docs: describe exit-picker reporting in stale supervision * no-mistakes(review): fix: drop away stale marker when second-mate picker closes * fix: keep the exit-picker name off paths main does not already run A second mate stays exempt from stale capture, and a finished worker in away mode no longer ages into a wedge. The name remains on the stale and wedge wakes a worker already raises. * no-mistakes(review): name the exit picker on wedge deferral reasons * no-mistakes(review): limit exit-picker name to plain stale and wedge escalation
…uid#7308) * feat(afk): Spend-Obergrenze beim Eintritt aus der lebenden Worker-Zahl Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze, 0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin. Die Zählung bekommt mit `live-workers` genau eine Implementierung in bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können. * no-mistakes(document): Remove misplaced afk spend-cap plan --------- Co-authored-by: ladwein <[email protected]>
…ion paths (kunchenguid#6965) * fix(bin): guide supervision through completed-scout cleanup * no-mistakes(document): Document completed-scout cleanup ownership and regression coverage * no-mistakes(test): Allow confined lab overrides and verify live scout cleanup * no-mistakes(test): Clarify per-task cleanup reporting and verify live outcomes
…o the job's timeout (kunchenguid#7240) * fix: recheck a worker paused on its own background job A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended. The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes. The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy. Fixes kunchenguid#7239 * test: give the background-job until test headroom over its quiet round The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner. With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly. Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows. * chore: retrigger CI * chore: retrigger CI * no-mistakes(review): Rebuild bg-job until test with passed until, no sleep * no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker --------- Co-authored-by: pedromuller-del <[email protected]>
…dapter (kunchenguid#6679) * feat: add Command Code crewmate and scout adapter Add `commandcode` as a verified worker runtime for crewmate and scout work only, so Firstmate can dispatch workers on Command Code models such as deepseek/deepseek-v4.1-flash. - Detection: the anchored `command-code` process title identifies the adapter in fm-harness.sh and the shared liveness classifier. - Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an effort only where the model's accepted set is verified, and the typed launch brief after --; taste-learning state is kept out of git. - Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per process with --mod and --mod-option, writing run_start/run_end/session end through fm-busy-event.sh; no user or project settings are edited (Command Code's --config persists globally, so it is never used). - Control: one Escape interrupts; the idle double-Escape Rewind picker is a recognized hazard that exit refuses and interrupt dismisses; /quit exits. - Composer: the bright truecolor placeholder is read with an identity-scoped ghost ceiling, and the tmux adapter supplies the identity for a cursor parked below the footer; Herdr reports it natively as `cmd`. - Attribution: the fleet commit-msg strip removes the CommandCodeBot trailer. - Docs, harness reference, verification record, portable regressions, and the FM_COMMANDCODE_SIGNALS_LIVE live guard. * no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments * no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone * no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed * no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160 * no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop * no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs
Claude spills a hook output over 10,000 characters and shows only the first 2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md last, so they never reached the session. Print a short cue first that names the saved file and the memory files, and document the cap. Refs kunchenguid#6303
…kunchenguid#7302) * fix: retry transient contribution reads once * fix: classify contribution read errors safely Address review findings for kunchenguid#7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling. * fix: recognize bare gh HTTP errors Complete kunchenguid#7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification. * no-mistakes(review): Classify gh network errors by Go error tokens * no-mistakes(document): Note why contribution 404 reads are never retried * no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read * fix: retry transient contribution reads once * fix: classify contribution read errors safely Address review findings for kunchenguid#7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling. * fix: recognize bare gh HTTP errors Complete kunchenguid#7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification. * no-mistakes(review): Classify gh network errors by Go error tokens * no-mistakes(document): Note why contribution 404 reads are never retried * no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read
…tion (kunchenguid#7338) * fix(bin): let a backlog captain hold bound the watcher's wedge escalation A stuck worker whose task was held for the captain through bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS, because wedge_wait_evidence only read the status line. It now also reads the open backlog captain call (task_captain_call_open) and defers to the existing captain-facing long recheck, silent while the away record exists. * no-mistakes(review): Publish no wait age for backlog captain holds * no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold * no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract
…guid#5404) * fix(bin): parse Lavish list-form results and refuse unparsed blocks Lavish emits its queued prompts in TOON list form instead of table form as soon as the items stop being uniform, for example when some annotations carry a nested target object or a message carries an attachments table. The adapter only recognized the table header, so read reported a complete, empty result and answers closed nothing. Move the result parsing into one shared reader used by read, answers, and reconciles that accepts both forms, keeps only column-zero headers, skips nested structures only beneath the field that opened them, and counts anything it cannot account for as malformed. An unrecognized header naming the block is now malformed rather than an empty result, answers and reconciles exit nonzero when the result is not fully accounted for, and the queued-content check treats a list header as content. Refs kunchenguid#4726 * no-mistakes(document): Document Lavish capture formats and incomplete-result handling * test: expect captain_message_count for the open-board list-form capture
…uid#5835) * fix(pi): let the supervision branch claim Orca stale wakes The watcher keys Orca endpoints by terminal=, but the branch dispatcher only indexed window=, so every Orca stale row vetoed the wake scan and went to main. Index both endpoint fields. Local hotfix ahead of upstream; refs kunchenguid#5623. * test(pi): cover terminal-keyed Orca stale rows in branch dispatch Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with another eligible row must resolve to its task in both routine and heartbeat scans, instead of vetoing the wake to main. * no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows * fix(pi): reject conflicting wake endpoint ownership Index task keys and window/terminal aliases through one ownership check. Ambiguous records must leave the wake on MAIN instead of selecting the last task and possibly bypassing another owner's open decision. Cover duplicate terminals and collisions with window and task keys in both record orders while preserving unique terminal routing. * no-mistakes(document): Document conflicting alias ownership as scope corruption * fix(pi): retain ownership claims from incomplete task records Check endpoint and task alias ownership before project eligibility so a projectless record cannot lose its open decision to another terminal owner. Require project context before decision filtering can grant routing scope. Cover missing and empty project fields in both record orders, and preserve refusal for a uniquely mapped terminal without project context. * no-mistakes(review): Fix canonical routing ownership and custom SDK event handling * no-mistakes(review): Preserve dedicated custom processing run ownership * no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation
…anches (kunchenguid#7368) * feat(bin): add a forge=external review rail that never pushes task branches A project whose review tool uploads its own snapshot of the worker's local commits can now be registered [direct-PR forge=external]. Workers on such a project never need to push a branch to publish, and must never push a task branch to the shared origin. - fm-project-mode.sh: external joins the closed forge set; never detected, refused on local-only, and +yolo reports yolo=off with a refusal. - fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin and task-prefixed pushes, its Definition of done renders the home's config/external-review.md adapter verbatim, and the ready-report gate accepts `done: review <url> uploaded for review` on the URL alone or, with a recorded backup remote, once HEAD is on the backup namespace. - fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to origin or a URL matching origin's, task-branch and task-prefixed refs on any remote, and refs outside the backup prefix on the backup remote. - fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip. - fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup remote before launch; installs the guard even under keep-ai-trailers; and records forge=external, backup_remote=, and backup_prefix=. - fm-review-check.sh (new): records review= and review_head= with no merge watch, and publishes the child's ready line in a secondmate home. - fm-promote.sh refuses promotion onto forge=external, because a scout launches without the guard. - Docs: docs/external-review-forge.md (design), configuration.md's new "External review tool" section, scripts.md, and the ship-landing and project-management skills. * no-mistakes(review): Drop string-grep hook assertion from external-review spawn test * no-mistakes(document): Note forge=external contract token and direct-PR-only composition
…uid#7387) Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder solche Lauf mit einem Fehler auftauchte statt zu starten. Die Verengung dagegen steht seit 8c9c67d im Zweig, ein Test, der sie benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher Lauf weder wirft noch als Dialog gespiegelt wird. Gegenprobe: ohne die Verengung wirft genau dieser Fall mit "Cannot read properties of undefined (reading 'trim')". Co-authored-by: thelad-dev <[email protected]>
…nchenguid#7409) * fix(tmux): verify exact endpoint membership * fix(tmux): preserve exact target forms * test(tmux): align endpoint fixture lifecycles * test(tmux): guard isolated cleanup and shell reader * no-mistakes(review): Limit tmux .pane target split to window indexes
… plain row (kunchenguid#7395) * fix(bin): stop misreading opencode's own footer as pending composer text An idle OpenCode composer classified as `pending`, and that verdict gates every typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control refuses both relaunch and exit. A firstmate operator lost a full session to it and had to type into worker panes by hand three times. Root cause: opencode 1.19 draws the mode/model footer's identifying cells de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105, luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128 threshold). That helper exists to answer "what did the human type?", so it deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor then became unreachable on every styled backend - tmux, Herdr, and Zellij - not just one pane, because the unstyled row keeps its styling bytes everywhere. The fix proves the footer from both forms of that row: the ghost-stripped content and the ANSI-stripped plain row. Proving it on the form ghost stripping cannot reach is the whole repair. What makes that safe, and why the previous argument was not: the earlier draft argued safety by noting that on a plain capture the two forms collapse to one string, so the verdict is unchanged. That is true and carries no weight, because styled=0 is the only configuration where the new proof does nothing. The exemption is safe because a row reaches the plain form only when the ghost-stripped row still fails the pattern, which means the stripped content is non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing opencode draws de-emphasises a typed row's leading cells - only its furniture is drawn dimmed - so the only rows the plain form admits beyond the stripped one are de-emphasised furniture, and the mode footer is the only furniture opencode draws that opens with a mode word. That is self-confirming rather than asserted, and it is the argument to recheck when a new opencode release moves a colour. A review also caught a second change riding along in the same diff: the footer pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting `Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so they moved the verdict in exactly the direction this rule exists to prevent. No recorded opencode footer ends at the dot, so the original `+` matches every real capture and the widening is reverted. Verification: - fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12. - fm-doc-audience-check.sh ok across 119 surfaces and 757 local links. - tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh. - The new regression case fails on exactly one assertion when this change is reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got 'pending'", which is the reported symptom. - Confirmed end to end against live panes rather than only fixtures: a real idle opencode 1.19.0 worker classified empty after the change and pending before, and firstmate reached the worker over the steer channel afterwards. * no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim * no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage * no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture * no-mistakes(document): document opencode de-emphasised footer recognition invariant * no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction * no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle * no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md * no-mistakes(document): document leftbar footer override and opencode 1.19 pointer
…7406) Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei --disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt. Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil schon die projekteigene .codex/hooks.json den Dialog aufzieht. Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim naechsten Umbau nicht wieder still ausfaellt. Co-authored-by: ladwein <[email protected]>
…kunchenguid#7096) * fix(bin): store only classified review fields in contribution records A pull observation stored GitHub's raw reviews payload, so a PR with a few hundred reviews wrote a record past the 1 MiB read cap and every pending, verdict and ack read then refused the whole home. Project each stored review to id, state, submitted_at, commit_id and user.login, the only fields the classifier reads, and add a many-review regression. * no-mistakes(document): clarify contribution record read cap in script header
…7216) * fix(pi): retain custom-event handling and processing cancellation * fix(pi): identify custom triggers before legacy prompt narrowing * no-mistakes(test): Correct branch fixture retirement and verify real notification ownership * no-mistakes(document): Clarify Pi event boundaries and verification scope * fix(pi): retain custom-event handling and processing cancellation * fix(pi): identify custom triggers before legacy prompt narrowing * no-mistakes(test): Correct branch fixture retirement and verify real notification ownership * no-mistakes(document): Clarify Pi event boundaries and verification scope * no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context * no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification * no-mistakes(test): Require dual-SDK compiler checks; execution remains pending * no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims * no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers * no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor * fix(test): reconcile queued processing probes after rebase * no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments
…guid#6380) * fix(cursor): verify cursor-agent by running it, not by name Cursor's installer writes its `cursor` IDE shim through the ~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned cursor-agent with a script that only prints "No Cursor IDE installation found" and exits non-zero. That file keeps Cursor's own name and install-tree path, so the name shortcut (and the structural check alone) accepted it and every Cursor spawn launched the broken file instead of the working agent alias. A launch candidate now has to print Cursor's CLI identity under the bounded probe, or carry the structural evidence and run --help successfully. Hosts without a bounded runner keep the structural verdict, as before. * no-mistakes(document): Align cursor launch-verify docs with runtime * no-mistakes: apply CI fixes * test: restore fm-watch-triage ack_stopped_cycle assertion The CI fix round loosened ack_stopped_cycle so a drain that prints no acknowledgement command and exits zero counts as success. That test is unrelated to the Cursor executable verification this branch changes, so restore its original assertion rather than mask a watcher failure here. * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * fix(bin): restore fm-afk-contract clock sampling A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch. That away-mode behavior is unrelated to the Cursor executable verification this branch changes, so restore it here and leave any fix to its own change. * fix(cursor): load the timeout library only when a probe runs Sourcing bin/fm-timeout-lib.sh at load time made every consumer of fm-cursor-lib.sh, including the session-lock and turn-end hook paths that never probe, depend on that file being next to it. Load it lazily from the probe instead. * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * test: restore herdr focus-flash e2e test A CI fix round edited this Herdr end-to-end test, which is unrelated to the Cursor executable verification this branch changes. Restore it here and leave any fix to its own change. --------- Co-authored-by: ladwein <[email protected]>
…#7422) * fix(dod): require a PR reference in CI-ready notes * no-mistakes(review): Recognize Forgejo plural pull request URLs
…ts view (kunchenguid#7434) * feat(herdr): opt-in project groups with status tags and a sorted agents view Add config/herdr-project-groups (absent or off: unchanged behavior). When on, Firstmate tags each Herdr task pane, and its own projected workspace, with display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents view sorted by group then status (needs-captain, problem, running, done), and places a new projected task at the end of its own group inside the parent block with the same single verified move as before. The watcher reconciles tags once per poll and a spawn tags its task at once; bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends suggested sidebar rows with a backup. The agents view helper needs python3. The only test-runner change is the serial weight hint for the new suite. * docs(herdr): record the live lab check of project groups The four hand checks for tags, the sorted agents view, placement at the end of the group, and clear passed against a real Herdr 0.9.5 server (protocol 22) in a guarded lab session. * docs(herdr): align project group verification notes with the live check
…guid#7410) ps -o lstart= renders in the caller's locale, so a lock or claim owner recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity verification under another, was declared dead, and a second worker split the queue: two serve loops reclaimed and reaped each other's live jobs, which vanished mid-claim and failed staged jobs with exit 125 and no output. Pin LC_ALL=C in fm_remote_job_process_start and pin the cross-locale invariant with a regression test. Co-authored-by: researchworldwide2026 <[email protected]>
…unchenguid#7705) A Windows/Git Bash home records its session in state/.lock as a tagged win:<pid>, and fm_session_pid_valid owns whether a lock value is a usable identity. Several readers still decided that with a private numeric test, so a correctly locked Windows home read as malformed: - bin/fm-turnend-guard-cursor.sh (kunchenguid#4535): the owner check, the stale-owner reclaim fallback, and the owner read before parking. The Cursor park now recognizes its own tagged lock and reclaims a dead tagged holder's lock; liveness was already answered by fm_harness_pid_alive. - fm_extension_pair_owns_supervision in bin/fm-wake-lib.sh (kunchenguid#4539): a live tagged session read as dead, which printed the supervision-off banner during a healthy Pi extension hand-off. A win:-shaped value now loads the session-lock library and is answered by fm_session_pid_valid and fm_harness_pid_alive; a POSIX value keeps the existing kill -0 test. - The three .pi/extensions lock readers (kunchenguid#4539): on win32 only, a strict win:<digits> value is compared and probed by its digits, because native Node sees Windows pids directly. pid 1 stays rejected, and the branch extension keeps the tagged value whole for its lease holder. Malformed tags, and any tag off Windows, are still rejected. Regressions cover each reader with a faked Windows process table or platform, so they run on every host.
…7489) * Accept GitHub Enterprise pull request URLs fm_pr_url_parse accepted a GitHub pull request URL only on github.com and hard-set the recorded host, so a task PR on GitHub Enterprise (Cloud *.ghe.com or Enterprise Server) could not be registered, watched for merge, merged, or read back after a merge. A GitHub URL now carries its host like the GitLab, Gerrit, and Forgejo identities already do, with GitHub's owner and repository rules unchanged. github.com needs no configuration and behaves exactly as before. Any other host is accepted only when this home names it in config/github-hosts, because a URL shape cannot tell a real GitHub host from a look-alike such as github.com.evil; only an exact line match authorizes, so comments and malformed lines allow nothing. The parsed host is then carried to every forge call on those paths as GH_HOST, which gh and gh-axi both honor: registration, the static merge poll, the merge command and its pre-merge reads, the merge-outcome read, the teardown read, and the crew-state PR state read. github.com exports nothing and keeps its ambient behavior. Backlog PR links still need the companion tasks-axi change, because that package validates the URL itself. * no-mistakes(review): Fix default-home Enterprise host configuration lookup * no-mistakes(document): Clarify GitHub Enterprise host configuration documentation * no-mistakes(ci): Captain, fixed the CI lint failure with three scoped ShellCheck comment lines in tests/fm-pr-check-security.test.sh. Canonical lint, the complete behavioral suite, and git diff --check pass. Full CI partition rerun remains with the outer executor
…nsitive tests (kunchenguid#7632) test_signal_catchup_without_running_watcher now starts each run's deadline only after the launched watcher holds its singleton lock, through a bounded wait_for_watcher_lock helper that still fails and stops a watcher that never takes its lock. The remaining run (one poll cycle plus the fixed signal grace) gets a finite bound sized from contention measurements; with heartbeat and checks disabled, a watcher that misses the catch-up never exits, so it still fails. test_owner_mutex_contention_preserves_failure_episode_reset now ends its reset-boundary wait on the arm handshake or the hook's own exit, failing at once with the hook's status and output when it dies before the boundary, and keeps a generous finite bound for a hook that stalls. All behavioral assertions are unchanged; no production file changes. Fixes kunchenguid#6678
…unchenguid#7167) * feat(bin): add Cortex Code as a verified crewmate and scout harness Adds the cortex adapter (Snowflake Cortex Code) for crewmate and scout work alongside the existing verified adapters, on the tmux and herdr backends. Herdr reads Cortex's titled composer lazily: it declares cortex=ask and the shared classifier answers need-identity only for a titled rounded glyph box, so panes that never show one make no extra agent get call. * no-mistakes(document): List paseo in Cortex backend-refusal docs * docs(cortex): list rex and t3code among refused backends
…chenguid#7731) * fix(supervision): acknowledge opt-in host hand-backs When the attended supervision host hands responsibility back to the main conversation, at the park boundary or on a main-only pass-through, it left no watcher that outlived a lost continuation, so a home could stay unsupervised with no alarm. With config/supervision-handoff-ack present, a Claude host hand-back now queues a token-bound check and starts a verified, home-scoped successor (bin/fm-supervision-handoff.sh). The successor keeps replacing closed watcher cycles and raises the hand-back again until the main conversation acknowledges it through the sequence-bound wake drain. Automatic retry delivery needs a verified tmux pane; other terminals keep watching and wait for a normal turn. The behavior is off unless the flag exists, so the default hand-back paths are unchanged. * no-mistakes(test): log host rows before the acknowledged hand-back * no-mistakes(document): document acknowledged hand-back flag, state files, retry knob * no-mistakes(ci): Fixed the test race in tests/fm-supervision-host.test.sh (test_acknowledged_handoff_at_the_turn_keeps_the_pass_through_row), the only failure in "Behavior portable serial 1". Invariant: after an acknowledged hand-back at the turn, a live watcher must exist, but the owner replaces the stopped successor arm only within its one-second poll, so a one-shot watcher_live read at the hand-back instant can observe the gap. The sibling lost-continuation cases already wait for the owner's replacement, so this was the one remaining one-shot site on the hand-back path. Change, per the user's instruction: the assertion is now `wait_until 150 watcher_live "$home" || fail "ack turns-main-only: the hand-back left no watcher: $(cat "$home/state/.watch-cycle-exits.log")"`, and the timed-out agent's comment is cut to two lines saying the owner replaces the stopped arm within its poll, with no date. Nothing else changed (diff: 4 insertions, 2 deletions in that one file). Verification: ran the four hand-back tests (lost boundary, lost pass-through, acknowledged at the turn, retry respects receiving pane) via a temporary reduced copy three times, all passed with exit 0 each time; shellcheck -x on the test file passes. A full-file run and an 8-iteration reproduction loop with the original one-shot assertion were started but stopped before completing when the structured result was demanded; the three repro iterations that finished passed locally, so the race was not reproduced on this host (it depends on the owner poll timing CI hit). Temporary copies were removed; the worktree contains only the one modified test file, uncommitted
…guid#7738) * feat(bin): pin a local omp secondmate to its own omp profile Add the opt-in config/secondmate-accounts/<id>/omp-profile file in the primary home. When present, that local secondmate's omp agent launches with --profile <name> and its pre-launch catalog check reads the same profile; the pin is recorded as omp_profile= in the task record and on the spawned line. A malformed file refuses before any endpoint, local copy, or record exists, and a relaunch checks it before stopping the running agent. An absent file leaves every launch unchanged. * no-mistakes(document): Document optional omp --profile flag in omp adapter reference * no-mistakes(review): Reject Windows reserved device names in omp profile pins
…e host's grant (kunchenguid#7265) * fix(wake): pin TZ in the process-table pid identity fm_pid_identity's ps fallback (macOS, or any host without /proc) renders lstart in local time. A supervision engine launched through a wrapper that exports a different TZ than the host's hook environment read the host's branch-grant owner identity as a different process, so its drain discarded the grant as stale and refused. The engine reported but could never acknowledge its granted rows, and the host handed nearly every wake to main. Pin TZ=UTC0 alongside the existing LC_ALL and COLUMNS pins, and pin the same zone in fm-extension.mjs's pidIdentity, which compares identities the bash helper writes. Add a host regression test that runs the engine in another time zone than the host on the process-table path. * no-mistakes(review): Document TZ-pin identity upgrade-window residual * no-mistakes(document): Note TZ pid-identity upgrade residual in turnend-guard doc
…id#7728) Rex's process view reports a block's foreground process and its ancestors only. A login shell that starts the harness through a wrapper in its own process group (a fish function, a bash shim) stays the reported foreground, so a live worker read as dead: steering was refused, relaunch could not confirm the running agent, and the watcher raised stale wakes. Before calling a shell foreground dead, walk its live descendants through the shared agent classifier, and trust OSC 7501 records from a harness found there under the same rule.
…unchenguid#7536) * feat(backends): add experimental tern runtime backend * docs(backends): document tern setup and verification limits * no-mistakes(review): Refuse tern kill when task tab was renamed * no-mistakes(test): Treat tern shell --rcfile/--init-file values as option arguments * no-mistakes(document): Document tern endpoint-close refusal for renamed task tabs * fix(tern): project safe fields before reading Carly answers * fix(backends): make tern explicit-only Tern is selected only by `--backend tern`, `FM_BACKEND=tern`, or `config/backend`; runtime auto-detection no longer routes a spawn into it. TERM_PROGRAM=tern and TERN_PANE reach every descendant process of a Tern block, including a tmux server or Herdr client started inside it, so an inherited marker never proves the captain chose Tern. - bin/fm-backend.sh: drop the tern arm from fm_backend_detect and the auto-detected tern NOTICE from fm_backend_name, which became unreachable with the arm. - Replace the tern detect-precedence and auto-detect-notice tests with test_backend_tern_is_never_autodetected, mirroring the Paseo case, and drop the Tern-marker unsets that only guarded detection hermeticity. - docs/tern-backend.md: replace "Runtime detection" with "Selection is explicit"; fm-spawn.sh and adapter headers, architecture, configuration, README, and the operational-home-layout skill now list tern beside zellij, orca, and Paseo as never auto-detected. * no-mistakes(review): Read tern surface capture JSON text; fix TERM_PROGRAM doc * no-mistakes(review): Narrow tern Carly projection; name rex as supervisor backend * no-mistakes(review): Name tern in Command Code backend refusal comment
…nguid#7729) A fleet pane already carries GIT_CONFIG core.hooksPath, and the suite's cases set the Git config they assert on themselves, so unset GIT_CONFIG_COUNT, GIT_CONFIG_KEY_0, GIT_CONFIG_VALUE_0 and GIT_CONFIG_PARAMETERS at the top as the sibling suites do.
… wait (kunchenguid#7740) * fix(bin): stop a watcher promptly when a stop lands in its event wait On bash 3.2 a TERM is held until a running command substitution's child exits. The watcher's push-backend event wait ran as rec=$(...) and blocks for up to POLL, so a supervision-host take-over that landed there could not confirm the stop within its 5s bound. The unconfirmed take-over skipped restoring main's acknowledgement, the stopped watcher's close minted a fresh downtime generation, and the next watcher announced it as check: rearm-resurface with nothing queued, repeating every ~30s. Run the event wait through the same waited background process group the pane reads already use (watcher_capture, generalized to watcher_waited). The helper's own setup failures now return 2, which the event wait reads as an unusable event path rather than a full-budget wait. Because a stop now kills the wait before its own cleanup, the wait gets a watcher-owned scratch TMPDIR that the watcher removes after each wait and on exit, and the cleanup's group stop is silenced so bash's job-termination notice does not reach the arm's output. Add a fm-watch-arm regression case that takes over a watcher inside its herdr event wait and asserts a confirmed take-over, an unchanged acknowledged marker, a quiet fresh cycle, and no leftover wait scratch. Make the event-wait unit case assert the capability flag outside the wait, since the wait now runs in its own process. * no-mistakes(test): Raise event-wait take-over regression POLL so it fails on base * no-mistakes(document): Document event-wait stop handling in watcher continuity --------- Co-authored-by: vatsa <[email protected]>
…ee (kunchenguid#7752) The EXIT trap removed the fixture root with a plain rm -rf. When the run stops early, for example when the watcher auto-relaunch leg fails, the fixture still holds the read-only state/<id>.git-hooks strip folder, so cleanup prints "Permission denied" for each hook, leaves the fixture root behind and exits non-zero. Use the shared fm_test_remove_tree, which makes read-only fixture directories writable before it removes them. Refs kunchenguid#7629
* feat(bin): add allowlisted live record sync * feat(bin): archive teardown records by generation * feat(bin): export task records before teardown * docs: define the private record export contract * fix(bin): satisfy ShellCheck in the record exporter and its test * fix(bin): publish record exports as safe snapshots * fix(bin): make record archives transactional * fix(bin): fail closed on record export teardown * fix(bin): harden record export transactions * fix(bin): prevent record export staging wedges * no-mistakes(review): Archive task records before irreversible teardown cleanup * no-mistakes(review): Archive records after endpoint quiescence * no-mistakes(document): Consolidate record export architecture documentation * no-mistakes(ci): [Certain] Fixed both CI issues: quoted the remote-home test fixture assignment to clear ShellCheck, and added the missing `spawn_gen` to the export-enabled remote retirement fixture so the expected lost-slot exit code is preserved. ShellCheck, `git diff --check`, and the focused remote-home export test passed. The full lifecycle E2E was blocked locally by an earlier fixture failure (`remote spawn never reached its blocked inheritance write`); CI’s log identified the later failure this fixture correction addresses * no-mistakes(ci): [Certain] Fixed the fixture to replace any existing `spawn_gen` field before setting `remote-retirement-test`, preserving the exporter’s exactly-one-generation invariant. `git diff --check` passed. The full remote lifecycle test could not reach this scenario: it failed earlier at “remote spawn never reached its blocked inheritance write,” and cleanup reported permission errors on generated git-hook files * no-mistakes(ci): [Certain] Fixed the fixture race in `tests/fm-remote-secondmate-lifecycle-e2e.test.sh`: it now pins `spawn_gen` after the blocked respawn finishes publishing metadata, so the exporter receives exactly one generation key. `bash -n` and `git diff --check` passed. The full E2E remains blocked by an earlier failure to reach the blocked inheritance write, followed by cleanup permission errors; it did not reach the corrected assertion, captain * no-mistakes(ci): [Certain] Fixed `teardown_export_records` to return before config-directory safety checks when `record-export-root` is absent, and added a regression test for an unopted home with symlinked `config/`. The regression passed. The full teardown suite stopped in its existing inaccessible-config case: this environment runs as root, which can read the chmod-000 directory, so that case cannot reproduce its expected refusal here. `bash -n` and `git diff --check` passed; `fm-lint.sh` was blocked because `actionlint` is unavailable. The CI log shows steady test progress followed by GitHub cancelling the job and cleaning up orphan processes, with no reported test failure; treat it as provider cancellation and let the fresh push rerun it * no-mistakes(ci): [Certain] Updated the teardown test fixtures: a regular file at the export-root path now deterministically causes export failure, and a symlinked config directory tests the opted-in safety refusal across users, including root. The unopted symlinked-config regression remains intact. The relevant teardown cases passed; `bash -n` and `git diff --check` passed. The full suite later failed an unrelated leaked-process-reap case. Serial 1 was cancelled without a verdict and, per the provided instruction, needs no code change
…is warm (kunchenguid#7807) * feat(bin): add opt-in warm-cache compaction for the Claude primary and host engine Refs kunchenguid#7755 * no-mistakes(review): Persist engine compaction marker, run it abortable, match resume predicate * no-mistakes(review): Run engine compaction in host shell; skip marker on abandon * no-mistakes(review): Test abandoned engine compaction is not marked done * no-mistakes(document): Clarify warm-compact episode and engine resume rules * no-mistakes(lint): Fix ShellCheck SC2015 in engine compaction marker * no-mistakes(ci): Test coverage guard and portable parallel 2 failed because the two new warm-compact tests had no timing hint. The runner packed them at the 45000 ms default, pushing the largest serial shard to 1204066 ms, over the 1200000 ms limit. I added measured hints in bin/fm-test-run.sh (fm-warm-compact.test.sh 1500, fm-warm-compact-herdr-live-e2e.test.sh 170). `bin/fm-test-run.sh --check-coverage` now passes (largest serial shard 1194253 ms), and tests/fm-supervision-instructions.test.sh passes. A full run of tests/fm-test-run.test.sh was killed at its time limit and did not finish, so it is unverified. The serial-shard failures in the logs were watcher/timing tests unrelated to warm-compact. I did not reproduce them locally. main also has a failing run. They need a rerun, not a code change
…7810) * refuse remote Rex servers during spawn * no-mistakes(document): Clarify Rex locality requirements and remote-worker guidance
* fix(bin): read a Windows win:<pid> session lock in the supervision host and Claude auto-arm On Git Bash the session lock records its holder as a tagged win:<pid> (kunchenguid#6300), but four readers still passed that value to the numeric-only fm_pid_identity and fm_pid_alive: fm_supervision_host_main_key produced no key, fm_autoarm_claim_next pinned no lock-holder identity and dropped owner_session_id, fm_autoarm_claim_open rejected the non-numeric lock so a live claim never read as open, and fm_autoarm_midturn_healthy read a live holder as lapsed. Add fm_session_pid_alive and fm_session_pid_identity beside the tagged-pid contract in fm-session-lock-lib.sh. A tagged pid is answered from the Windows process table; every other value falls straight through to the existing numeric helpers, so POSIX behaviour is unchanged. The claim read-back checks the lock shape with fm_session_pid_valid. tests/fm-session-lock-windows-consumers.test.sh covers each reader on a faked Git Bash host, including an exited holder, a reissued Windows pid, and the tag off Windows, plus a parity case proving untagged values get exactly the numeric helpers' answers. Fixes kunchenguid#7739 * no-mistakes(document): Document tagged Windows session-lock consumers * no-mistakes(ci): Fixed tests/fm-afk-return.test.sh partial host fixtures to copy fm-session-lock-lib.sh alongside fm-supervision-engine-lib.sh in all three affected paths. The focused host/latch tests and tests/fm-session-lock-windows-consumers.test.sh pass; the full afk-return suite exceeded the 180s local timeout after earlier cases passed
Brings 125 upstream commits into the fork's 227 without rebasing either side. Where both sides changed one contract the fork's wording and behaviour stay and upstream's new facts are ported into it: the fork's stale-reason owner now carries upstream's backend detail, transition note and blocked-on-prompt dialog name; the fork's deliberate-wait deferral sits beside upstream's backlog-hold, worker-wait and validating deferrals; the fork's complete-inventory run selection stays first and upstream's explicit no-run verdict stands in only when the inventory cannot decide; the fork's away-branch relaunch limit is kept over upstream's blanket relaunch exemption; the fork's configurable worktree wait is carried into upstream's restructured treehouse block; and the fork's test-environment isolation owner absorbs upstream's Rex identity unset. The union of both sides' serial suites overflows the largest portable serial shard (1264521 ms against the 1200000 ms target), so the serial remainder now splits across ten shards.
Upstream's new watcher tests pinned the stale wake reason without the fork's task=<id> token, which the fork's stale_reason owner always adds for a mapped window. The observation-boundaries fake tmux now lists recorded windows, since upstream's exact tmux endpoint membership reads the session inventory. The worktree-settle wait test clears the fake tmux window it left behind before reusing its task id, now that upstream's fake tmux remembers opened windows.
Upstream's handling successors now re-announce a recoverable downtime episode with check: rearm-resurface while rows stay queued. When a new captain note lands after the cycle's note check, that close is what wakes main, and the note stays queued for the drain either way. The fork's successor test keeps its guarantees (one wake, no ack, no repeat of the old note, queue rows intact) and now accepts either delivery.
Brings in the browser-session teardown fix (#53). bin/fm-teardown.sh conflicted only where both sides added code after the library sources: the browser-sessions source line and the status-archive and record-export helpers are both kept.
…te absent override
…e successor contract
…nned test edits, and nothing under bin/ or .pi/ changed. I checked the diff against the plan and the production sources; there were no stray changes to revert. - fm-backend-t3code: the expected wake text now includes `task=t3push1`. - fm-supervision-host: the awk pattern now matches `stale: firstmate:fm-demo task=demo$`. - fm-pi-branch-extension: the fixture gets a home at CASE_ROOT/home with an empty data/ directory, and the CLI spawnSync passes FM_HOME pointing at it. - fm-pr-check-security: the expected usage line now matches bin/fm-pr-merge.sh line 179, including `[--allow-no-pipeline]`. - fm-fleet-snapshot-contribution-input: the fake jq now matches `{backlog:.[0],tasks:.[1]}`. The expected error text is now "contribution projection failed", which is what bin/fm-fleet-snapshot.sh line 2197 prints, so this edit is needed too. The helper comment is still accurate. - fm-backend-paseo: creates "$dir/home/data" and passes FM_HOME on the dispatcher call. - fm-turnend-guard: also copies fm-request-continuity.ts and fm-native-contract.ts into the fake root. This was done in both Pi guard tests that build that root (the nested-session test and the sibling Windows-lock test); the guard imports fm-request-continuity.ts, which imports fm-native-contract.ts. As instructed, no tests were run; CI on the pushed commit is the verification
….sh. The assertion at line 1560 now uses the pattern '^firstmate watcher wake: check: captain inbox notes: inbox:'. The old pattern started with '^check: ...', so it could never match: bin/fm-claude-stop-autoarm.sh prints the rewake as a single line that begins with "firstmate watcher wake: ". The CI log shows that line, and assert_rewoke_main already expects that prefix. The pattern still requires the queued note's own inbox headline right after the prefix, so the test checks the same thing as before. Nothing else changed: production code under bin/ and .pi/ is untouched. As you asked, I didn't run any tests, so the CI run on the pushed commit is the check
…b limit twice (30m16s, then 30m19s). That is a distribution problem, not a code defect, so as approved I split canonical lint into three CI partitions instead of two. No timeout-minutes value was changed. Changes: (1) .github/workflows/ci.yml: the lint matrix is now `partition: [1, 2, 3]`. The step already passes "<partition>of<job-total>", so nothing else in the workflow changed. (2) bin/fm-lint.sh: it now accepts only 1of3, 2of3 and 3of3. Anything else exits 2, including 1of2 and 2of2. I updated both error messages, the header comment and the usage line. The byte-weight packing awk now takes the total from the number after "of" and assigns each root to the lowest-numbered, least-loaded bin among 1..total, in the same order as before (weight descending, then index ascending), so the split stays deterministic, complete and disjoint. (3) tests/fm-lint.test.sh test_canonical_partitions_preserve_full_lint: it iterates over 1of3, 2of3 and 3of3. The refused options are now 0of3, 4of3, 1of2 and 2of2, the --fast and explicit-subset refusal checks use 1of3, and the pass message is "three canonical lint partitions ...". (4) docs/fm-test-portable-shards.md: "owns three canonical CI partitions". I left tests/fm-ci-workflow.test.sh unchanged, as instructed. Checks I ran: each partition's --list-files output is non-empty and the same on a second call (187, 187 and 188 roots, each about 6.78 MB, so the bytes are balanced). The union of the three has no duplicates and exactly equals `CI=true bin/fm-lint.sh --list-files | sort`. --partition 1of2, 2of2, 0of3 and 4of3 each exit 2, and so does 1of3 with --fast. `bash -n bin/fm-lint.sh tests/fm-lint.test.sh` passes. As instructed, I did not run the full lint, the full test scripts or shellcheck, so CI on the pushed commit is the real check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
The captain's ask, 2026-10-27: "update everything that relates to firstmate and relaunch everything afterwards", then "all recommendations" to firstmate's reading, whose first item was: the fork (origin, speechybubble/firstmate) is 125 commits behind Kun's upstream (remote
kun, github.com/kunchenguid/firstmate, branch main) and 227 commits ahead with the captain's own work, so bringing Kun's changes in is a real merge with likely conflicts, shipped through the normal pipeline as a PR the captain sees.Boundaries: every safety boundary in AGENTS.md survives the merge; the fork's own behaviour wins where upstream rewrote the same contract unless upstream's version is a strict superset; nothing under data/, state/, config/ or projects/ is touched.
What Changed
kunchenguid/firstmatemain into the fork without rebasing either side. New capabilities: experimental Rex, Paseo, T3 Code and tern session backends; Command Code, Cortex Code and Polytoken worker adapters; OpenCode 2 plugin support;fm-capacity.sh,fm-pr-health.sh,fm-review-check.sh,fm-usage-warner.sh,fm-approval-failover.sh,fm-git-push-guard.sh, allowlisted record export, herdr project groups, aforge=externalreview rail, and warm-cache compaction for idle supervision-host sessions. Many of these sit behind opt-in flags, as do the new wedge-escalation caps and deferrals. The merge also brings upstream fixes for Windows session locks, watcher take-overs, crew-state and the composer/idle detectors, along with matching docs, skills and tests.origin/main(the browser-session teardown fix) into the branch. Merged upstream tests are adjusted to the fork's contracts, such as thetask=<id>stale-reason token and fake tmux window listing. A crew-state test covers the narrowed status-absent override. The CI serial remainder now splits across ten portable shards because the combined serial suites overflow the per-shard budget.Risk Assessment
Testing
I drove the merged watcher, inbox, spawn and gate-refuse entrypoints live against a disposable marked lab home. Handling successors surfaced each new captain note exactly once. They did not emit rearm-resurface, even with a downtime marker pending. The non-successor watcher still re-announced after downtime. Gate refusal blocked lifecycle calls against an unmarked home. A real Claude primary booted on the merged tree and ran firstmate scripts inside the lab. The targeted regression tests for the decided fork contracts passed: the successor note tests, the append-successor variants, and the crew-state unknown-with-run-ids test. These ran against fixtures, not the live product, so their scenarios are recorded as untested live. The diff showed no changes under the protected directories. The lab, its tmux server and the temporary test copies were all removed. There is no UI surface, so I captured CLI transcripts instead of screenshots.
check: captain inbox notes: inbox:1793200026-x4983H; note file still present)check: rearm-resurface)error: refusing fleet lifecycle from inside a no-mistakes gate worktreerc=3; lab:fm-gate-refuse: gate agent lifecycle permitted only against lab homeEvidence: Live watcher/inbox transcript in the lab home (successor and non-successor cycles)
Source: Live watcher/inbox transcript in the lab home (successor and non-successor cycles)
Evidence: Successor regression tests (fm-watch-triage, fm-watch-arm)
Source: Successor regression tests (fm-watch-triage, fm-watch-arm)
Evidence: Crew-state regression test output
Source: Crew-state regression test output
Evidence: Lab Claude primary pane after running firstmate inbox script
Source: Lab Claude primary pane after running firstmate inbox script
Evidence: Successor ignores pending downtime marker; main watcher re-announces
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
check: captain inbox notes: inbox:1793200026-x4983H; note file still present)check: rearm-resurface)error: refusing fleet lifecycle from inside a no-mistakes gate worktreerc=3; lab:fm-gate-refuse: gate agent lifecycle permitted only against lab homebin/fm-lab-home.sh create /tmp/fm-lab.5MU3oZ(disposable marked lab home)FM_HOME=$LAB FM_WATCH_HANDLING_SUCCESSOR=1 bin/fm-watch.sh, thenbin/fm-inbox.sh note 'First captain note': successor exits withcheck: captain inbox notes: inbox:<first>fm_recovery_marker_publish $LAB/state/.watcher-down downtime, then a handling successor ran for 6s with a queued row already surfaced: it stayed in its poll loop and never emittedcheck: rearm-resurfaceNon-successorbin/fm-watch.shon the same home with the downtime marker: emittedcheck: rearm-resurface(upstream behaviour kept)Handling successor plusbin/fm-inbox.sh note 'Second captain note': emitted onlyinbox:<second>, and the queue kept exactly 2 rowsbin/fm-spawn.sh demo-taskwith an unmarked FM_HOME inside the gate worktree: refused rc=3. With the lab home: lifecycle permitted, then the --mode requirement rejected ittests/fm-crew-state.test.sh::test_no_run_answer_keeps_unknown_naming_branch_runs(my filtered runner also ran the rest of that file, and all of it passed)tests/fm-watch-triage.test.sh::test_captain_inbox_successors,test_captain_inbox_claimed_and_handledtests/fm-watch-arm.test.sh::test_append_wakes_handling_successorwith after-ack, before-ack missing, after-ack missing identical, after-ack malformed identicalLab Claude primary started withtmux -L fm-lab new-session ... -e FM_HOME=$LAB claude, then asked to runbin/fm-inbox.sh note 'lab primary relaunch check': note landed in the lab inbox and wake-queue; lab torn down withtmux -L fm-lab kill-serverandrm -rf $LABgit diff --name-only 993041cf a185c87d | grep -E '^(data|state|config|projects)/'(empty)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.