Repository navigation
Merge with 'Create a merge commit' - do NOT squash or rebase: restore upstream 78c69df2 ancestry - #54
Merged
Merged
Conversation
…(#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 (#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 <[email protected]>
* fix(bin): honour the no-run verdict from axi status in crew-state * no-mistakes(review): Honor authoritative no-run verdict across fallbacks * no-mistakes(lint): Quote no-run sentinel to satisfy ShellCheck * no-mistakes(document): document authoritative no-run verdict in crew-state attribution
* fix(composer): accept Grok 1.0.44 approval-titled bottom border as empty composer * no-mistakes(document): Document Grok’s aligned approval title * no-mistakes(ci): Captain, removed the unused test variable that failed Lint 1. ShellCheck, the composer suite, and the remote provisioning test pass locally. Behavior portable serial 9 failed during fixture cloning in an unchanged test, before composer behavior was exercised; no further code change is warranted for that failure * no-mistakes(review): drop dead approval guard, make Grok fixtures locale-independent widths * fix(bin): stop shellcheck re-expanding fm-wake-lib in teardown Lint 1 dies when ShellCheck expands bin/fm-wake-lib.sh twice from bin/fm-teardown.sh. The top-level source already names that file. Point the second directive at /dev/null and leave the runtime source unchanged. * docs: record Grok 1.0.44's approval-titled composer border The verification record scoped its titled-bottom-border note to the Grok 1.0.5 three-column overhang but never recorded the newer shape this branch accepts, so a maintainer could not tell the two cases apart or know what a Grok upgrade re-verifies. Add a dated record of the 1.0.44 shape - the typed model/effort title plus its ` · always-approve` suffix, drawn inside a rounded bottom border at the aligned width - with the live verdicts that prove it, the portable test that owns it, and the fail-safe verdict every neighbouring title keeps. * no-mistakes(review): Narrow Grok composer coverage claims to verified matrix * no-mistakes(document): Correct stale Grok verification notes * docs: trigger CI re-run for flaky shard 4 Behavior portable serial 4 failed on the previous head with one assertion only, `not ok - the NUL-bearing line was not captured`, in the unchanged remote-reply and relay path; its fixture hardcodes /bin/sleep, direct NUL ingestion passes, and the other 19 checks were green. GitHub refused a job re-run for this fork PR, so this empty commit is the re-trigger. No content change. * no-mistakes(document): Clarify Grok live guard verification scope * fix(composer): restrict Grok approval titles to rounded borders Reject light, heavy, double, and ASCII approval-title boxes at the shared classifier boundary. Only the rounded family has recorded live evidence, and an empty verdict grants permission to type into the pane. Cover denied families through tmux and cursorless backend profiles while preserving rounded idle, draft, malformed-title, and legacy behavior. * no-mistakes(document): Refresh Grok composer verification evidence * no-mistakes(ci): Fixed the stale local link in `docs/verification/runtime-backends.md`; the section heading’s anchor had changed. `tests/fm-documentation-audiences.test.sh` passes
* fix(omp): point non-checkout homes at fm <project> relaunch and name why the extension is not loaded * no-mistakes(review): Remove unset-FM_HOME omp watch cause line
…cap (#7552) * feat(fm-watch): bound consecutive wedge escalations per worker window An unattended watcher escalation loop once burned ~359M tokens in a day: the watcher keeps re-escalating a pane it believes is wedged, and nothing bounded how many times it did that for one worker window. Add an opt-in ceiling on consecutive wedge escalations for a single window. At FM_WEDGE_MAX_ESCALATIONS the watcher publishes one terminal PERMANENTLY-WEDGED wake and writes both cap markers, after which the wedge path short-circuits for that window until FM_CAP_HORIZON_SECS elapses or an operator removes both markers. A pane hash change alone does not re-engage while the window-scoped marker stands, so a pane that re-renders on every poll cannot rebuild the counter and re-fire every bound. A failed marker write rolls the cap state back rather than amplifying one write failure into a wake-queue flood, and a rollback that itself fails leaves a transient sentinel that holds the wedge path quiet for FM_ROLLBACK_SENTINEL_TTL_SECS. FM_WEDGE_MAX_ESCALATIONS defaults to 0, so the unconfigured path keeps today's behavior exactly. Each setting is validated the way the rest of the file validates its environment settings and falls back to its default on a non-numeric value; a zero horizon or sentinel TTL falls back too rather than degrading into a re-fire loop. Tests drive the watcher as a real process through its public environment surface, and a separate opt-in live guard exercises a real tmux pane holding a wedged process in a disposable lab home built by bin/fm-lab-home.sh, covering both halves of the contract: the cap engaging, and the cap releasing itself on the horizon with no operator action. * no-mistakes(review): fix(fm-watch): bound the wedge cap honestly * test(fm-watch): make the wedge-cap live guard a falsifiable comparison The live guard demonstrated the ceiling but could not falsify it, and it advertised evidence that did not survive its own run. Register both new suites in bin/fm-test-run.sh. Unregistered they fell into the unclassified catch-all, which put the live guard outside the repo-wide live-gate sweep at tests/fm-live-gate.test.sh - the sweep that proves every live guard refuses together on FM_LIVE=0. The wedge-cap suite joins watcher-wake-lock and the live guard joins live-harness-optin; the serial lane passes no live-capability --fail-on-gate-skip token, so CI gating is unchanged. Run the unceiled baseline and the ceiled arm back to back on the same workload, one differing setting, in one transcript. The baseline at the shipped default of 0 shows the train of five consecutive wakes the cap exists to bound; the ceiled arm at 3 shows one terminal PERMANENTLY-WEDGED wake and then silence. State plainly in the transcript that the motivating incident happened at the default, so it motivates the ceiling and is not itself evidence the ceiling engaged. Correct the post-horizon assertion. It required the terminal marker on the very first cycle after the horizon, which the reset escalation counter makes false: the first post-horizon wake is an ordinary escalation and the bound is reached one cycle later. Assert the lane is audible, not which marker it carries. Reprint the transcript to stdout before cleanup, so the run ends in one self-contained evidence block instead of a pointer to the temp file this script is about to delete. Source tests/wake-helpers.sh for hash_text, and define PANE_TEXT in this script's own scope, so no unbound-variable or command-not-found line can appear inside the evidence a reviewer reads. Document in docs/configuration.md what the cap covers and does not: it bounds the wedge timer where a busy pane crosses FM_BUSY_TURN_MAX_SECS, it does not cover the non-terminal first-sight stale surface, only a pane leaving the stale path clears the markers, and a cap fire resets the consecutive-deferral budget of a wedge-evidence guard because that guard is not consulted while the cap is silencing the window. * no-mistakes(review): fix(fm-watch): release wedge cap markers on every episode-ending reset * no-mistakes(review): derive the live guard's window key the way the watcher does * no-mistakes(review): fix(fm-watch): probe dead endpoints under the wedge cap, scope terminal rows per episode * no-mistakes(review): fix(fm-watch): cap the dead-endpoint probe, real degraded fallback * fix(fm-watch): release the wedge cap through one episode-ending choke point The cap's release invariant - every reset that ends a wedge episode drops the cap markers with it - was wired at two inline sites and two more were missed. One of the misses is surface_nonterminal_stale, the hot path that ends the episode marker on every non-terminal stale poll, so the cap's episode tracking was broken in the common case rather than the rare one and a genuine new wedge after a pause-and-resume stayed silent for the full horizon. Enumeration had already failed once, so wiring the two missing sites would look finished and be incomplete again. Make the invariant structural instead: one choke point, wedge_episode_end, now performs every removal of the .stale-since-<key> episode marker and clears the cap markers with it, and a new assertion in the test fails on any direct rm of that marker outside it. keep-counter=1 marks a route that only restarts the escalation count while the wedge timer keeps aging. That is the same episode, not a new one, so the cap markers are deliberately not cleared there; an existing triage test pins that behaviour and it is unchanged. Both proofs are falsification-tested. The completeness assertion and the behavioural case each fail against the pre-fix watcher, and the behavioural case additionally fails when only the surface_nonterminal_stale wiring is reverted while the choke point still exists, so it pins the hot path specifically rather than passing because some other route happened to release the markers. The cap stays window-scoped with no per-hash marker, still defaults to off, and still releases on the horizon. The episode-scoped terminal row stays one per episode under the append lock, the documented first-sight containment stays, and the dead-endpoint-before-silencing work is untouched. * no-mistakes(review): fix(wm-watch): release wedge cap on every episode-end route * no-mistakes(review): fix(fm-watch): gate cap markers, probe under sentinel, release churn * no-mistakes(review): fix(fm-watch): release wedge cap on the away first sight * no-mistakes(review): fail safe the wedge escalation-count write under a configured cap * no-mistakes(test): fix wedge-cap live guard leaking its temp root * no-mistakes(review): fix(fm-watch): keep the wedge ladder reachable under a fired cap * no-mistakes(review): fix(fm-watch): pace the sentinel dead-record probe by threshold * no-mistakes(test): fix(test): give the wedge-cap suite its serial-lane weight hint so its CI shard fits the 30-minute job cap * no-mistakes(document): align wedge-cap docs with implemented release boundary * fix(docs): correct the cap markers' lifetimes in the layout reference The state/ listing claimed .wedge-permanent-<key> "only sits on disk until a later cap fire overwrites it". That is false: bin/fm-watch.sh:1214-1219 _wedge_cap_markers_clear removes .wedge-permanent-<key>, .wedge-terminal-queued-<key> and .wedge-rollback-failed-<key> outright, and it runs on every cap release, so a release takes the marker off disk rather than leaving it for a later cap fire to overwrite. The same clause also left the other two markers' lifetimes and delete semantics unstated. Each now carries its own lifetime, and the sentence records that a cap release drops all three while only the two silencing markers re-engage a window when deleted by hand. Verified against bin/fm-watch.sh: FM_CAP_HORIZON_SECS bounds the cap marker via _wedge_cap_marker_stands, FM_ROLLBACK_SENTINEL_TTL_SECS bounds the rollback-failure sentinel, and the terminal-row marker records the episode that queued the row and is dropped with the rest of the cap state. * no-mistakes(document): state the watcher's cap release boundary in its header comment * fix(fm-watch): make the wedge escalation-counter reset opt-in The upstream maintainer reviewed the wedge-cap pull request, accepted the live validation, and asked for the escalation-counter reset to become opt-in: it should only kick in when the cap is configured, so a home that has not set anything keeps today's behaviour and still gets the deep-inspection prompt for a stuck pane. The choke point wedge_episode_end gained a third state. The call sites whose pre-cap shape kept the escalation counter - the first-sight stale surfaces, where upstream dropped the wedge timer and left the count standing - now pass keep-count, so the counter survives them exactly as upstream's did while the cap is unconfigured. With a configured cap the count still restarts with the released episode, which is what lets a re-wedged window escalate from 1 again past a released marker. The other episode-ending routes are unchanged: the pre-cap watcher reset the count there too, so those keep resetting it in both postures. The new parity suite proves the property rather than asserting it: it drives one stuck-pane scenario against upstream main's own bin/ tree and against this branch, and requires the same observable outcome for the unconfigured case - the same ladder, the same demand-deep-inspection prompt, no cap marker. A configured cap in the same harness fires PERMANENTLY-WEDGED at its threshold, which is what shows the setting really reaches the watcher, so the unconfigured cases cannot pass vacuously. * no-mistakes(review): fix(fm-watch): bound the wedge cap settings to a comparable range The review step's fix agent produced this change but its own turn hit the 30-minute invocation budget, so the gate failed the step with the work uncommitted. The work is preserved in the gate's recovery ref and in the task's saved round patch; this commit carries it forward unchanged. bash's test cannot compare a decimal integer outside its own range: the comparison ERRORS rather than evaluating false, and every later comparison of such a value therefore reads as false. A value such as 99999999999999999999 passed the digit check unchanged, so the cap never engaged - the unbounded escalation train the feature exists to bound - and the \"is it zero\" test errored false as well, so the keep-count sites reset the escalation counter on a home that had configured nothing, which is the behaviour the maintainer's request forbids. The same hole let an unusable horizon make the cap marker expire at once and an unusable sentinel TTL drop the sentinel on the next poll, putting the failed-write route back on every poll. The fix bounds the accepted range at the ONE normalization choke point, where each value is read, rather than hardening every comparison site: a value bash cannot compare never reaches a comparison, because an arithmetic error is read as false at every site, which is the opposite of what each of those tests means. Values are accepted below 10^18, which always fits bash's 64-bit signed arithmetic, and the empty, non-digit, zero and negative handling keeps its documented fallbacks: 0 for the cap, 86400 for the horizon, 3600 for the sentinel. Regression cases cover a value beyond bash's integer range for each of the three settings, and the parity suite proves the unconfigured home is still observably identical to upstream main. * no-mistakes(document): docs: correct wedge-cap ranges, release routes, reset contract * no-mistakes(ci): fix the wedge-cap lint finding and pack the lane on CI measurements Upstream CI on the rework head went red on two checks, both ours. "Lint 1" failed on the new parity suite: two `return 1` statements behind `fail` were unreachable, and behind them was a real bug. `fail` lives in tests/lib.sh and exits, so inside the command substitution that reads the baseline it ended only the SUBSHELL - the outer script continued with an EMPTY baseline and reported a divergence with an empty trace instead of failing. The test's own header says it is the proof and a silent skip would be no proof at all, so the baseline now reports the specific reason and returns non-zero, and the caller's guard aborts the whole test. A baseline that cannot be materialised aborts the test rather than continuing. "Behavior portable parallel 2" failed the packing-boundary check: the wedge-cap suites were packed on provisional LOCAL measurements that overstated their CI cost, which left the serial lane without the headroom the boundary check needs to place one script exactly at the budget. The same CI run measured them for real - 374225 ms for the wedge-cap suite, 27763 ms for the parity suite, 74 ms for the live-guard skip - and those Ubuntu measurements replace the local ones in bin/fm-test-run.sh. * no-mistakes(document): docs: fix wedge-cap measurement attribution, document cap-off release
…lag (#7407) * feat: archive retired task status history behind an opt-in flag * fix(bin): recognize an already-retired remote home before it is recreated Sourcing fm-wake-lib.sh through the control script's libraries creates "$FM_HOME/state", so retiring a remote home that was already removed fabricated an unseeded directory before validate_home ran. The already-retired branch was unreachable, and that retirement and every retry refused with "remote home is not a seeded secondmate home". Check for the absent home before loading any library, accepting exactly the retire dispatcher's arguments so an invalid option still fails with usage, and drop the allow-absent branch that could no longer be reached. * no-mistakes(review): Removed configurable status archive retention override * no-mistakes(review): Remove published archives after failed status retirement
…y age (#7364) * fix(bin): raise unanswered review threads again after acknowledgement Acknowledging a maintainer signal removed the only record of the thread, so a comment nobody answered was never raised again, including while its task sat on a hold. Poll now tracks each unanswered maintainer comment, review and inline review comment on an open pull request until the contribution author replies in it or it is resolved, and raises it again once it is a day old (FM_CONTRIBUTIONS_REPLY_AGE) and daily after that. The wake names the comment URL and its age. * no-mistakes(review): Track only inline and changes-requested threads, bound notified * no-mistakes(review): Let reviewer verdicts answer reviews, skip empty-body change requests * no-mistakes(ci): Fixed "Behavior portable serial 6" with a test-only change. The serial 4 failure is a timing flake that this change did not cause. Serial 6 (tests/fm-pr-check-security.test.sh, "retired poll left task-a.check.sh"): this PR adds one more forge read to the contribution observer, a paginated `gh api graphql` query for reviewThreads. The test's fake `gh` answered every `api graphql` call with merge-state key=value lines. The observer rejected that output and raised the wake "contributions: observation unavailable ... review thread pages returned an unexpected shape". That wake ended the watcher cycle before the merged task-a poll retired. Invariant: the fake forge must answer every read the contribution observer makes, in that read's real shape. The other contribution reads (comments, reviews, inline comments, checks, statuses, repo) were already faked. The new reviewThreads query was the only read missing. Fix: tests/fm-pr-check-security.test.sh now answers any `api graphql` call containing reviewThreads with one empty reviewThreads page. The merge-state graphql answer is unchanged. Verified: I reproduced the failure locally before the fix. The test also passes on base fc8972c with that commit's bin/. After the fix, `bash tests/fm-pr-check-security.test.sh` exits 0 with all 47 cases ok. The only other test whose fake `gh` handles `api graphql` and runs the contribution path is tests/fm-pr-merge.test.sh. It prints no "unexpected shape" text. It fails locally with "github-zero-exit-queue-required: refusal did not name the concrete observed state", and it fails the same way on base fc8972c. So that failure predates this change, and it is not among the failing CI checks. Serial 4 (tests/fm-remote-reply.test.sh, "the NUL-bearing line was not captured"): this is a 40-second wait (800 polls of 0.05 seconds) for a procevent result in the remote-reply stream, and it timed out on CI. The test does not use fm-contributions or any file this PR changes. It passed locally twice (42 ok, exit 0), so this is CI load flakiness outside this change. I made no code change for it * fix(bin): make unanswered review re-raise opt-in The re-raise wake and the reviewThreads read now run only when FM_CONTRIBUTIONS_REPLY_AGE is set to a positive number of seconds. An unconfigured install polls exactly as before: no review-thread read, no threads[] entry and no unanswered signal. arm copies a set value into the generated check so the watcher honors it. * fix(bin): refuse a zero-padded zero reply age FM_CONTRIBUTIONS_REPLY_AGE=00 and 000 passed validation as positive ages. They now fail like 0 does. * no-mistakes(review): remove dead reviewThreads branch from security test fake gh * no-mistakes(review): use portable sed -i.bak in contributions test helper * no-mistakes(docs): name the thread URL in the unanswered-wake header text
… opt-in flag (#7631) * Refuse unguarded Herdr lifecycle briefs at spawn * no-mistakes(review): name matched Herdr command, document opt-in guard, test scaffold * no-mistakes(lint): quote matched-command assertion so ShellCheck SC2016 passes
…an opt-in flag (#7630) * fix(bin): publish a child's PR-ready line only after checks green behind an opt-in flag bin/fm-pr-check.sh publishes the child's PR-ready line to the parent channel when it registers the PR, before the child has reported its checks green. With config/ready-after-green present, a no-mistakes registration records the PR and arms the merge poll but publishes the line only when the last done line in the child's status is 'done: PR <url> checks green' for that PR. Without the flag the behaviour is unchanged. * no-mistakes(review): accept checks-green note with surrounding text for ready line * no-mistakes(ci): Lint 2 was caused by this PR and is fixed. Behavior tests (Herdr) is a pre-existing flake unrelated to this PR, so no code change was made for it. Lint 2 (fixed): ShellCheck SC2034 at tests/fm-teardown.test.sh:2711 because `run` was declared with `local` but is a function defined inside the test, never a variable. Invariant: a `local` declaration names only variables the function uses. The same wrong declaration also existed in the sibling opt-in test at line 2662 (both added by this PR), so `run` was removed from both `local` lines. Verified locally: `shellcheck -x tests/fm-teardown.test.sh` returns 0 (it reproduced the SC2034 warning before the edit), `bin/fm-lint.sh tests/fm-teardown.test.sh` returns 0, and `bash tests/fm-teardown.test.sh` exits 0 with 141 passing tests, including both "fm-pr-check withholds the PR-ready line ..." and "fm-pr-check releases the PR-ready line on a checks-green report that carries surrounding text". Behavior tests (Herdr) (not caused by this PR): the single failure is tests/fm-backend-herdr-presentation-e2e.test.sh "concurrent secondmate recovery failed ... error: herdr presentation recovery could not acquire its session lock; refusing a concurrent resume". That test exercises bin/fm-spawn.sh's Herdr session-lock recovery path; this PR touches only bin/fm-pr-check.sh, docs, a SKILL.md row, and tests/fm-teardown.test.sh, and the presentation test references none of them. The identical failure appeared on the unrelated branch fm/t3-5596-successor-v3 in run 39709923982 (job 119598556006), and the flake is already tracked in open issues #6454 and #7277. Rerunning the Herdr job should be enough; fixing the lock budget belongs to those issues, not this PR
* feat(bin): add Rex as an auto-detected session backend Add bin/backends/rex.sh, a session-provider adapter for the Rex terminal multiplexer, and wire it through the dispatcher, spawn, control plane, crew state, busy evidence, and away-mode supervision. - Auto-detect Rex from TERM_PROGRAM=rex with REX_BLOCK, after tmux and Herdr and before cmux; explicit --backend, FM_BACKEND, and config/backend still win, and a nested tmux or Herdr is never read as Rex. - One focus-safe tab per task: in Firstmate's own Rex session when it runs directly inside Rex (confirmed against the server), otherwise in one session per home; new blocks are resized to 200x50; every call names its session and block by immutable id. - Recovery-grade agent state from Rex's process view, OSC 7501 program status as positive busy evidence only while its owner is in the foreground chain, and a viewport derived from the last size.rows rows of the styled capture. - Absence proof from a structured not-found on the recorded server (rex_server), so fm-control exit and relaunch work on Rex and a gone block is reclaimed into a fresh tab in its recorded session. - Away mode for a Rex-hosted primary runs its daemon in a dedicated Rex session killed by exact id. - Docs: docs/rex-backend.md, configuration and control-plane tables, and a dated live verification record; tests: a stateful fake-CLI suite, a real-server smoke test guarded to its own fm-test- session, and a Rex away-launcher e2e. * no-mistakes(review): Recover Rex reclaim after server stops; document deferred asks * no-mistakes(document): Correct Rex documentation and consolidate stale backend guidance
…ollback (#7625) * no-mistakes(review): wedge cap: guard the cap-fire counter reset with rollback * no-mistakes(document): docs: repair shard-pack wording and wedge-cap marker shorthand * no-mistakes(review): docs: correct away-release terminal-row bound claim * no-mistakes(document): docs: cover third guarded cap-state write in watcher comment * no-mistakes(ci): Reweighted the packing hint for tests/fm-supervision-host.test.sh from the local 789123 ms to 1192918 ms, the one completed successful CI sample (run 39642852135, job 119276758966), and let the LPT packer rebalance. The guard was not weakened (PORTABLE_SERIAL_MAX_WEIGHT_MS=1200000, PORTABLE_SERIAL_SHARDS=9, coverage guard and packing-boundary check untouched) and nothing was hand-placed. New packed hint sums of the 9 serial shards (ms): 1=1192918 (1 script), 2=1139923 (18), 3=1139903 (30), 4=1139922 (30), 5=1139917 (30), 6=1139886 (29), 7=1139891 (30), 8=1139880 (29), 9=1139911 (31). Total 228 scripts = the serial lane exactly; max 1192918 < 1200000, so it fits. Packing guard: bin/fm-test-run.sh --check-coverage -> FM_TEST_COVERAGE ok total=268 parallel=24 parallel_max_ms=665545 parallel_imbalance_ms=2 parallel_unhinted=0 serial=228 serial_shards=9 serial_unhinted=15 serial_max_ms=1192918 serial_budget_ms=1200000 herdr=16, exit 0. tests/fm-test-run.test.sh passes both packing contracts: 'coverage guard bounds the unmeasured share and serial packing within twenty minutes' and 'serial packing accepts the exact budget and refuses one millisecond above it'. bin/fm-doc-audience-check.sh ok (surfaces=124 local_links=851). docs/fm-test-portable-shards.md now states the same 1192918 ms for that script, citing run 39642852135 (documented duration == packed weight), and adds the required honesty note in the same paragraph style: run 39765114423 cancelled this script alone in a shard at the 30-minute job cap and upstream run 39618934309 hangs identically, so the weight is a fit to the 20-minute packing target, not a cure, and the underlying slowness is an upstream defect this branch does not own. No other file, weight, test or doc line touched. Unrelated pre-existing failure, verified by git stash at base commit 5af4072: tests/fm-session-lock-ancestry.test.sh asserts 'the pty-host was not reparented to init after the daemon ended' and fails identically on the unmodified tree (sandbox pty behaviour); the --jobs family-admission assertion in the same suite fails only because of it. Not caused by this change
* fix(bin): restore inherited handling before main-only hand-back * Restored downtime so an earlier engine turn could not suppress a later main-owned close while leaving a healthy successor behind * Routed restoration failures through the existing Stop-hook alarm instead of silently discarding the hand-back * Added host-and-hook regressions plus attended and away idle-return controls to separate missing monitoring from status classification * no-mistakes(test): Assert ordered stale event in returned-driver controls * no-mistakes(document): Document main-only hand-back downtime restoration and failure * no-mistakes(document): Correct host header on main-only downtime republish
… of GNU timeout (#7636)
…(#7639) * feat(rex): push blocked edges from Rex program status through a bounded Lua reader Rex joins Herdr as a push-capable backend: a bounded rex do reader streams program_status_changed, child_exited, and block_closed for the watched task blocks, and a trusted blocked edge wakes the supervisor with Rex's blocked kind and message in the reason. The per-pane dedupe moves into the shared transition lib, the record gains a detail field, and gone edges end the wait for an immediate poll. The real-Rex test isolation is shared by both smokes. * fix(rex): anchor the composer read on Rex's cursor position Rex's format method reports the cursor alongside the styled grid, so the composer verdict now uses the same cursor-anchored read as tmux and falls back to the cursorless read only where that is unknown. OpenCode 1.19 draws a status line below its composer, which made every cursorless read of an idle OpenCode worker on Rex unknown and refused steers, exit, and relaunch. * test(rex): add a live composer guard for every installed harness on Rex * docs(rex): record push-event and per-tool live evidence on Rex * no-mistakes(document): Clarify Rex documentation and shared transition ownership * no-mistakes(ci): Fixed flaky public-followup fixture teardown: killing only the remote worker child allowed its supervisor to restart and race directory removal. Cleanup now uses the existing whole-worker-tree stop helper. Verified the full public-followup suite, remote-job orphan-reap suite, shell syntax, and git diff checks all pass
…nd an opt-in flag (#7634) * refactor(bin): share the branch-to-PR lookup through fm-pr-lib * feat(bin): notify owned PR health changes behind an opt-in flag * no-mistakes(review): drop status-line ownership, key checks per name, remove PR wait rule * no-mistakes(review): rediscover the branch PR once the cached one is final * no-mistakes(review): refuse retired re-enrollment, require marked checks, verify owned records * no-mistakes(document): note shared branch-to-PR lookup in scripts table * fix(bin): notify reported failures when no checks are required * no-mistakes(document): inventory PR health flag and state, note new pr-forge member
* Isolate real Rex tests with private servers * no-mistakes(review): Trap Rex cleanup early and prove passive-read autostart guard * no-mistakes(document): Consolidate Rex test isolation documentation
* fix(bin): report an outdated bootstrap tool instead of a missing one detect_local_tools printed "MISSING:" for a treehouse without --lease, a no-mistakes below 1.46.0, a gh-axi below its floor, and an incompatible tasks-axi or quota-axi, so a supervisor read an installed tool as absent and took the first-install remediation again. Report those as "OUTDATED:" with the installed version, the requirement and the tool's own upgrade command: treehouse update, no-mistakes update, gh-axi update and quota-axi update. tasks-axi ships no self-updater, so it keeps its install command. "MISSING:" stays for absent tools only, and lavish-axi keeps PRESENTATION_UNAVAILABLE with its text fallback. Update the bootstrap-diagnostics handler, the AGENTS.md section 13 trigger list and the operator diagnostics in docs/configuration.md, and cover absent, below-floor and at-floor for every floored tool in tests/fm-bootstrap.test.sh. * no-mistakes(document): Documented distinct bootstrap tool diagnostics * fix(bin): reuse the tasks-axi check's own probe results Rendering the tasks-axi OUTDATED requirement text ran the two `--help` capability probes again after the compatibility check had already run them, including when session start handed bootstrap an incompatible verdict. The check now records the reason behind its verdict - the version floor, or the capability probes the build fails - and reuses it, both within the process and across the existing one-hop handoff, so naming a missing capability costs no second probe pass. A build below the floor is answered by its version alone and never pays for capability probes it cannot use. The bootstrap tests that simulate a tool as absent removed it from the fake bin directory while bootstrap kept searching the fallback base PATH, so a real host install could satisfy the lookup instead of the expected MISSING line. Those cases now hide the tool from the base path as well, and a new case pins the contrast between a bare and a curated fallback. Verified: the touched bootstrap suite passes, and its probe-count and capability assertions fail against the pre-fix scripts. Run with a fallback base PATH carrying real installs of the absent tools, the pre-fix suite fails on "absent treehouse reports a missing tool" while the fixed suite passes every case. * no-mistakes(document): Documented missing versus outdated tool diagnostics * no-mistakes(document): Refresh outdated-tool documentation * no-mistakes(review): Reuse shared version parser for outdated diagnostics * no-mistakes(document): Correct outdated-tool diagnostics documentation * no-mistakes(document): Align toolchain upgrade documentation * fix(skills): keep main's bootstrap-diagnostics description and only add OUTDATED
…e verbatim match (#7530) * Clarify ahoy legacy startup exclusion * Fix quoted payload code span
…7637) * fix(timeout): bypass shell builtins when invoking external runners * no-mistakes(review): Remove redundant slashless runner resolution from external timeout
…urable (#6094) * fix: count answered captain holds in the Done archive at the completion gate Done retention moves closed markdown rows into the configured Done archive, which tasks-axi show never reads, so verify, complete, and scout teardown refused an answered captain hold once retention archived it. The completion gate now reads the newest archived block for an attested entry, under its exact or legacy identity, and accepts it only through a recorded resolution. Unanswered archived closes and holds found nowhere still refuse. * no-mistakes(document): document Done-archive durability in captain-hold verification record * no-mistakes(ci): Fixed the selected Greptile findings in bin/fm-captain-hold.sh (all in the Done-archive read path added by this PR). code_change_needed=true. ci-3 (Archived reads can hang): task_show_archived() now bounds the replayed archive `tasks-axi show` with the same read bound the live backlog read uses (FM_BACKLOG_ROW_TIMEOUT_SECS via fm_run_timed, sanitising a non-positive/padded value to 10s, mirroring fm_backlog_row_show). A bound hit is treated as 124, not absence: task_show_archived returns 124 and prints a loud reason; archived_entry() propagates 124; verify_entry_durable() exits 124 on the archived-read bound (alongside its existing resolve 124 handling); verify_hold_durable() exits 124 rather than reading the row as absent. So verify can no longer hang and complete can no longer stay blocked while holding the origin metadata lock. ci-4 (User-level archive setting ignored): added captain_markdown_archive_setting(), which resolves the [markdown] archive key with tasks-axi's own source precedence — the backlog root's .tasks.toml first, then $HOME/.tasks-axi/config.toml — before the existing default of done-archive.md beside the backlog; a relative value still resolves against the backlog root, which I verified empirically matches tasks-axi (root config wins over home config; a relative home-config value resolves against the backlog root; default stays data/done-archive.md). tasks-axi exposes no command for the archive path, so re-parsing with matched precedence is the available approach. Added test_archived_answer_in_a_user_configured_archive_satisfies_the_gate, which sets the archive only in a fixture $HOME/.tasks-axi/config.toml and drives the whole hold→answer→retention→verify/complete/teardown flow with that HOME, asserting the answered call archived to the relocated location still satisfies the gate. ci-5 (repeated archive scans, P2): left unchanged per the instruction's opt-out. A clean reuse of the row archived_entry already found is not small: archived_entry runs inside a command substitution, so its TASK_SHOW_OUTPUT dies with the subshell and cannot be handed to verify_hold_durable without restructuring both to pass the loaded row through the current shell. The growth is bounded (O(archive size) per attested entry) and P2, so hardening it would add more machinery than the fix warrants. Unanswered archived closes and holds found nowhere still refuse (existing test coverage retained). Verification: `bash -n` clean; pinned ShellCheck 0.11.0 (`shellcheck -x bin/fm-captain-hold.sh`) reports 0 findings; tasks-axi archive-precedence behaviour confirmed by direct experiment. The full fm-captain-hold-lifecycle.test.sh suite (which exercises both the pre-existing archived-gate test and the new user-config test) is slow due to beads spawns and was still running at report time; recommend confirming it green before merge. ci-1/ci-2 need no code change (action_required fork workflow runs awaiting maintainer approval), per the recorded user decision * no-mistakes(document): Document Done-archive reads under backlog row timeout * docs: say only the archive row replay is bounded, not the archive scan * no-mistakes(document): Move Done-archive rule to the complete section
… (#7627) * fix(bin): optionally read a PR with no CI checks as unverified, not checks green nm_ci_checks_state maps the ci log marker "no CI checks reported - still monitoring" to green, the same verdict as "all CI checks passed". A pull request that no check ever ran against therefore surfaced as "checks green: PR ready for review" (#3216). Add a no-checks verdict for that marker, returned only in a home that creates config/ci-no-checks-not-green. The run-step consumer reports working with a detail naming the real condition, and the status-log override no longer promotes a crew's own "checks green" report while that marker is the latest. Without the flag every reading is unchanged. Co-authored-by: Harlan Do <[email protected]> * no-mistakes(document): document ended-monitor reading under the zero-checks flag * fix(bin): read a PR with no CI checks as unverified on every home The ci log marker "no CI checks reported - still monitoring" now always yields the no-checks verdict, so a pull request that no check ran against is reported as working instead of checks green (#3216). The opt-in flag, its docs section, and its skill entry are removed, the default-path test now expects working, and the usage header and architecture note describe the no-checks reading. --------- Co-authored-by: Harlan Do <[email protected]>
… test root-safe (#7650) * no-mistakes(review): correct the counter-reset log line, the sentinel comment, and the root proof Three findings the review step recorded but never applied, all in this branch's own change. The clean-rollback branch of the counter-reset guard logged "cap state rolled back", copied from the sibling marker-write branch. That is wrong here: the cap marker was already written before this block and _wedge_cap_rollback only truncates the counter, re-arms the since-file and clears write tracking - it never clears the markers. The window therefore stays silenced for FM_CAP_HORIZON_SECS, so the one operator-facing line must say that rather than claim the cap state was rolled back. The rollback behaviour is unchanged and no marker-clear call is added: the marker is deliberately kept so the window stays quiet. The sentinel short-circuit comment opened "from either route that has to defend cap state" and then enumerated three routes. Wording only. The new regression case injected its fault with chmod 444, which does not restrict root, so under root the guard would never fire and the case would fail on its own exit-code assertion. It now skips as root the way this suite's other mode-based faults do. The assertions are untouched: as the ordinary user the case still proves the guard. * no-mistakes(review): name both ways a capped window leaves the silence in the reset log line The tier-0 message for a refused post-fire escalation-counter reset says the cap marker stands, so the window stays silent until its horizon elapses. That names one release route where there are two: wedge_episode_end drops the marker through _wedge_cap_markers_clear, so any episode-ending route ends the silence early, and docs/configuration.md records deleting the marker as the operator's way to re-engage a capped window at once. This tier writes no sentinel, so the marker is the only thing left to remove. The message now names the horizon, an episode-ending route, and the operator remedy, in one line in the same shape and position as its sibling tier-0 messages. The rollback behaviour, the marker handling and the tier are unchanged. * no-mistakes(document): correct root-skip comment's mode-bit precedent in wedge-cap test
* fix(bin): resurface wakes appended while a handling successor is parked The supervision host parks on the handling successor it starts for a wake its engine handled, and a handling successor never resurfaced recovery, so a row another script appended during the park (a captain inbox note from the Basecamp integration) sat queued until an unrelated close - four hours in the observed case. A handling successor now records the newest queued sequence at its start and closes once with the recovery wake while a newer row is still queued; a newer row already consumed only advances that mark, so the predecessor's delivered episode is still never re-announced. Follow-ups, not built here: - A row appended in the short window between a handled close and its successor's start (about a second) is below the successor's mark; if the engine handles that close without claiming the row, the row waits for the next close. Closing that window needs the host to treat rows left queued after a handled attended turn as main's, which is a separate host change. - After a machine reboot the primary session does not restart on its own, so queued wakes wait until it is resumed by hand. Either auto-resume the primary session after boot, or alert the owner when the primary session is down while wakes are queued. * no-mistakes(review): Close handling-successor startup wake race * no-mistakes(test): Stabilize parked-host inbox wake regression timeout * no-mistakes(document): Clarify handling-successor wake continuity guarantees * no-mistakes(ci): Stabilized the flaky remote secondmate lifecycle test by extending the auto-relaunch watcher deadline from ~30 to ~60 seconds. The CI runner exceeded the old deadline by about 3 seconds; the changed production branch was not reachable in this fixture. `bash -n` and `git diff --check` pass. The full test was attempted but exceeded the 600-second local execution limit before reaching this case * no-mistakes(ci): Fixed flaky concurrent Herdr recovery testing by retrying only documented session-lock contention after both competitors finish. Cleanup now handles fixture-owned read-only hooks. Targeted E2E passed; bash syntax and diff checks passed. Shellcheck reported only existing SC1091 source-following notices * no-mistakes(test): Preserve successor wake boundaries across handoffs * no-mistakes(test): Revert successor boundaries and drain teardown fixture wake * no-mistakes(test): Notify main when downtime handback publication fails * no-mistakes(test): Revert downtime handback notification changes * no-mistakes(document): Correct stale supervision wake routing documentation * fix(bin): stop the supervision host deadlocking and re-announcing handed-back closes Two defects in this branch's handling-successor changes surfaced as the "Behavior portable serial 2" shard hanging at its 30-minute limit. A TERM that lands while the host settles a handled turn's successor handoff left the host holding the wake-queue and recovery-marker locks; its exit cleanup then waited forever on the queue lock it still owned. The cleanup now releases those locks if this process owns them before releasing its grant. When an accepted close turns main-only at its turn, the host hands it back and leaves the successor running, but republished the episode as pending downtime, so that successor re-announced the same close and exited. The handback now republishes the episode as already announced; a later durable append still opens a pending episode the successor recovers. * no-mistakes(test): Park on successor after handling settlement failure * no-mistakes(test): Use tab-delimited handled-settlement failure logs --------- Co-authored-by: Caleb LeNoir <[email protected]>
* fix(bin): keep accented letters in pending-reply request summaries fm_pending_reply_summarize deleted every byte outside printable ASCII, so a Portuguese summary lost its accents: "não faça a correção" was stored as "no faa a correo". It now removes control characters only. The 120-character cap counts UTF-8 characters from lead bytes, so it never splits a letter under any caller locale, including the C locale. * no-mistakes(document): Documentar preservação de acentos nos resumos --------- Co-authored-by: Alexandre Custodio <[email protected]>
* Add explicit OpenRouter Jev dispatch resolution * no-mistakes(document): Clarify dispatch documentation and remove stale duplicates * chore: exclude local Stele binding from PR * no-mistakes(document): Correct dispatch help and never-send documentation * ci: retrigger CI after a timed-out test shard * no-mistakes(document): Correct dispatch architecture documentation ownership
…imits (#6983) Opt-in: fm-watch.sh publishes state/lane-capacity.json via bin/fm-capacity.sh --publish only while config/lane-capacity exists; adds beat pressure and keyed limits to fm-capacity.sh. Unconfigured fm-capacity output unchanged.
* fix(bin): transport contribution-input JSON through slurpfile, not argjson bin/fm-fleet-snapshot.sh --contribution-input passed the full backlog and task-record JSON to jq through --argjson. A single --argjson argument is capped by the kernel's MAX_ARG_STRLEN (131072 bytes on Linux), so a large enough backlog made the kernel refuse to exec jq while the script still exited 0 with a broken result. Transport both documents through temporary files and --slurpfile, matching the pattern the default snapshot path already uses, and propagate a non-zero exit when that jq invocation fails. Fixes #5349 * test: narrow contribution-input regression to final assembly failure The ARG_MAX transport is already fixed on main by #6830, so keep only the regression proving a failing final jq assembly exits non-zero.
* Fix Rex secondmate session lifecycle * no-mistakes(review): Retire Rex secondmate sessions under the owning home identity * no-mistakes(review): Limit Rex FM_ROOT label override to secondmate launches * no-mistakes(document): Clarify Rex secondmate grouping and lifecycle documentation
…gins, and exit (#7336) * feat(opencode): add OpenCode 2 support with version-gated launch and plugins OpenCode 2 dropped the v1 server-plugin hook API, so the five fm.primary.* plugins now export a default definition with an id and a setup function alongside their legacy OpenCode 1 server export, backed by a new shared lib/fm-opencode2.js helper; the turn-end guard, watch-arm, cd-check, pretool-check, and sessionstart-nudge install their behavior from setup(ctx) on OpenCode 2 and keep the server entrypoint for OpenCode 1. fm-spawn probes the resolved opencode executable's --version once and branches the launch, model flag, reasoning config, exit key, and busy-state plugin off the detected major. A parsed major >= 2 takes the OpenCode 2 shape (no --model, the model pinned through OPENCODE_CONFIG_CONTENT, a raw Ctrl-C exit, the session.execution.* busy plugin); OpenCode 1.x and any undetected or unparseable version fall back to the 1.x shape (--model, 1.x config, /exit) everywhere. The worker busy-state plugin is always provisioned, but OpenCode 1 keeps the pre-port session.status/session.idle plugin so its busy-state wiring is unchanged, and only a major >= 2 gets the session.execution plugin. Adapter and supervision docs, OpenCode 2 live fixtures, and regression tests for the unknown->1.x launch path and the version-gated busy-plugin shape are included. * no-mistakes(review): gate OpenCode 2 busy plugin turn-end touch on notifyTurnEnd * feat(opencode): launch detected OpenCode 2 workers with --standalone OpenCode 2's default launch attaches to the shared background service, which hosts plugins with the service's environment and ignores the pane's OPENCODE_CONFIG_CONTENT. A private server keeps per-worker model, permissions, FM_HOME, and lock ancestry correct. 1.x and undetected versions are unchanged. Ported from kunchenguid/firstmate#5143. Co-authored-by: Girik Bajaj <[email protected]> * fix(opencode): resolve the OpenCode 2 project location and treat every terminal turn as a turn end OpenCode 2.0.x hands plugins the project only as ctx.location.project.directory and takes ctx.session.prompt({ sessionID, text }), so the V2 setup path never found its root or delivered a prompt. Interrupted and failed turns now end a turn like a succeeded one, while a server shutdown does not. Ported from kunchenguid/firstmate#5143. Co-authored-by: Girik Bajaj <[email protected]> * test(opencode): add a token-free OpenCode 2 native plugin fixture to the live e2e A private opencode serve plus a loopback provider proves the five primary plugins load and act on OpenCode 2: startup nudge, cd and watcher-redirection guards, turn-end guard, watcher arming across succeeded, interrupted, and failed turns. The fixture declares the complete model capabilities object, which OpenCode 2.0.11 requires and 2.0.22 accepts. FM_OPENCODE_LIVE_BINS runs it across several OpenCode 2 executables. The credentialed half now picks its run flags and session tables by detected major, so it keeps working on 1.x. Fixture ported from kunchenguid/firstmate#5143. Co-authored-by: Girik Bajaj <[email protected]> * feat(opencode): send one Enter when an OpenCode 2 launch leaves the brief unsent OpenCode 2.0.11 prefills the --prompt brief without submitting it, while 2.0.22 submits it. After launch, fm-spawn waits for the worker's busy-state plugin to report the turn start, sends one Enter only if it has not started and the composer is not empty, and fails the spawn if the turn never starts. * docs(opencode): document the OpenCode 2 launch, delivery gate, and standalone primary homes Records the 2.0.11 and 2.0.22 live evidence for the native plugin fixture and the post-launch brief delivery gate. * no-mistakes(review): Trim OpenCode 2 adapter shapes and harden Ctrl-C exit * no-mistakes(review): Record OpenCode 2 live seatbelt and exit evidence * no-mistakes(test): Document OpenCode 2.0.22 wide-pane sidebar exit refusal limitation * no-mistakes(document): Refresh OpenCode 2 exit-key and seatbelt payload docs * test(opencode): verify OpenCode 1.x live with the dual-export plugins Pin the live e2e TUI panes to the resolved opencode executable, and record OpenCode 1.15.7, 1.18.20, and 1.18.31 evidence for plugin loading, the turn-end guard, watcher continuity, and 1.x worker launch and exit. * no-mistakes(review): Defer OpenCode 2 Enter on unknown composer; widen turn-end docs * no-mistakes(document): Document OpenCode 2 delivery gate unknown-composer test outcomes --------- Co-authored-by: Niranjan <[email protected]> Co-authored-by: Girik Bajaj <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…8028) * fix(bin): refuse captain-hold release while the away record exists `fm-captain-hold.sh answer --release` checked nothing about who answers, so the away session could release a captain hold with its own words and then steer the held work past the fm-send guard. A script cannot prove the words are the captain's; this closes the unattended path instead. While the away posture record (state/.afk-contract) or the away daemon flag (state/.afk) reads away, `answer --release` and a `release` line on the keyed-answer intake are refused before any write, naming the attended-session requirement. A quiet record is a present captain and no record is attended, so both still release. A closing answer without --release is unchanged. * no-mistakes(ci): Fixed the release race in bin/fm-captain-hold.sh: after taking the task control lock, answer --release takes the away-record lock (fm_afk_contract_lock_hold), rechecks posture under it, and holds it through the release write. The cleanup trap releases the lock. The keyed-answer intake reaches the same path through `answer --release`. Added test_release_rechecks_away_after_waiting_on_task_lock; it passes with the fix and goes red with the recheck removed. Only the three release tests were run, because the full lifecycle suite takes over 10 minutes here and was killed at the time limit. ci-1 (missing full-ci label) was declined, so no code change applies to it
* feat(bin): add experimental herdr-core runtime backend Herdr Core (the hc CLI, 0.1.x) is a separate product line from the stable herdr TUI - persistent terminals in flat named sessions with OSC 7501 status - so it gets its own adapter rather than changing backend=herdr, which keeps driving the TUI unchanged. The adapter maps the fm_backend_* contract onto hc: version/protocol gates (hc x.y.z floor 0.1.14, hello generation 1), per-home sessions fm-<hometag> with ambient HC_* markers stripped, task terminals as labeled `hc run` shells (<session>:<tN>), a pending-buffer send model because hc send is atomic paste+Enter, structured verdicts from its exit codes, and kill+rm with ownership re-reads. Poll-only this stage; no auto-detection, no secondmates, no supervisor/afk/relaunch claims. Ships with an isolated lab helper (scratch XDG roots, pinned socket, fleet tripwire, session-process teardown), a pinned installer, a portable fake-hc suite, and a gated real-hc smoke. * hc: consolidate Stage-1 onto the upstream hc backend Upstream's bin/backends/hc.sh already owns the Herdr Core adapter, so the parallel herdr-core backend world (adapter, docs, tests, lab, installer, ci-cleanup) is removed. The Stage-1 capabilities it carried are ported onto hc: a binary gate (FM_HC_BIN, then herdr-core, then hc; `hc x.y.z` version shape with a 0.1.14 floor), a protocol-generation-1 hello handshake in container_ensure, `--` delimiters on send/keys, and send_text_submit driven by `hc send --wait` (native started/working proof, exit-9 blocked is a hard stop, conservative composer fallback). The lab world lands as fm-hc-lab.sh with a fleet-state tripwire and a serve/hold daemon sweep that excludes the caller's process tree by process group (an exported HC_SESSION otherwise self-matches forever). The smoke and the default-on liveness e2e run inside lab sessions; fm-install-hc.sh pins 0.1.14 with SHA-256 verification; a required tests-hc CI lane mirrors tests-herdr with snapshot/cleanup around a serial `--family hc` run. * no-mistakes(review): Pin hc test binary, resolver, stat, lab XDG roots * no-mistakes(document): Correct hc setup and verification documentation * no-mistakes(ci): Fixed all three findings: private validated lab/socket roots and exclusive sessions, cleanup in both live-test EXIT handlers, and fail-closed fleet snapshot reads. Added behavioral regressions; confirmed they reject the original implementation. Adapter tests (16), targeted regressions, injected cleanup failures, shell syntax, ShellCheck, and diff checks passed. Real-Core live tests skipped because hc/herdr-core is unavailable * no-mistakes(document): Correct hc setup and cleanup documentation
* fix(tests): start suites from CI's environment, not the launching terminal's A suite run directly from a terminal hosted by herdr inherited that launcher's identity (HERDR_ENV, HERDR_PANE_ID, HERDR_SOCKET_PATH and siblings), its TERM_PROGRAM marker, the FM_BACKEND selector bin/fm-spawn.sh exports into task panes, and any home/state override (FM_HOME, FM_*_OVERRIDE) a supervisor shell exports. Spawn and backend fixtures then bound to the host's real herdr session instead of the isolated one their case creates: several suites failed with `herdr launcher pane '...' belongs to the server at ... not session 'default'`, and fm-spawn-worktree-settle recorded a real workspace's pane path as a fixture worktree, while the same suites passed in CI. The effect only appears on a herdr-hosted machine. Clear that inherited environment once in tests/lib.sh, the shared fixture layer. bin/fm-test-run.sh already cleared the overrides and FM_BACKEND per worker, but not the herdr identity, and a direct `bash tests/x.test.sh` run got neither. A case that deliberately exercises a launcher identity, a backend, or a home/state override still exports its own value after sourcing the library. * no-mistakes(review): Remove unneeded HERDR_CONTAINER_RAW and TERM_PROGRAM_VERSION from test unset list * no-mistakes(review): Add launcher environment regression test and correct lib comments * no-mistakes(review): Preserve operator config override in T3 live suites * no-mistakes(test): Accept subreaper adoption in session-lock recycled-chain test * test: keep the session-lock subreaper fix out of this offer The reparent assertion in fm-session-lock-ancestry fails the same way on untouched upstream under a child subreaper, so it is a pre-existing host portability issue this change did not cause. Restore the file so the offer carries only what the launcher-environment fix requires. --------- Co-authored-by: yeti <yeti@alps>
* feat(pr-health): distinguish maintainer approval states * feat(pr-health): alert authors on requested changes * feat(pr-health): read owned PRs on GitHub notification events Classify maintainer-gated CI from ACTION_REQUIRED check suites, which an awaiting-approval fork PR shows while its rollup stays green, keep required approval and author action as distinct once-per-commit states, and drive reads from a conditional notifications feed with the poll as fallback. * no-mistakes(review): Preserve same-timestamp notifications; regression added; focused test timed out * no-mistakes(review): Record maintainer waits without waking tasks * no-mistakes(review): Retain notification cursor until feed page completes * no-mistakes(review): Retry truncated check suites and clarify wake behavior * no-mistakes(review): Record pending reviewers without review decisions * fix(pr-health): advance the notifications cursor on a full page A full page already forces a full read of every owned PR in that pass, so holding the cursor back only pinned a busy account to full sweeps; the first read of such an account never saved a cursor at all. * feat(pr-health): read owned PRs on GitHub notification events Classify maintainer-gated CI from ACTION_REQUIRED check suites, which an awaiting-approval fork PR shows while its rollup stays green, keep required approval and author action as distinct once-per-commit states, and drive reads from a conditional notifications feed with the poll as fallback. * no-mistakes(review): Restore unrelated hc documentation changes * no-mistakes(ci): Fixed ci-3 by keeping successful reads with `mergeable: null` pending, and ci-4 by persisting selected URLs as pending alongside the advanced notification cursor before reads. **ci-2 remains unresolved:** check-suite pagination is not implemented, so lists exceeding 100 suites may still be treated as unsettled. `bash tests/fm-pr-health.test.sh` timed out after 120 seconds; earlier cases passed, but verification is incomplete * no-mistakes(ci): No code changes completed. The conflict check was corrected to distinguish `mergeable: null` from `false`, but check-suite pagination and its page-2 regression test remain unfinished. Verification was not run; this phase cannot be marked complete * no-mistakes(ci): Fixed ci-2 in `bin/fm-pr-health.sh` and added regression coverage in `tests/fm-pr-health.test.sh`. Check suites now paginate up to 10 pages; exceeding that bound leaves the read unsettled. The patch also covers mergeability retry behavior and interrupted notification passes. `FM_LIVE=0 bash tests/fm-pr-health.test.sh` passed all 33 tests, and `bash bin/fm-lint.sh` passed. Left ci-1 unchanged * fix(pr-health): read check suites in their own query gh --paginate follows a single pageInfo, so nesting the paginated check-suite connection in the PR query stopped it paging the check contexts: a PR with more than 100 checks never finished a read and was never classified. * fix(pr-health): judge a full notifications page against the cursor GitHub ignores since= on a conditional (If-Modified-Since) request and answers with the newest page, so a busy account always got a full page and every changed feed forced a full sweep. A page now forces the sweep only when it is full and its oldest entry is still newer than the saved cursor. * no-mistakes(lint): Fix ShellCheck empty cursor assignment * no-mistakes(ci): Fixed the interruption regression test to terminate the captured main poll PID and assert that it exits unsuccessfully before verifying the event is retried. The interruption test passed. The full test script timed out after 120 seconds, though the tests reported before the timeout passed; `git diff --check` passed * no-mistakes(ci): Updated `tests/fm-pr-health.test.sh` to run and terminate the main poll directly, and assert during the interrupted read that the advanced notification cursor and selected event are saved together. `FM_LIVE=0 bash tests/fm-pr-health.test.sh` passed (34/34); `git diff --check` passed * test(pr-health): stop the main pass in the interruption test The fake gh now stops the outermost poll process rather than a background read shell or a wrapper subshell, and the test asserts that the advanced cursor and the selected event were saved together before the reads. A PR with more than a page of pending review requests is covered too; only whether any request is pending matters, so the first page decides it. * test(pr-health): interrupt the pass by its own PID The interruption case starts the check in the background, whose PID is the poll itself because the check execs it, and the fake gh stops that PID. This drops the ps ancestry walk, which Git for Windows cannot run. * no-mistakes(document): Update PR health monitor documentation --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Kun Chen <[email protected]>
The spawn convergence test cleared TMUX but inherited HERDR_ENV from a Herdr pane, so backend auto-detection picked Herdr and created a real workspace. Pin the spawn to the tmux backend the test stubs, shadow herdr with a recording stub, and assert the spawn never calls it.
A registered check cut off at FM_CHECK_TIMEOUT before it printed anything stayed silent: run_check_capture discarded the exit status, so the timeout never reached a wake. On hosts without GNU timeout or gtimeout, the perl fallback in owned-group mode also sent SIGKILL to its own process group, so perl died with 137 before it could exit 124. run_check_capture now appends "timed out after <seconds>s" to anything the check printed before the cut. In owned-group mode the perl fallback sends SIGKILL only to the check it forked; the watcher already kills the rest of the group after its wait. Refs #4338. Original fix by @kynjal26.
* test: resolve host tools in watcher lock fixtures
The watcher-lock suite's three fake ln shims exec'd a hardcoded /bin/ln,
and two identity fixtures named their holder process through exec -a. Both
assume a host whose /bin carries coreutils and whose sleep still runs under
a rewritten argv[0]. On a host that keeps only sh in /bin, and whose sleep
is a multicall binary that dispatches on argv[0], the shim exits 127 and the
holder dies at once, so those cases fail on the fixture instead of on the
lock behavior they assert.
Each shim now receives the host's own ln path through FM_TEST_REAL_LN,
resolved with command -v as this repository's other fixtures already do,
and the two holders are python3 processes that carry the fixture path as an
argument, which keeps them reapable through the fixture root. CONTRIBUTING's
test-fixture rules name the pattern so a new shim does not reintroduce a
hardcoded /bin path.
Before, on a host without /bin/ln: "not ok - acquirer could not reclaim dead
steal owner (rc=8)" and, with the shims fixed but the holders unchanged,
"not ok - could not identify the fixture holder". After: the full suite is
58 ok with exit 0.
Provenance: ports 8a0b7b8b ("no-mistakes(test): Make watcher lock fixtures
portable across host tools"), which fixed one of the three shims plus both
holders. The other two shims are the same defect in the same file, so they
are carried here rather than left to fail on the same hosts.
* no-mistakes(test): test: resolve rm and ps in watcher lock fixtures
* no-mistakes(document): correct fixture-portability guidance in CONTRIBUTING
* feat(bin): support rex as a remote secondmate backend
Remote second mates no longer require herdr: --backend rex launches the
mate on the remote account's own persistent `rex server start` server in
that home's per-home 2ndmate-<id>-<hash> session, where its endpoint
survives every SSH disconnection the route depends on. Herdr stays the
default and the only backend a pre-Rex remote can verify.
- fm-spawn accepts --backend rex, threads it through the readiness gate
and the remote control launch, and refuses a returned rex route that
does not pin a host-local unix:// server and a session-matched
<session-uuid>:<block-uuid> target; it records remote_backend,
remote_rex_session_id, and remote_rex_server.
- fm-remote-secondmate-control.sh accepts {herdr, rex} per verb: rex
endpoints require a host-local unix:// rex_server, state probes are
pinned to the recorded server through the endpoint absence recheck
(unproven reads stay unverified, never missing), route output reports
the rex identity trio, and launch refuses an endpoint recorded on a
different backend than the one requested.
- fm-remote-readiness-lib passes the selected backend to the doctor. A
pre-Rex remote exits 2 on --backend, so an explicit herdr request
retries bare while a rex request stays refused.
- fm-remote-doctor.sh gains --backend herdr|rex|any: rex verifies the
CLI, client and server API revisions against the verified floor, and
a persistent unix:// server (exit_empty=false); --fix may start or
restart that server but never installs the CLI.
- fm-secondmate-liveness-lib re-checks an alive remote route's backend
against the recorded remote_backend and reports drift instead of
migrating; records without remote_backend stay herdr.
- tests share a stateful fake rex fixture (version, whoami, server
lifecycle, sessions/windows/blocks, process/status/capture,
send/send-key, events, agent-on-send) across the adapter, doctor,
liveness, and lifecycle e2e suites.
Verified on disposable Linux (Apple container, Debian 12 aarch64, rex
0.1.0-preview.12, API rev 8): nested-shell foreground tracking and
input delivery, peer-vs-anonymous whoami, rex do/events, --exit-empty
vs persistent server durability, and session restore on identical
socket+state.
* fix(bin): keep rex on recovery, route keys, never stop rex
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* test: assert exact rex fake state in new regressions
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* test: request bootstrap relaunch facts in rex recovery check
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* no-mistakes(review): keep remote rex control plane from autostarting
* no-mistakes(document): Correct remote Rex documentation contracts
* no-mistakes(document): Point provisioning to remote backend contract
* no-mistakes(lint): Silence intentional deferred expansion lint warning
* no-mistakes(ci): Diagnosed Full suite failure as serial shard 9 exceeding its 30-minute cap. Updated the expanded remote lifecycle test’s measured scheduling weight and increased serial shards from 10 to 11, preserving timeouts and complete coverage. Coverage guard, runner and workflow contract tests, actionlint, source-aware ShellCheck, and diff checks passed. Hosted CI rerun remains for the outer executor
* no-mistakes(ci): Fixed fm-on’s stale Herdr-specific test assumptions by explicitly selecting Herdr in both fixtures, and refreshed the entrypoint’s stale doctor bootstrap hash. Reproduced both failures before fixing. fm-on and remote-doctor behavior suites and git diff --check pass locally. Full suite failure was downstream of the failing shard; hosted CI rerun remains for the outer executor
* no-mistakes(ci): Fixed both findings: Rex retirement now refuses block close and home deletion unless the answering server matches the recorded endpoint; readiness reads whoami once and requires explicit boolean exit_empty=false. Refreshed the doctor bootstrap digest. Reproduced both regressions before fixing. Doctor, full remote lifecycle, entrypoint tests, targeted ShellCheck, and diff checks pass
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
… (#8076) * docs(harness-adapters): correct claude --setting-sources worker claim * no-mistakes(review): Correct sibling setting-sources claim in fm-claude-trust.sh comment * no-mistakes(document): Rewrap corrected setting-sources comment in fm-claude-trust.sh
* fix(contributions): keep maintainer-comment polls inside the check timeout In a home with a few hundred contribution records, the contribution poll spent most of the watcher's 30-second check bound on local bookkeeping before its forge budget started: three jq processes per saved record file plus several per already-final URL. The watcher killed the poll before it read most open PRs, so a maintainer comment on an open PR could wait many hours, or never, for its wake. The PR health monitor had the same cost in its enrollment step: it re-enrolled every owned pair on each pass and saved nothing until the end, so a killed pass never converged and a PR on a later task branch was never enrolled. - read_saved validates every record in one jq process and keeps the per-file path only to count unreadable records. - poll skips final URLs that every owner already holds error-free, with one jq pass deciding settled, final and live URLs. - owned reports the tasks holding a durable record for each URL, and the PR health monitor skips enrolling pairs that already have one, so a pass cut short still makes durable progress. * no-mistakes(review): Isolate record validation errors per file in one jq * no-mistakes(review): Read each record file whole to avoid joining * no-mistakes(ci): Fixed ci-2: read_saved in bin/fm-contributions.sh now validates records in bounded jq batches (FM_CONTRIBUTIONS_READ_BATCH, default 100) instead of one jq with every record path, so a long-lived home cannot hit the argument-length limit. Batch results are merged; malformed-record, task-identity, no-trailing-newline behavior and the per-file unreadable count are unchanged. Added test_records_beyond_one_read_batch_are_all_read (5 records, batch 2, jq wrapper rejecting more than 2 record files); it fails on the old code and passes now. The full contributions suite passed before the wrapper was added. I re-ran only the new test afterwards. ci-1 (Full suite) is the maintainer full-ci label gate, so no change was made for it. I did not reply on the review thread * no-mistakes(review): Hard-code contributions read batch at 100 * no-mistakes(lint): Silence ShellCheck SC2016 in contributions test
…nd relaunches (#8069) * fix(pr-lib): preserve authenticated PR polls across updates and relaunches An armed merge poll binds to the hashes and file objects it was registered with, so a repository template update no longer invalidates it. Validation previously required the published check to be byte-identical to the current bin/fm-pr-poll.sh, which an update or a control relaunch silently broke even though the watcher executes the current repository poll with validated data and never executes the registered state-file bytes. Accept control_relaunch_tx among the metadata fields that may follow the PR identity, and pin both behaviours in the security suite: an older registered generation still detects its merge without executing sidecar code, and forged bytes or forged trailing metadata are refused. * no-mistakes(document): Align poll-registration docs with hash-bound validation * no-mistakes(ci): Addressed the selected Greptile finding (ci-2) in tests/fm-pr-check-security.test.sh:3474 (test_registered_poll_survives_template_update_and_relaunch). Problem: for the template-update and combined scenarios, the "historical generation" fixture was bin/fm-pr-poll.sh with a marker line appended after the poll's unconditional exit, so the marker was unreachable and the copy still performed the same gh call. Both the marker-absence and gh-call assertions could therefore pass even if the watcher had executed the registered bytes instead of dispatching the current repository poll. Invariant: the historical registered check bytes are never executed; only the current repository poll runs, and it must be the sole source of the merge result and the sole forge call. Places this must hold: the template-update scenario, the combined (template-update + control_relaunch_tx) scenario, and the relaunch-only scenario (which legitimately has byte-identical check bytes). Fix: for non-relaunch scenarios the fixture is now a self-contained stub whose whole body is reachable — it writes the sidecar marker file and prints the distinct line `historical-generation`, and never touches gh. The relaunch scenario keeps the unchanged cp of the current poll as before. No existing assertion was weakened or changed: marker absence, `task-a.check.sh: merged`, the `pr view ... --json state` gh log entry, poll retirement, and forged-check refusal all remain. Verification (FM_TEST_BASE_PATH=/run/current-system/sw/bin, required on this NixOS host because mkdir is not under /usr/bin): full `bash tests/fm-pr-check-security.test.sh` passes with no `not ok` lines, including the registered-generations case; `bash -n` and `shellcheck -S warning` pass on the file. Negative control: temporarily patching bin/fm-watch.sh to execute the registered check bytes made the same test fail, then the patch was reverted (git status shows only the test-file change). ci-1 (Full suite) was marked ignore by the human decision and its suite passes locally * no-mistakes(test): Prove live that template-update polls stay armed and keep their merge wake
* feat(hc): auto-detect the Herdr app signals for the hc backend Stage 3 of Herdr Core support: a Firstmate running inside the Herdr app now selects the hc backend automatically, while classic Herdr TUI, nested tmux, and bare hc terminals keep their existing verdicts. Two app-owned signals, checked after every other surface marker: - app-terminal: the process's own HC_TERMINAL_ID carries a non-empty herdr.space label in its core's record - the exact condition the app projects a terminal into its window. An app terminal's env is deliberately identical to any other hc terminal's (the core rewrites the app's TERM_PROGRAM=herdr claim to ghostty), so the claim is read from the record via `hc get`, gated by a live unix-connect probe because `hc` autostarts a core on contact with a missing socket. - app-window: a live herdr-app.sock under the resolved app home (HERDR_APP_HOME, else XDG_CONFIG_HOME/herdr-app, else ~/.config), probed by an actual unix connect - the app's own liveness rule. The app is never launched and the core is never contacted for it. Both require a usable hc toolchain (executable FM_HC_BIN or a self-identifying herdr-core/hc on PATH, plus jq); a live window without one records app-window-unusable and fm_backend_name prints a notice naming the missing piece instead of switching. Explicit --backend, FM_BACKEND, and config/backend always win; auto-detected hc prints a loud opt-out notice and meta records backend_detect=app-terminal or app-window alongside the existing herdr.space/herdr.tab presentation labels. Supervisor-endpoint discovery resolves an hc terminal to <session>:<address> and backend hc so the away daemon fails loudly at its supported-backend check instead of silently steering firstmate:0 tmux; full hc away support stays out of scope. Verified against herdr-app 0.1.11 source/binary and an isolated hc 0.1.14 lab session (docs/verification/runtime-backends.md); a real app window's socket and in-window label display remain unverified. * no-mistakes(review): Bind hc auto-detection to the live spawn core * no-mistakes(document): Correct hc selection and supervisor documentation * fix(hc): gate app auto-detection on the adapter's verified core version Greptile on PR #8060: fm_backend_detect_hc_usable accepted any self-identifying 'hc x.y.z', but the adapter's container gate requires FM_BACKEND_HC_MIN_VERSION (0.1.14). A live app window or terminal beside an older core would auto-select hc, then have the spawn abort at the version check - breaking an otherwise usable default spawn. Detection now runs the adapter's own fm_backend_hc_version_check through fm_backend_source (the same source path spawn and the bootstrap tool check use), so an auto-selection can never resolve a binary the spawn would refuse. The duplicated detection-side bin resolver is folded into the adapter's fm_backend_hc_bin, and the unusable notices name the verified minimum. A below-floor binary reports app-terminal-unusable or app-window-unusable, covered by new fake-version assertions. * no-mistakes(review): Make app-detect negative tests reject detection * no-mistakes(document): Point hc metadata guidance to its owner * fix: drop the app-window signal from hc auto-detection The live real-Herdr-app exercise proved app-window cannot distinguish "firstmate inside an app terminal" from "the app is open somewhere on this host": marker-less bare processes selected hc solely because a window existed, binding whatever core the spawn would reach. The app-terminal signal (this terminal's own herdr.space label on the spawn-reachable core) is the only claim that actually places the process inside the app, so it is now the sole auto-select signal. A marker-less process near a live window resolves the default backend silently; explicit --backend/FM_BACKEND/config selection is unchanged. * no-mistakes(document): Correct hc single-signal documentation
…sion (#7525)
* Park verified native Codex supervision outside the model
* Document native Codex park verification and fallback
* no-mistakes(review): Extend Codex park startup grace to ten seconds
* no-mistakes(review): Document ten-second Codex park startup grace rationale
* no-mistakes(document): Name Codex native park in supervision host header
* no-mistakes(document): Add native Codex park script to scripts inventory
* Gate native Codex park behind config/codex-stop-park and cover it with behavioral tests
The native Codex Stop park now runs only in a home that opts in with
config/codex-stop-park; without it the session start, the synchronous
guard, and the asynchronous Stop hook behave as before the park existed
and the foreground checkpoint stays the default. A fixture-driven suite
with a fake codex covers the opt-in and version gates, the single-flight
claim, the fallback latch on a failed queue delivery or repeated arm
failure, the owner-gone watcher exit, and the retained quiet boundary.
* ci: add a tenth portable serial shard for the Codex stop-park suite
* no-mistakes(document): Point Codex park verification record at behavioral suite
* ci: retrigger checks
* Revert the tenth portable serial shard (added by #7838)
* no-mistakes(ci): I fixed both Greptile findings (ci-1, ci-2) with the small changes you asked for. No new state, subsystem or protocol change. The changes are not committed, so there is no Co-Authored-By trailer anywhere. **ci-1: a woken turn could lose its rearm (`bin/fm-codex-stop-park.sh`)** - Rule that must hold: when a registered session that still needs supervision hits Stop, a park must end up rearmed. A delivering park that still holds the claim must not make the next hook give up. - The only place that gives up is the claim acquisition in the async Stop hook. `--guard` already accepts a recent delivered record, so it needed no change. - Fix: if acquiring the claim fails, the hook reads the holder pid that the lock library reports. It checks that `.codex-park.json` shows this session, outcome `delivered` and that same pid, and that the pid is alive. Only then does it poll for up to 3 seconds (30 × 0.1 s) until `CLAIM` is gone, and retry the acquire once. Any other busy claim still does the old `exit 0`, so the single-flight case behaves as before. **ci-2: compaction skipped after a quiet boundary (`bin/fm-supervision-host.sh`)** - Rule that must hold: when the park clock restarts, every value measured on that clock restarts with it. `WARM_COMPACT_LAST_TICK` is the only such value. - Fix: one line, `WARM_COMPACT_LAST_TICK=-1`, in the Codex model-free quiet-boundary branch of `boundary_reached`. **Tests (`tests/fm-codex-stop-park.test.sh`)** - New case `test_stop_rearms_after_a_delivering_park_releases_its_claim`: a helper process holds the claim with a delivered record that names it, and releases it after 1 s. The Stop hook must wait, arm once, deliver one wake with no recovery notice, and leave a record that belongs to the new park. - Extended `test_host_quiet_boundary_retains_the_watcher` to use `config/warm-compact`, `FM_WARM_COMPACT_TICK=2` (equal to the 2 s park interval) and a stub engine that fails. The engine record is only written after the first quiet boundary, so compaction (`warm-compact engine failed` in the log, `/compact` passed to the stub) can only happen if the tick runs on the restarted clock. The watcher-retention checks still apply, now across three boundaries. - Mutation checks: with ci-1 reverted, the suite fails ("must rearm … expected '1', got '0'"). With ci-2 reverted, it fails with no warm-compact line in the log. I restored both fixes after each check. **Verification** - The whole suite passes (8 of 8). - `shellcheck -x` is clean on all three files. - `bin/fm-test-run.sh --check-coverage` passes: `FM_TEST_COVERAGE ok`, serial_max_ms=1140457 against a 1200000 budget, with 10 serial shards in the current tree. - Measured cost went up by about 3–4 s: three local runs took 25.6 s, 26.8 s and 24.8 s, against about 22 s recorded earlier. That is still under the 30000 ms hint, so I left the hint as it is
* no-mistakes(ci): Fixed the remaining ci-1 gap: a woken turn that reaches Stop while the earlier park is still sending its wake now waits for that park to release the claim, then rearms. Before, it gave up and left no watcher. The changes are not committed. What had to hold: when a registered session that still needs supervision hits Stop, a park must end up rearmed. That depends on two places: the record the park writes while it sends a wake, and the check that decides whether to wait when the claim is busy. Changes in bin/fm-codex-stop-park.sh: 1. Timeout constant: the literal 20 in deliver's fm_run_timed is now DELIVERY_TIMEOUT=20. The busy-claim wait is derived from it: (DELIVERY_TIMEOUT + 5) * 10 polls of 0.1 s, about 25 s. A comment names the constant. 2. New outcome before sending: the wake path now writes `record delivering` just before deliver. Every way out of it already overwrites that: success writes delivered, failure writes delivery-failed, HUP/INT/TERM write interrupted. 3. Wait check: the busy-claim check now accepts delivering or delivered, still for the same session and holder pid, and still only if that pid is alive. 4. One addition not asked for: delivering is added to the outcomes that trigger the recovery notice (with waiting, arming and interrupted). Before this change, a park killed with SIGKILL mid-send left waiting behind and the next park sent a recovery notice. Without this word that notice would silently stop. --guard and the claim model are unchanged. Test: the existing case in tests/fm-codex-stop-park.test.sh now takes two arguments: the outcome the holder records and how long it holds the claim. The holder then records delivered and releases, as a real park does. The suite runs it as `delivered 1` (old case) and `delivering 4` (new case, over 3 s and under the 25 s bound). Both require the Stop hook to arm exactly once, send one wake with no recovery notice, and leave a record that belongs to the new park. Mutation checks: - With the wait check set back to delivered only, the new case fails ("must rearm ... expected '1', got '0'"); fix restored. - Removing the new `record delivering` line fails no test, because the test's holder writes its own record. The delivering recovery trigger also has no test. Verification: - shellcheck -x is clean on all three touched files. - One unexplained failure: the suite passed in 12 of 13 full runs (3 run in parallel). The failed run was a timing run with output discarded, so the failing case is unknown; it did not reproduce in 13 more runs. - Hint raised: measured runs took 29.8 s, 34.0 s and 34.7 s, over the 30000 ms hint, so the hint is now 35000 in bin/fm-test-run.sh. bin/fm-test-run.sh --check-coverage passes: serial_max_ms=1140951 against the 1200000 budget, 10 shards. - The commit-message and comment wording rules don't apply yet, since nothing is committed
* no-mistakes(review): Gate latched fallback on supervision need; fix shard doc
* no-mistakes(document): Align Codex Stop-guard docs with park behavior
* no-mistakes(document): Document latched-fallback Stop block in turn-end guard doc
* no-mistakes(ci): Fixed ci-2 and ci-3; ci-1 left untouched and no CI file changed. ci-2 (bin/fm-codex-stop-park.sh): added settle_idle, called at both idle decisions (top of arm loop and inner poll loop) when fm_supervision_needed turns false. If state/.wake-queue is non-empty it records delivering, calls the existing deliver path, then records delivered; on delivery failure it records delivery-failed, latches the fallback and exits 1. With an empty queue it records idle and exits as before. Away mode, lost session lock and unregistered session still exit idle without delivering. The single-flight claim, fallback latch and rearm path are unchanged. ci-3 (bin/fm-supervision-instructions.sh): the codex case of ordinary_wake_line now splits on CODEX_PARK. A parked session is told the Codex Stop hook owns watcher continuity (drain and handle the wake, do not arm another cycle). A non-park Codex session keeps the foreground-checkpoint line unchanged. The existing codex assertions are unchanged and still pass. Verification: tests/fm-codex-stop-park.test.sh and tests/fm-supervision-instructions.test.sh both exit 0. shellcheck -x -S warning is clean on both scripts. No new tests were added, because neither suite had a matching case. Neither the settle_idle delivery path nor the parked ordinary-wake line is exercised by those suites
* test: cover the idle settle delivery and the parked ordinary-wake line
* no-mistakes(document): Document final-result delivery when Codex park ends
---------
Co-authored-by: crewmate <crewmate@localhost>
* fix(timeout): preserve stdin in background runners Explicitly inherit stdin before backgrounding the bounded command so Bash does not replace piped input with /dev/null. Cover inherited input and pipeline functions across timeout, gtimeout, perl, and bash. * chore(document): Document stdin preservation in timed runner
…(#8082) A dead local second mate was respawned through a fresh --secondmate spawn, which re-read config/backend. With config/backend=hc that spawn was refused, so a second mate whose Herdr pane died stayed down. The liveness respawn now passes the backend the mate's record names, so a changed config/backend only affects new spawns. Remote mates keep their host's routing. Tests: fm-secondmate-liveness passes, including a new pinned-backend case.
… (#3701) * fix: stop a stale failed run outranking newer truth bin/fm-crew-state.sh matched a no-mistakes run against the worktree's current code identity, so it inherited whatever run last sat on that head. A terminal failed or cancelled run then outranked every newer record: a declared pause, a crew's own terminal done line, and even a run still in flight on the same branch. That was not merely a misleading state line - the stale failure was promoted into a durable terminal-outcome record and queued for captain presentation, naming a pull request the current run had never opened. Two independent fixes. The reader now proves a terminal failure is current before reporting it. A later run the pipeline's own ledger proves current answers instead; a later self-declared pause or done in the status log answers instead where the ledger's date proves the log was appended after the failed run began; and a later run that cannot be bound here reads as unknown - history, but no proof of the present. Nothing else may, so a stale working, needs-decision, or blocked line still cannot mask a real failure, and with no ordering evidence at all the failure stands. A terminal reading also publishes the pull request its own run opened, or none when it opened none. bin/fm-inactive-reconcile.sh no longer inherits either half of the claim. A terminal outcome is built only when the crew's own last self-declared word does not contradict it, in both directions, and its pull-request identity comes from the same record as its state rather than from a separately recorded task PR. bin/fm-nm-run-lib.sh keeps the one attribution owner: the supersession check reuses its existing rules and adds only the branch's newest ledger row and the one-directional reading of the ledger's date column. * no-mistakes(review): Captain: fix terminal run and PR provenance * no-mistakes(review): Captain: preserve newest terminal run provenance * no-mistakes(review): Captain: consolidate terminal provenance and status snapshots * no-mistakes(review): Captain: enforce precise terminal outcome provenance * no-mistakes(document): Consolidate terminal-state documentation ownership * test(crew-state): expect unknown for an unprovable live replacement f5d7f5f (#4476) raised the attribution bar: the runs ledger carries no run id, so a LIVE replacement cannot be proven current and the reader answers unknown. That moves three cases from rule 2b's case (a) to its case (c), which this branch already documents as the honest answer for a replacement that cannot be bound here. Only the state label changes. Every safety assertion is unchanged and still passing: no false failed state surfaces, and no stale pull request is published. * no-mistakes(review): gate status-log supersession off the attributed run's failure * no-mistakes(review): accept only ready-signal PRs from a status-log outcome * no-mistakes(review): report unknown for an unbindable live replacement run * no-mistakes(review): make ordering and gate regression tests non-vacuous * no-mistakes(review): restore current-run shape for ordering regression tests * no-mistakes(review): require ordered status line to be log's last line * no-mistakes(review): share ledger row validation, match run heads both ways * no-mistakes(review): require a terminal ledger row for status-log ordering * no-mistakes(document): name shared ledger-row validity owner in architecture * no-mistakes(review): let reader ordering evidence keep a failure reportable * no-mistakes(review): establish crew-word ordering from the log alone * no-mistakes(document): record proven-older crew word exception in architecture * no-mistakes(review): remove status-log ordering rules from crew-state reader * no-mistakes(review): let run-step terminal states outrank the crew's own word * no-mistakes(review): state the narrowed corroboration rule in architecture doc * no-mistakes(review): run rule 2b after the socket-down status-log override * no-mistakes(review): name the ledger verdict's own run, document applied precedence * no-mistakes(review): skip rule 2b on coarse path, restore scout PR guard * no-mistakes(document): note scout PR exception in reconcile header contract * no-mistakes(review): extend terminal-reading precedence to done readings * no-mistakes(review): derive ledger status from the run record's status field * no-mistakes(review): drop vacuous checks-passed test, record traced evidence * no-mistakes(review): name the unbindable ledger row, not an earlier run * no-mistakes(review): append run id as a field, keep PR without ledger row * no-mistakes(document): document run-id field and corrected terminal PR rule * no-mistakes(lint): quote keyword literals in terminal-state comparison (SC1010) * Preserve cancellation as unknown in ledger precedence * Align completed-run selection fixture PR identity * no-mistakes(document): Align crew-state rule 2b comment with cancelled-as-unknown * no-mistakes(ci): I fixed the Greptile finding (ci-1): crews in the main home that reported a GitLab or Gerrit review now keep the review link in their completion notice. I left the changes uncommitted in the worktree for no-mistakes to validate and publish to PR 3701. I made no other changes and did not rebase, push or touch history. The rule that was broken: a terminal outcome taken from the status log must carry the review URL that its own ready report names, for every forge the project supports. **What changed** - In `bin/fm-inactive-reconcile.sh`, `terminal_outcome_pr` no longer uses its own regex, which accepted only GitHub-style `/pull/<n>` URLs. It now takes the note, strips the leading `PR `, strips an optional ` checks green` or ` published for review` (the Gerrit ready shape), and passes what is left to the existing `fm_pr_url_parse` in `bin/fm-pr-lib.sh`. That library is already loaded through `fm-dod-lib.sh`. This means GitHub, GitLab merge requests, Forgejo and Gerrit URLs are all accepted. The function returns the parsed URL, still taken only from the state line itself. - The run-step path, the scout rule, the rule against claiming URLs that are only mentioned in prose, and the cancellation-as-unknown and terminal-identity rules are unchanged. - I updated the comment above the function, because it said the rule was the same as `pr_for_task`'s, which is no longer true. **One stricter result you should know about:** a GitHub URL must now pass the shared parser's host check. It must be `github.com` or a host listed in the `github-hosts` config, and it must use `https`. For this reason I changed one fixture in `test_status_log_sourced_outcome_keeps_its_own_pr` from `https://example.test/.../pull/7` to `https://github.com/.../pull/7`. No other test depended on the old pattern. **Test:** I added one regression test, `test_status_log_outcome_keeps_gitlab_and_gerrit_reviews`, in `tests/fm-inactive-reconcile.test.sh`. It uses `PR https://gitlab.example/group/sub/project/-/merge_requests/8 checks green` and `PR https://gerrit.example/c/group/project/+/4201 published for review`. **Verification** - With the old `bin/fm-inactive-reconcile.sh`, the new test fails ("the gitlab terminal outcome dropped its review link"). - With the fix, `bash tests/fm-inactive-reconcile.test.sh` passes completely ("all inactive reconciliation tests passed"). - `shellcheck -x` reports no problems in either file. **Not changed, as you instructed:** `pr_for_task`, the ledger-first fallback in the same file, also accepts only `/pull/` URLs. That is the same problem in a sibling function. If a reviewer reports it, you said to stop and report rather than run another repair round
… --resolve-key refuses (#3983) * fix(supervision): make the OPEN DECISIONS listing name the key that closes it An operator answering a listed decision runs the command the listing itself advises, and that command refused - discarding the steer with it. The two folds never disagreed. Both the whole-file fold and fm-send's resolver read the same status_open_decisions rule, and both correctly keyed `blocked: axi run hung ... [key=no-mistakes-start]` as `default`: the key grammar states a key before the colon or at the head of the note, so a token trailing a summary is prose. The reader that was wrong is the third one, the drain's OPEN DECISIONS renderer. It suppressed `[key=default]` and printed the note verbatim, so the only bracket token a reader could see on such an entry was the one that is NOT the key - and the entry named a key it had not folded. Every entry now states its folded key, `default` included, so the key the listing shows is the key its advised command closes. An unresolvable key still refuses rather than delivering: an answer this send cannot close would leave the decision open behind an answer the operator believes settled it. The refusal no longer costs the message instead - it diagnoses a key that is only mentioned inside an open decision's note, names the keys that are actually open, and prints the resend commands with the message quoted back verbatim. * no-mistakes(review): Remove automatic key selection from resend advice * no-mistakes(document): Clarify operator key selection in resend documentation * fix(send): carry the caller's routing context into every printed resend A refused --resolve-key preserves the operator's message by printing a resend command, but the command could not run: it reused $0 and dropped the routing environment. A one-shot "FM_HOME=<home> bin/fm-send.sh ..." exports nothing to the next command, and a relative $0 is valid only from the directory that invocation ran in, so a copied line resolved to another home's state, to no script at all, or refused with FM_HOME unset - and the preserved message still never reached the worker. The unconfirmed-remote retry path already solved this. Both printed resend paths now share that one statement of it: the absolute home always, the state override only when this invocation was given one, and this script's absolute path. Covered by a test that invokes fm-send through a relative path with a one-shot FM_HOME, then runs what it printed from a different directory with nothing supplied - what an operator copying the line actually does. * no-mistakes(review): remove unprovable decoy-key diagnosis, quote resend key placeholder * no-mistakes(review): scope empty open-set claim to status file, always offer keyed resend * no-mistakes(review): Keep already-accepted keys in the refused-key resend * no-mistakes(review): Check every resolve key before refusing, keep order * no-mistakes(document): Reflow fm-send resolve-key refusal header comment
…sweep (#8086)
* fix(pr-check): record every PR a task reports in a done line
Merge and health monitoring of a task's PR began only when the supervisor
ran fm-pr-check.sh by hand on the ready signal. When that step was missed,
for example on a rebase of an existing PR whose done line did not use the
canonical wording, the task kept no pr= and no merge poll, so failing
checks and maintainer requests on that PR went unnoticed.
fm-pr-check.sh scan now records each task whose newest done line naming a
supported PR URL ("PR <url>" anywhere in the note) has no pr= yet, through
the ordinary registration path, so every refusal still applies. The
watcher runs it at the start of each check sweep. A refusal is reported
once per task and PR as a check: pr-register: wake and retried silently on
later sweeps; teardown removes its marker.
* no-mistakes(review): Scan new PR reports before refused retries
* no-mistakes(review): Rotate scan start so hung PR registrations cannot starve
* no-mistakes(review): Resume PR scan after last attempted task
* no-mistakes(lint): Fix SC1007 in fm-pr-check.sh candidates declaration
* no-mistakes(ci): Fixed ci-2 and ci-4 in bin/fm-pr-check.sh. ci-2: the scan now treats a task whose pr= equals the reported done-line URL but has no valid published poll as unregistered, so a later sweep republishes the poll. ci-4: scan-driven registrations run with FM_PR_CHECK_SCAN=1 and, under the metadata lock, exit 0 without writing if pr= is now set to a different URL; manual registration is unchanged. Added two tests in tests/fm-pr-check-security.test.sh (test_scan_publishes_a_missing_poll_for_a_recorded_pr, test_scan_does_not_overwrite_a_pr_recorded_meanwhile), and a configurable FM_TEST_GH_SLOW_SECONDS in the slow gh stub. Both new tests fail without the fix and pass with it; the four existing scan tests still pass; shellcheck shows only SC1091 info notes. The full test file aborts earlier on this machine at an unrelated test (GNU stat '%Lp' errors / flaky), so I ran the scan tests as a separate set. ci-1 and ci-3 are declined, with no code change; the ci-3 known-limit line (a refusal notice can be lost if the watcher stops between writing the refusal marker and queueing the wake) still needs to go into the PR description, which I cannot edit from here. Known tradeoff: a merged task whose poll was retired but whose pr= and done line still match would look unregistered and be re-armed until teardown
* no-mistakes(ci): Part (1) is fixed. The scan in bin/fm-pr-check.sh now skips a task that has state/<id>.pr-poll-merge-notified or state/<id>.pr-poll-retirement. A merged task's retired poll is no longer re-armed. I added test_scan_does_not_rearm_a_retired_merged_poll to tests/fm-pr-check-security.test.sh. With the exclusion removed, the test fails ("the scan re-armed the poll of a merged task"). With it restored, the test passes. The existing missing-poll and concurrent-PR scan tests also pass. I ran only these three tests, because the full file is slow and was already known to abort early on this machine at an unrelated stat test. shellcheck -S warning is clean. Part (2) needed no change. The scan-only recheck already sits inside the META_LOCK section, right after the lock is taken and the metadata file is re-validated, before the meta rewrite. It exits 0 without writing or publishing when pr= is a different URL. The ci-4 test still passes
* no-mistakes(ci): Fixed ci-2. The scan in bin/fm-pr-check.sh now skips a task only when its merge-notified marker or poll retirement receipt names the same PR as the recorded pr=. A new helper, pr_check_pr_retired, does the check. An older PR's marker no longer hides a newer recorded pr= whose poll is missing. Tests, in tests/fm-pr-check-security.test.sh: - Added test_scan_arms_a_replacement_pr_despite_an_old_merge_marker. It uses an old PR 7 merge marker and a recorded pr=9 with no poll. The scan must arm the poll. With the old unconditional skip restored, the test fails ("an older PR's merge marker hid the replacement PR's missing poll"). With the fix, it passes. - test_scan_does_not_rearm_a_retired_merged_poll now writes a valid marker for the same PR. The old marker was a bare version line, which the new check correctly rejects. This test still passes. - The other scan tests pass: publishes_a_missing_poll and does_not_overwrite_a_pr_recorded_meanwhile. - I ran only the four scan tests, because the full file is slow and aborts early on an unrelated stat test on this machine. shellcheck -S warning is clean. ci-1 is declined: only the maintainer full-ci label gate failed. I made no PR description edits, because I cannot edit the PR from here. The earlier requested statements still need to go in the description: the #8023 (comment-wake) coverage of the waiting-author comment case, and the refusal-notice known limit
* feat(pr-check): run the done-line PR scan only with config/pr-register-scan
The watcher check sweep runs bin/fm-pr-check.sh scan only when the
home opts in with the config/pr-register-scan presence flag. With the
flag absent, the sweep is unchanged from before the scan existed.
The watcher test covers both settings.
Co-authored-by: yeti <yeti@alps>
* test: give anchored absence assertions a regex that can match assert_grep and assert_no_grep are fixed-string greps. An anchored pattern handed to them searches for a literal caret, which no line can contain, so every anchored assert_no_grep passed no matter what the file held. Eighteen call sites across six suites asserted their absence that way, so they were silently checking nothing: the merge-local readiness snapshot, the public-followup request and platform links, the secondmate backend and harness records, the restart literal-stop path, the delivery mode and yolo fields, and the remote-doctor launchctl calls. Add assert_regex and assert_no_regex for patterns that describe a line rather than a literal, and convert those sites. The remote-doctor alternation becomes a real ERE group instead of a fixed string containing backslash-pipes. The three suites that run on this host pass unchanged: merge-local 8, task-delivery 34, public-followup 90. The other three fail identically on unmodified main here because their fixtures pin a PATH without tr, sed, or head; that is environmental and unrelated. * no-mistakes(review): Fix regex absence errors and interactive label guard * test(assertions): name lib.sh for ShellCheck source following * no-mistakes(test): Fix vacuous anchored absence guard in fm-pr-merge help test * no-mistakes(review): Restore pre-existing help assertion exactly * no-mistakes(document): Document new assertion suite coverage in its header comment
…am test fixtures in gitleaks ignore
This was referenced Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge with 'Create a merge commit' - do NOT squash or rebase; a squash would discard the ancestry this PR exists to restore.
#49 was squash-merged as 5563185, so upstream kunchenguid/firstmate commit 78c69df is not an ancestor of main. Since then the fork-contract job fails with
fatal: bad object 78c69df2, and gitleaks reports 2 leaks because the gitleaksignore fingerprints name upstream commits (7647d6b, 3004ccb) the squash removed from history.This PR is a single
git merge -s ours --no-ff 78c69df2on top of main: no content change (git diff origin/main HEADis empty), it only restores that ancestry.