Repository navigation
fix(bin): read the no_ci ci-monitor marker as no-checks - #7675
Conversation
|
Speaking as Kun's firstmate: thank you @Azd325. This is a clean, well-scoped fix. I read head VISION.md: one captain: aligns (the captain no longer sees a run "validating" when nothing is running) · authority explicit: aligns (unverified never promotes to done) · scripts/agents: aligns (exact marker match in a script) · restart: aligns (reads durable logs) · delegation: aligns (strengthens the refusal to trust a worker's own green claim) · vendor: aligns · scope: aligns. One thing I need from you: the live-validation table shows 0 of 3 scenarios driven live. Everything ran against the fake-axi harness. Could you run it once against a real no-mistakes run on a CI: serial 1 hit the 30-minute job cap, and the timing aggregate failed downloading artifacts (both known infra flakes). I've rerun the failed jobs. The no-mistakes attestation binds this head. Where it stands: waiting on you, for the live evidence. If that's in and CI is green on this head, I'll merge it. |
|
Ran it live. On a private repository with Reading that run with this branch's I closed the scratch PR without merging and deleted its branch. |
|
Live evidence is on a public sandbox repository with Reading the parked run:
It never reads as checks green. I closed the PR without merging and deleted its branch. |
|
Speaking as Kun's firstmate: thank you @Azd325, this is exactly the evidence I asked for. I checked Azd325/fm-sandbox#1. The sandbox declares The one thing left is CI. On the earlier rerun, Behavior portable serial 1 failed in |
|
Speaking as Kun's firstmate: this is merged. Thank you @Azd325 — really appreciate you taking the time on this. |
…7675) * fix(bin): read the no_ci ci-monitor marker as no-checks instead of validating Fixes kunchenguid#7644 * no-mistakes(document): Rewrap nm_ci_checks_state no_ci comment (cherry picked from commit 578fb5a)
…7675) * fix(bin): read the no_ci ci-monitor marker as no-checks instead of validating Fixes kunchenguid#7644 * no-mistakes(document): Rewrap nm_ci_checks_state no_ci comment (cherry picked from commit 578fb5a)
* fix: correct Rex secondmate grouping and lifecycle (#7656)
* 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
* feat(opencode): add OpenCode 2 support with version-gated launch, plugins, 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 https://github.com/kunchenguid/firstmate/pull/5143.
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
* 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 https://github.com/kunchenguid/firstmate/pull/5143.
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
* 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 https://github.com/kunchenguid/firstmate/pull/5143.
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
* 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 <nniranc@gmail.com>
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(bin): resolve the tmux container from firstmate's own session, not the most recent group member (#7662)
* fix(bin): resolve the tmux container from the caller's own session, not the most recent group member
* no-mistakes(test): Fall back when the $TMUX session id is stale
* no-mistakes(document): Document tmux container choice under grouped sessions
* fix(bin): read a fully dim Cursor idle placeholder as an empty composer (#7647)
* fix(bin): read a fully dim Cursor placeholder as an empty composer
cursor-agent 2026.10.19 draws the composer glyph and its idle placeholder
as one SGR 2 run with no reverse-video cell, so ghost stripping empties the
row and the empty-content guard returned unknown. Relaunch and exit then
refused on every idle Cursor pane on tmux.
When a styled bare row strips to empty and the plain row is an agent glyph
followed by an anchored idle placeholder, read it empty. Bright typed text,
other dim text, and unstyled rows keep their existing verdicts.
Fixes #7413
* docs(verification): record the fully dim Cursor placeholder verdict and refresh command
* fix(bin): say why away-mode inject deferred and pin named Claude idle composer as empty (#6163)
* fix(bin): recognize a named Claude session's titled composer rule on cursorless backends
`claude -n <name>` right-aligns the session name in the rule above the
composer. Cursorless backends (Herdr) accepted only solid rules, so the
scan saw the lower rule alone, the idle composer read `unknown`, and
away-mode delivery to a named Claude primary deferred until return.
A rule carrying one right-aligned title now opens a separator pair. It
never closes one, the pair it opens counts only over an agent-glyph row,
and it is never a valid Pi pair, so Pi's verdict is unchanged.
The away-mode composer deferral now names which refusal it was:
unsubmitted text, or no composer shape recognized.
* no-mistakes(review): Reword composer deferral reason to cover busy harness
* no-mistakes(ci): ci-3 (Greptile, user chose to fix): The rule that must always hold is that Claude's titled opening rule is accepted for any non-empty session name that doesn't start with a space and doesn't contain the rule glyph `─`, including a multiword name. The only place that check lives is the title `case` in `_fm_composer_titled_rule_row` (bin/fm-composer-lib.sh). It now reads `case "$title" in ''|' '*|*─*) return 1 ;; esac`, as the user asked, and the comment above the function mentions multiword titles. I added regression fixtures to `test_matrix_claude_named_session_titled_rule` in tests/fm-composer-lib.test.sh, next to the existing single-word `Andrew` cases. They use the title `Andrew Chen` and check that an idle composer on herdr reads `empty` and a composer with typed text reads `pending`. Something you should know: the old pattern already accepted a title with a space in the middle. It only rejected a title ending in a space. So the new multiword fixtures also pass against the old code, and the bot's failure scenario did not actually happen for "Andrew Chen". What the fix really changes is that it drops the trailing-space rejection, as instructed. Checks run: tests/fm-composer-lib.test.sh and tests/fm-composer-ghost.test.sh both pass (exit 0, no failures), and `shellcheck -x` is clean on both changed files
* no-mistakes(review): Match unnamed-ghost fixture rule width to the partner rule
* fix(bin): stop watcher arms whose ground is removed and reap Pi test process groups (#7666)
* fix(tests): reap Pi test process groups and stop arms whose ground is removed
Orphaned stub-arm pollers from tests/fm-pi-watch-extension.test.sh outlived
a failed case: they waited for release/stop files the failed driver never
wrote, teardown only removed the temp root, and the loops had no other exit.
Run each node driver in its own recorded process group and reap those groups
in teardown before the root is removed; end every blocking stub loop once its
own script is gone. bin/fm-watch-arm.sh now exits with a typed ground-removed
line within one poll when its script, state directory, or home is deleted,
instead of polling through the successor window.
* no-mistakes(document): Document arm exit when its ground is removed
* feat(bin): defer wedge escalation while a crew's no-mistakes run is validating (#5947)
* fix(bin): defer wedge escalation while an attributed validation run is running or fixing
While a no-mistakes run executes a round, the worker is correctly idle behind
its own blocking drive call, yet the watcher's wedge timer escalated a possible
wedge every FM_STALE_ESCALATE_SECS. The timer now consults the attributed run
step before escalating: a run the current-state reader reports as
validating (running) or validating (fixing) for a named run defers onto the
FM_PAUSE_RESURFACE_SECS recheck cadence, aged from a marker bound to that run
id. Parked, terminal, ci-monitoring, coarse, runless, absent and unreadable
runs keep the unchanged escalation ladder.
* test: count only the validating-run read in the unarmed parked-gate probe
* no-mistakes(document): add .validating-* to watcher-internals marker inventory
* no-mistakes(document): Update fm-watch.sh comments for validating-deferral chain
* no-mistakes(document): Document validating-run deferral in guard and handoff docs
* feat(watch): gate the validating-run wedge deferral behind config/wedge-defer-validating
The deferral changed the default for every home, unlike the comparable
config/wedge-defer-parked-gate and config/wedge-defer-worker-wait waits.
Absent the new presence flag the wedge timer spends no current-state read
for it and keeps the unchanged ladder.
* fix: identify Windows/Git Bash harness sessions for the session lock (#6300)
* fix(session-lock): identify a harness session on Windows/Git Bash
Every session start on Cygwin (Git for Windows) refused the fleet lock and
dropped to read-only with "cannot locate harness process in ancestry", so
spawning, steering, merging, the wake-queue drain, and supervision repair were
skipped on every start. Two independent causes, both on the identity path.
Cygwin's ps has no -o option at all and fails the whole invocation with
"unknown option -- o", so the ancestry walk aborted on its first hop. The walk
now reads comm, args, and ppid through accessors that fall back to Cygwin's
fixed ps columns, leaving the procps/BSD path unchanged.
That alone does not resolve the session: the parent link from a shell the
harness spawns does not cross the Cygwin boundary, and Cygwin reports that
shell's PPID as 1, so no walk can reach a harness that is a native Windows
process. Identity is instead taken from the session pid the harness publishes
and confirmed against the Windows process table before it is used - the pid
must still be live and its executable must independently identify a verified
harness - so an absent, stale, or non-harness value is discarded rather than
bound.
Walking the real Windows parent chain was implemented and then removed as
unsafe. MSYS emulates exec by spawning a fresh Windows process and exiting the
old one, so intermediate shells vanish and a child's recorded parent is
routinely a pid that no longer exists; Windows never reparents an orphan, so
that dangling id stays and can be reissued to an unrelated process. Following
it can bind a home's lock to the wrong process, which is the failure this file
exists to prevent. A harness that publishes nothing stays unresolved, which
leaves the session read-only exactly as before.
Windows pids are tagged rather than stored bare. They are a different namespace:
kill -0 reports a live Windows process as dead, and the number can collide with
an unrelated live Cygwin pid. The tag makes the value non-numeric, so a consumer
that treats it as a local pid - including a future kill - refuses it instead of
acting on the wrong process.
fm-sessionstart-nudge.sh carried a private second copy of the ownership walk and
so stayed wrong after the owner was fixed, nudging a session that already held
the lock. It now asks the owning function.
Verified on Windows 11 (Git Bash, Cygwin ps 3.4.10): the lock is acquired,
reports its holder, is idempotent, and refuses a bogus, dead, or non-harness
published pid. Regressions cover both platform departures behind a fake process
table, so they run on Linux and macOS CI too. The pre-existing e2e failure in
this suite on Windows is unchanged from main; it cannot exec its symlinked
fixture.
Refs #3396
Claude-Session: https://claude.ai/code/session_01F9T29YDqYSkQeDTC2Nfi7h
(cherry picked from commit 8b281b7b5507c342ac7870e8ccbefa56c55d05eb)
* fix(session-lock): keep the nudge's own ancestry question intact
Delegating the nudge to fm_session_lock_owned_by_self changed the question it
asks. The nudge asks whether a process in this ancestry took the lock; the
ownership predicate additionally requires a verified harness in that ancestry,
so a session whose lock was written by a plain shell started being nudged to
run session start again. tests/fm-sessionstart-nudge.test.sh pins the looser
contract deliberately.
The walk stays local, now reading ppid through the portable accessor so it also
survives a ps with no -o option, and defers to the ownership predicate only for
a Windows-tagged holder, which is not in this process table at all.
(cherry picked from commit 0baf64f71ffea275292a0fd88d033caccc041fc9)
* fix(session-lock): accept a tagged identity in every gate that reads the lock
The Windows identity added in this branch introduced a second shape into
state/.lock. Six gates read that field, and each one answered "is this value
usable" with its own inline numeric test, so every one of them read a valid
Windows holder as malformed.
The visible cost was concentrated in startup completion: the record was never
written, and the clear/compact check that consumes it could never match, so
every clear or compact on Windows repeated the full startup sequence. The
deferred network sweeps reported ownership as changed when it had not, and the
Stop auto-arm treated a dead Windows session as an unreadable lock rather than
a recoverable one. fm-lease.sh was the outlier: rather than refusing a value it
could not use, `tr -cd '0-9'` reduced the tag to its digits and produced a
number naming an unrelated process in the local table. It happened to fail
closed downstream, but deriving a wrong-namespace pid is precisely what the tag
exists to prevent, so it now takes the value whole and requires a local pid.
fm_session_pid_valid is now the single owner of that question and every gate
delegates to it, so a third identity shape cannot split them again.
Verified against the shipped bytes of each gate with a tagged lock: startup
completion now records and is recognized (main's gate reruns the full startup
on the same input), both network-ownership gates authorize their sweeps, and a
tagged lock yields no lease holder pid instead of 7204.
(cherry picked from commit 92561828fb9540ab6c77437def67a954e44b0418)
* fix(session-lock): gate the tagged identity on Windows and read it in every lock reader
Accept win:<digits> only where fm_win_boundary_applies, with an all-digit
remainder, so a Linux/macOS reader of a win:N lock stays inert as before.
The sessionstart nudge routes its tagged case through fm_win_untag_pid.
fm_session_lock_foreign_owner_live and fm_session_lock_inspect now validate
through fm_session_pid_valid and resolve a tagged holder through
fm_harness_pid_alive, so a live win:N holder reads as a live foreign owner
and as held; unverifiable tagged holders stay unknown.
* no-mistakes(document): Document Windows tagged session-lock identity in nudge and scripts docs
* fix(session-lock): keep task leases and stale detection working for a tagged holder
A Windows session can now hold the session lock as win:<pid>, but the task
lease still accepted only a local pid: the claim recorded the short-lived
fm-lease.sh process instead, and fm_lease_live rejected the tagged lock, so
the lease was never live and the other supervision actor could clear it and
act on the same task. The lease now records a live tagged lock holder whole
and treats it as live while it is still the lock holder and a verified
harness in the Windows process table. The session-lock library is loaded
only for a win:-shaped value, so POSIX lease verdicts are unchanged.
fm_session_lock_inspect left an exited tagged holder unknown, because
fm_win_command could not tell an absent pid from an unreadable table. It now
returns 1 only when a readable table proves the pid absent and 2 when the
table cannot be read, so inspection matches the local-pid contract: absent
is stale, a live non-harness is unknown with no live harness, and an
unreadable table stays unknown.
* no-mistakes(review): Restrict caller-supplied lease holder pid to local numeric
* no-mistakes(review): Pass tagged session-lock holder whole to task lease
* no-mistakes(review): Make tagged lease-holder regression tests fail without their fixes
* fix(session-lock): take a Windows CLAUDE_PID only with its session id
On Windows the session identity comes from CLAUDE_PID, which every process
started from a Claude pane inherits, so an unrelated process carrying a copy
could take the lock as that session and both would own it. The bridge now
accepts CLAUDE_PID only together with CLAUDE_CODE_SESSION_ID. The trusted
session-id gate matches the tagged win:<pid> form, so that id is recorded
beside the lock, and the anchor stays tagged. fm-lock.sh and the ownership
readers refuse the same tagged pid under a different recorded id as another
live session's. A non-Claude primary hand-started from a Claude pane inherits
both values and still resolves as that session; that remains a known
limitation. POSIX behavior is unchanged: every new branch applies only to a
tagged pid.
* fix(session-lock): let a Windows /clear re-key its own lock
/clear keeps the Claude process, so CLAUDE_PID stays while the session id
changes. Refusing the same tagged pid under a different recorded id locked a
session out of its own lock after /clear, which POSIX handles by re-keying
the sidecar. Drop that refusal: a Windows CLAUDE_PID is still taken only
together with its CLAUDE_CODE_SESSION_ID, and that id is still recorded
beside the lock and re-keyed on /clear as on POSIX.
* no-mistakes(review): Give tagged host test a session id; clarify Windows lock error
* no-mistakes(document): Point the trust-gate comment to the Windows limitation
---------
Co-authored-by: Lloyd <lloydkakunguwo@gmail.com>
* feat(bin): add opt-in local Claude usage threshold warner (#7421)
* feat(bin): add opt-in local Claude usage threshold warner
A usage window is exhausted without warning: work is cut off mid-run
rather than stopping deliberately, and nothing says a window is close to
its cap until it is already gone.
bin/fm-usage-warner.sh is a threshold warner, not a usage viewer.
quota-axi is already the one Claude-quota reader this repo depends on
(bin/fm-quota-axi-lib.sh), so the warner runs that existing read rather
than adding a second reader that could drift from it: one bounded
`quota-axi --provider claude --json --full --no-credential-refresh`, the
snapshot validated with fm_quota_json_valid, and the provider row picked
with the same FM_QUOTA_ROW_JQ join the dispatch consumers use, under
schema 5 and schema 6 alike.
Thresholds are `<window-id>:<percent>` directives in config/usage-warner,
naming quota-axi's own window ids (five_hour, seven_day, model:<name>)
rather than a second vocabulary, and compared against each window's own
percentUsed. Naming the window is the point: the session and weekly
windows exhaust at very different times, so a figure that does not say
which window is close misleads.
One read with two callers and no new schedule: `check` is what a human
runs on demand and what the watcher runs on its ordinary check-shim
cadence once `arm` registers state/usage-warner.check.sh through
bin/fm-check-register.sh. There is no daemon.
Warnings post through macOS Notification Center with the same osascript
call bin/fm-supervise-daemon.sh's wedge alarm makes, without sourcing or
coupling to that daemon's away-mode-specific config and rate limiting.
Delivery is edge-triggered against state/.usage-warner: a crossing warns
once, stays quiet while it holds, and re-arms when the window next reads
back below its threshold, the same standing-report contract
fm-mail-check.sh and fm-tool-update-check.sh already use.
bin/fm-procevent-quota.sh already reads the same snapshot, so docs name
the boundary rather than leaving two similar surfaces unexplained. That
source fires at most once, wakes firstmate with a durable check event,
and compares a provider's aggregate effectivePercentRemaining. This
warner is the standing, human-facing half: per-window, delivered to the
person through Notification Center, and self-re-arming. Neither replaces
the other and arming both is reasonable.
Opt-in is load-bearing and enforced in code. With no valid directive,
`check` returns before any read and `arm` refuses, so an unconfigured
home gains no behaviour change, no new failure mode, and no new hard
dependency at dispatch. Notification Center is macOS-only, so `arm`
refuses on other platforms instead of registering a check that could
never speak.
The warner only warns. It does not stop or pace dispatch, and its
coverage is exactly what quota-axi can see locally, so a plan or
organisation spend cap quota-axi does not report is not covered; the doc
says so rather than implying coverage it does not have.
The new test script carries no measured CI duration hint yet, so the
portable-serial lane balances it on the conservative default until the
hints are next refreshed from a green run, per docs/fm-test-portable-shards.md.
* no-mistakes(review): Key usage-warner de-dupe on window and threshold; fix docs
* no-mistakes(review): Keep absent-window crossings recorded; stub osascript in tests
* no-mistakes(document): Document absent-window de-dupe carry-forward in usage-warner header
* fix: correct Rex secondmate grouping and lifecycle (#7656)
* 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
* feat(opencode): add OpenCode 2 support with version-gated launch, plugins, 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 https://github.com/kunchenguid/firstmate/pull/5143.
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
* 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 https://github.com/kunchenguid/firstmate/pull/5143.
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
* 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 https://github.com/kunchenguid/firstmate/pull/5143.
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
* 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 <nniranc@gmail.com>
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(bin): add opt-in local Claude usage threshold warner
A usage window is exhausted without warning: work is cut off mid-run
rather than stopping deliberately, and nothing says a window is close to
its cap until it is already gone.
bin/fm-usage-warner.sh is a threshold warner, not a usage viewer.
quota-axi is already the one Claude-quota reader this repo depends on
(bin/fm-quota-axi-lib.sh), so the warner runs that existing read rather
than adding a second reader that could drift from it: one bounded
`quota-axi --provider claude --json --full --no-credential-refresh`, the
snapshot validated with fm_quota_json_valid, and the provider row picked
with the same FM_QUOTA_ROW_JQ join the dispatch consumers use, under
schema 5 and schema 6 alike.
Thresholds are `<window-id>:<percent>` directives in config/usage-warner,
naming quota-axi's own window ids (five_hour, seven_day, model:<name>)
rather than a second vocabulary, and compared against each window's own
percentUsed. Naming the window is the point: the session and weekly
windows exhaust at very different times, so a figure that does not say
which window is close misleads.
One read with two callers and no new schedule: `check` is what a human
runs on demand and what the watcher runs on its ordinary check-shim
cadence once `arm` registers state/usage-warner.check.sh through
bin/fm-check-register.sh. There is no daemon.
Warnings post through macOS Notification Center with the same osascript
call bin/fm-supervise-daemon.sh's wedge alarm makes, without sourcing or
coupling to that daemon's away-mode-specific config and rate limiting.
Delivery is edge-triggered against state/.usage-warner: a crossing warns
once, stays quiet while it holds, and re-arms when the window next reads
back below its threshold, the same standing-report contract
fm-mail-check.sh and fm-tool-update-check.sh already use.
bin/fm-procevent-quota.sh already reads the same snapshot, so docs name
the boundary rather than leaving two similar surfaces unexplained. That
source fires at most once, wakes firstmate with a durable check event,
and compares a provider's aggregate effectivePercentRemaining. This
warner is the standing, human-facing half: per-window, delivered to the
person through Notification Center, and self-re-arming. Neither replaces
the other and arming both is reasonable.
Opt-in is load-bearing and enforced in code. With no valid directive,
`check` returns before any read and `arm` refuses, so an unconfigured
home gains no behaviour change, no new failure mode, and no new hard
dependency at dispatch. Notification Center is macOS-only, so `arm`
refuses on other platforms instead of registering a check that could
never speak.
The warner only warns. It does not stop or pace dispatch, and its
coverage is exactly what quota-axi can see locally, so a plan or
organisation spend cap quota-axi does not report is not covered; the doc
says so rather than implying coverage it does not have.
The new test script carries no measured CI duration hint yet, so the
portable-serial lane balances it on the conservative default until the
hints are next refreshed from a green run, per docs/fm-test-portable-shards.md.
* no-mistakes(review): Key usage-warner de-dupe on window and threshold; fix docs
* no-mistakes(review): Keep absent-window crossings recorded; stub osascript in tests
* no-mistakes(document): Document absent-window de-dupe carry-forward in usage-warner header
* no-mistakes(review): Serialize usage-warner check, dedupe directives, drop vacuous greps
* no-mistakes(document): List usage-warner check lock in state layout
---------
Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>
Co-authored-by: Kostadin Pop-Kochev <kostadin.popkocev@gmail.com>
Co-authored-by: Niranjan <nniranc@gmail.com>
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(bin): stabilize remote worker process identity (#6440)
* fix(bin): use clock-stable /proc starttime for remote job worker ownership
Linux remote job ownership compared ps lstart, which drifts on WSL2 while
/proc starttime stays fixed, so ensure treated a healthy worker as dead and
started another supervisor on every call. fm_remote_job_process_start now emits
a proc-starttime token when /proc is readable and falls back to ps lstart
otherwise. The Linux start path hands a live worker of the configured root
whose lock still records a legacy start over to one replacement, checked
against the recorded and live command so no unrelated pid is signaled.
Fixes #2921
* no-mistakes(review): Treat legacy lstart claim starts as indeterminate, not mismatched
* no-mistakes(test): Assert legacy handoff interrupts job once
* no-mistakes(test): Remove scratch debug test; legacy job case git-tracked
* no-mistakes(test): Revert legacy start comparator; simplify legacy handoff test
* fix(bin): drop automatic legacy worker upgrade; document manual one-time restart
* chore: remove stray file
* no-mistakes(document): Drop stale handoff mention from remote worker docs
* fix(bin): verify pre-update remote job workers via legacy lstart
When a recorded start lacks the proc-starttime= prefix, compare it against
ps -o lstart= without LC_ALL=C so a healthy pre-update worker still verifies.
The ordinary code-identity path then replaces it once instead of piling
supervisors. Add regression coverage for the bare-lstart cookie and the
lock upgrade path.
* no-mistakes(document): Clarify legacy remote-job start verification docs
* no-mistakes(review): Preserve C-locale legacy cookie verification, captain
* no-mistakes(document): Clarify legacy process identity cookie compatibility
* no-mistakes(lint): Replace deprecated fgrep with lint-compliant grep -F
---------
Co-authored-by: Pitch Perfekt Collective <pitchperfekt@Pitchs-Mac-Studio.local>
Co-authored-by: mehulbhagwani <270960355+mehulbhagwani@users.noreply.github.com>
* feat(bin): add persistent managed-approval failover for Codex and Claude (#6722)
* fix: use managed-compatible worker approval modes
* no-mistakes(document): update codex and claude worker approval mode docs
* no-mistakes(ci): Fixed two test files that weren't updated when the PR changed the default claude permission mode from `--dangerously-skip-permissions` (bypass) to `--permission-mode auto`. Changes: - `tests/fm-claude-trust.test.sh` lines 664 and 696: updated two `assert_grep` assertions from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` - `tests/fm-backend-orca.test.sh` line 568: updated one `assert_contains` assertion from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` Both tests now pass locally (orca: exit=0, backend-dispatch/claude-trust: exit=0)
* fix: remove stray scratch directories from tests/
tests/.tmp-managed-approvals-test.bBuGhY/ and tests/.tmp-managed-approvals2.exz2qr/
were accidentally committed as worktree-local scratch dirs and do not belong in the repo.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: preserve bypass defaults with persistent managed approval failover
* no-mistakes(review): fix approve-for-me fixture and bypass diagnostic messages
* no-mistakes(review): restore absent-Claude-default test and fix pass messages
* fix: recognize managed Codex approval prompts in the C locale
* no-mistakes(review): Fix managed approval failover bounds, authorization, inheritance, and capture
* Simplify managed approval recovery to persistent explicit failover
* no-mistakes(review): Guard failover authorization and unlink staging before recovery
* no-mistakes(document): Correct managed approval documentation and consolidate owner references
* no-mistakes(document): Correct managed-approval references and stale hook guarantees
* fix: require approval and inherit managed modes from primary
* no-mistakes(document): Clarify live hook verification scope
* no-mistakes(review): Remove dead approval_configured key from relaunch metadata
* fix: resurface queued wakes from handling successors (#7466)
* 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 <calebl@users.noreply.github.com>
* fix(bin): preserve accents in pending-reply summaries (#7618)
* 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 <alexandre.custodio@soraschools.com>
* feat: add OpenRouter support for typed dispatch resolution (#7149)
* 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
* feat(bin): publish lane capacity facts with beat pressure and keyed limits (#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): propagate contribution input assembly failures (#5359)
* 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: correct Rex secondmate grouping and lifecycle (#7656)
* 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
* feat(opencode): add OpenCode 2 support with version-gated launch, plugins, 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 https://github.com/kunchenguid/firstmate/pull/5143.
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
* 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 https://github.com/kunchenguid/firstmate/pull/5143.
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
* 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 https://github.com/kunchenguid/firstmate/pull/5143.
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
* 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 <nniranc@gmail.com>
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(bin): resolve the tmux container from firstmate's own session, not the most recent group member (#7662)
* fix(bin): resolve the tmux container from the caller's own session, not the most recent group member
* no-mistakes(test): Fall back when the $TMUX session id is stale
* no-mistakes(document): Document tmux container choice under grouped sessions
* fix(bin): read a fully dim Cursor idle placeholder as an empty composer (#7647)
* fix(bin): read a fully dim Cursor placeholder as an empty composer
cursor-agent 2026.10.19 draws the composer glyph and its idle placeholder
as one SGR 2 run with no reverse-video cell, so ghost stripping empties the
row and the empty-content guard returned unknown. Relaunch and exit then
refused on every idle Cursor pane on tmux.
When a styled bare row strips to empty and the plain row is an agent glyph
followed by an anchored idle placeholder, read it empty. Bright typed text,
other dim text, and unstyled rows keep their existing verdicts.
Fixes #7413
* docs(verification): record the fully dim Cursor placeholder verdict and refresh command
* fix(bin): say why away-mode inject deferred and pin named Claude idle composer as empty (#6163)
* fix(bin): recognize a named Claude session's titled composer rule on cursorless backends
`claude -n <name>` right-aligns the session name in the rule above the
composer. Cursorless backends (Herdr) accepted only solid rules, so the
scan saw the lower rule alone, the idle composer read `unknown`, and
away-mode delivery to a named Claude primary deferred until return.
A rule carrying one right-aligned title now opens a separator pair. It
never closes one, the pair it opens counts only over an agent-glyph row,
and it is never a valid Pi pair, so Pi's verdict is unchanged.
The away-mode composer deferral now names which refusal it was:
unsubmitted text, or no composer shape recognized.
* no-mistakes(review): Reword composer deferral reason to cover busy harness
* no-mistakes(ci): ci-3 (Greptile, user chose to fix): The rule that must always hold is that Claude's titled opening rule is accepted for any non-empty session name that doesn't start with a space and doesn't contain the rule glyph `─`, including a multiword name. The only place that check lives is the title `case` in `_fm_composer_titled_rule_row` (bin/fm-composer-lib.sh). It now reads `case "$title" in ''|' '*|*─*) return 1 ;; esac`, as the user asked, and the comment above the function mentions multiword titles. I added regression fixtures to `test_matrix_claude_named_session_titled_rule` in tests/fm-composer-lib.test.sh, next to the existing single-word `Andrew` cases. They use the title `Andrew Chen` and check that an idle composer on herdr reads `empty` and a composer with typed text reads `pending`. Something you should know: the old pattern already accepted a title with a space in the middle. It only rejected a title ending in a space. So the new multiword fixtures also pass against the old code, and the bot's failure scenario did not actually happen for "Andrew Chen". What the fix really changes is that it drops the trailing-space rejection, as instructed. Checks run: tests/fm-composer-lib.test.sh and tests/fm-composer-ghost.test.sh both pass (exit 0, no failures), and `shellcheck -x` is clean on both changed files
* no-mistakes(review): Match unnamed-ghost fixture rule width to the partner rule
* fix: use managed-compatible worker approval modes
* no-mistakes(document): update codex and claude worker approval mode docs
* no-mistakes(ci): Fixed two test files that weren't updated when the PR changed the default claude permission mode from `--dangerously-skip-permissions` (bypass) to `--permission-mode auto`. Changes: - `tests/fm-claude-trust.test.sh` lines 664 and 696: updated two `assert_grep` assertions from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` - `tests/fm-backend-orca.test.sh` line 568: updated one `assert_contains` assertion from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` Both tests now pass locally (orca: exit=0, backend-dispatch/claude-trust: exit=0)
* fix: remove stray scratch directories from tests/
tests/.tmp-managed-approvals-test.bBuGhY/ and tests/.tmp-managed-approvals2.exz2qr/
were accidentally committed as worktree-local scratch dirs and do not belong in the repo.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: preserve bypass defaults with persistent managed approval failover
* no-mistakes(review): fix approve-for-me fixture and bypass diagnostic messages
* no-mistakes(review): restore absent-Claude-default test and fix pass messages
* fix: recognize managed Codex approval prompts in the C locale
* no-mistakes(review): Fix managed approval failover bounds, authorization, inheritance, and capture
* Simplify managed approval recovery to persistent explicit failover
* no-mistakes(review): Guard failover authorization and unlink staging before recovery
* no-mistakes(document): Correct managed approval documentation and consolidate owner references
* no-mistakes(document): Correct managed-approval references and stale hook guarantees
* fix: require approval and inherit managed modes from primary
* no-mistakes(document): Clarify live hook verification scope
* no-mistakes(review): Remove dead approval_configured key from relaunch metadata
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Caleb LeNoir <caleb.lenoir@constructease.com>
Co-authored-by: Caleb LeNoir <calebl@users.noreply.github.com>
Co-authored-by: Alexandre Custodio <xandy.alexandrec@gmail.com>
Co-authored-by: Alexandre Custodio <alexandre.custodio@soraschools.com>
Co-authored-by: Pedro Guimarães <21346846+0x7067@users.noreply.github.com>
Co-authored-by: Konner Moshier <39997550+Moshik21@users.noreply.github.com>
Co-authored-by: Oscar Santis Brante <49914973+osantis@users.noreply.github.com>
Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com>
Co-authored-by: Kostadin Pop-Kochev <kostadin.popkocev@gmail.com>
Co-authored-by: Niranjan <nniranc@gmail.com>
Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com>
Co-authored-by: Tomas Perez <71987424+tomasperezcoscia@users.noreply.github.com>
Co-authored-by: Cameron Aragon <69489633+camaragon@users.noreply.github.com>
Co-authored-by: Brian <bthome@users.noreply.github.com>
* fix(bin): keep handling successors from stranding inbox wakes after counter loss (#6467)
* fix: notify handling successors about newer inbox wakes
* no-mistakes(document): Document handling-successor inbox regression in watcher coverage list
* no-mistakes(ci): Fixed Greptile P1 (comment 4172295712): a handling successor could miss a new inbox wake when `.wake-queue.seq` was missing or malformed. What must always hold: a row added after the successor took its snapshot must be announced and must never be consumed by an older acknowledgement. Two places were breaking this: 1. `bin/fm-watch.sh`: the successor only recorded the highest inherited sequence number. If the counter was reset, a new row could get a number at or below that and be treated as already covered. This now stays silent forever once the inherited rows are acknowledged and the queue drains. 2. `bin/fm-wake-lib.sh` `fm_wake_append_locked`: a reset counter reused the sequence number of a row still in the queue. The predecessor's pending `--ack-through` consumes rows by sequence number, so it deleted the new row before anyone handled it. This was a gap in the existing allocator, and it is what made the before-ack cases fail even after fix 1. Fixes: - Watcher: the successor now snapshots the inherited rows themselves instead of their highest sequence. On each poll it announces if any queued row is not in that snapshot. It still never consumes rows, and inherited rows alone stay silent. - Allocator: the next sequence is now one more than the larger of the counter and the highest sequence still queued, so a new row can't land inside an outstanding acknowledgement's range. - `docs/watcher-continuity.md`: the paragraph and coverage list are updated to match. Tests: `test_append_wakes_handling_successor` in `tests/fm-watch-arm.test.sh` now inherits two rows and takes a counter state (intact, missing, malformed). The four new cases are after-ack and before-ack with a missing or malformed counter, and they run real watcher, arm and drain processes. In after-ack the queue is fully drained before the new append. Evidence: - Before any production change (on 92c724d), all four new cases failed: "not ok - handling successor stranded the second inbox wake" for after-ack and before-ack. - With only the watcher fix, the after-ack cases passed and the before-ack cases still failed, which shows the allocator fix is needed. - With both fixes, all four pass. Full results: `fm-watch-arm` 36/36 (including the intact after-ack and before-ack cases, so ordinary silence and fresh-beacon delivery still hold), `fm-watch-recovery-loop` 2/2, `fm-inbox` 16/16, `fm-pi-watch-extension` 60/60, `fm-wake-queue` 67/67, and all four `fm-wake-drain-*` suites passed (9, 9, 18, 14). Canonical `bin/fm-lint.sh` with `PATH=/home/nino/.local/bin:$PATH` passed: ShellCheck clean, actionlint 1.7.12, 3 workflows valid. That lint run was in local changed-file mode with ShellCheck source following disabled. In a first run of all nine suites in parallel, `fm-wake-queue` failed on "presentation lock delayed the drain for 10s" and one `fm-pi-watch-extension` timing test failed. Both passed in full when rerun on their own, so I read that as load contention, not this change. Design decision to flag: the allocator change sits in the shared wake library, so it goes beyond the watcher comparison the bot pointed at. It is a one-expression change, and the before-ack tests can't pass without it, because otherwise the predecessor's acknowledgement deletes the new message. Not done, per the phase boundary: nothing committed, pushed or posted, and the live fleet was not touched. Evidence logs are in /tmp/fmci, not in a pipeline logs/evidence directory
* no-mistakes(ci): Fixed both Greptile findings on PR #6467. Nothing was committed, pushed or posted, and the live fleet was not touched. **ci-1 (4172409813): a new wake was mistaken for an inherited one.** - Invariant that must hold: a successor treats a row as covered only if it is an unchanged inherited row in the inherited recovery episode. - Cause: after the predecessor's acknowledgement and a lost counter, a re-append with the same kind, key, payload and epoch was byte-identical to the snapshot row, so the successor stayed silent. - Fix (`bin/fm-watch.sh`): I used the existing recovery generation rather than a new identity scheme. Any append after an acknowledgement mints a new generation. The successor records the generation with its row snapshot, under the queue lock and in arm-check's lock order. Each poll counts the queue as newer if a row is not in the snapshot, or if the queue is non-empty and the generation changed. The existing arm-check then decides whether to announce. No rows are consumed, and inherited rows alone stay silent. - The row snapshot is still needed for before-ack, because an append before the acknowledgement keeps the same generation. **ci-2 (4172409821): large sequence numbers became unusable.** - Invariant that must hold: sequence numbers are always exact digit-only decimals. - Fix (`bin/fm-wake-lib.sh`): the allocator picks the largest of the counter and the queued sequences by comparing decimal text (length, then string order, leading zeros stripped), then adds 1 in bash with `$((10#$seq + 1))`. This restores the 64-bit exactness of the original bash counter. - Same fix at two places in `bin/fm-wake-drain.sh` that print sequences: `presented_max_row` and `ACK_THROUGH` print the matched text instead of `max + 0`. **Tests** - `tests/fm-watch-arm.test.sh`: two new `identical` cases, after-ack with a missing and with a malformed counter. A fake `date` pins the epoch, and the test asserts the row is byte-identical, then checks timely notification, preservation until its own acknowledgement, and no repeat notification. - `tests/fm-wake-queue.test.sh`: new `test_large_sequences_stay_exact_decimal_identifiers` starts from 2147483647, 9007199254740991 and 9223372036854775806, each with an intact, missing and malformed counter. It checks the next sequence is exact and digit-only. For the first two it also checks a real drain shows both rows, names the exact acknowledgement sequence, and acknowledging empties the queue. - `docs/watcher-continuity.md` now describes the generation check. **Evidence** (in `/home/nino/.no-mistakes/evidence/01M40CDTX2000A5TFFRZN27YFR/ci-round3/`) - Before, on 050a5fc: both identical cases failed with "handling successor stranded the second inbox wake (after-ack)". The large-sequence test failed with "advanced to '9223372036854775808', not 9223372036854775807". - After the fix, all three pass (`after-*.log`). - All nine suites passed, each run on its own, all with 0 not ok (`final-results.txt`): `fm-wake-queue` 68/68, `fm-watch-arm` 38/38, `fm-watch-recovery-loop` 2/2, `fm-inbox` 16/16, `fm-pi-watch-extension` 60/60, `fm-wake-drain-open-decisions-cursor` 9/9, `fm-wake-drain-open-decisions` 9/9, `fm-wake-drain-outcome-backstop` 18/18, `fm-wake-drain-unread-status` 14/14. - `bin/fm-lint.sh` with `PATH=/home/nino/.local/bin:$PATH` passes: ShellCheck clean, actionlint 1.7.12, 3 workflows valid (local changed-file mode). **Not run** - The only OpenCode suite is an opt-in live test, so I did not run it. **Limits** - The 2.14748e+09 symptom doesn't reproduce with the awks here (gawk, mawk 1.3.4, busybox). The failure reproduced locally is the precision loss at 64-bit values. - The drain's awk comparisons are only exact up to 2^53. That predates this PR and I left it alone, so the drain test stops at 2^53
* no-mistakes(document): Reattach successor poll-loop sentence to its subject
* fix(bin): stop lock waits and test fixtures from spinning after their directory is removed (#7685)
* fix(tests): bound lock waits on removed dirs and reap fixture-root processes
A lock wait spun every 0.1s forever once its directory was removed, so a
watcher or reconcile scan of a deleted test home never reached its own
home-gone exit. fm_lock_acquire_wait now returns within 0.2s once the
lock's parent directory is gone.
Test teardown now signals every process naming the exact fixture root
(TERM, then KILL) before removing it, in both fm_test_cleanup and the
orphan sweep. The supervision-host fake harness sessions stop once their
home is gone or the suite pid has died, so a hard-killed runner no longer
leaves them polling under init.
Fixes #7672
* fix(tests): bound the session-lock concurrency barrier
Forty workers polled a find pipeline every 0.01s to wait for each other,
so the barrier alone launched thousands of processes a second, and once a
stopped run removed the barrier directory the workers polled forever under
init. Count entries with a builtin glob every 0.05s, and end the wait once
the directory is gone, the suite has died, or the stub block bound passes.
Refs #7672
* fix: watch review-bot findings on owned pull requests (#7499)
* fix(bin): admit listed review-bot comments as contribution signals
* no-mistakes(review): Persist review-bot config in contribution check shim
* no-mistakes(review): Classify allowlisted collaborators as review bots
* no-mistakes(document): Document review-bot contribution signals
* no-mistakes(review): Preserve review-bot config and re-raise classification
* no-mistakes(review): Prevent acknowledged bot signals replaying after allowlist changes
* no-mistakes(document): Document configurable review-bot contribution watching
* no-mistakes(document): Clarify review-bot thread documentation
* fix(bin): make review-bot contribution watching opt-in
* docs(bin): state review-bot allowlist has no built-in default
* no-mistakes(document): Document per-home review-bot configuration
---------
Co-authored-by: Caleb LeNoir <calebl@users.noreply.github.com>
* fix(brief): drop undefined heavy-test slot from the Waiting section (#7674)
The generated Waiting section told workers to wait on a heavy-test slot that nothing in the repository defines. Remove the phrase and assert that a brief generated with config/wait-no-turns does not name one.
* fix(bin): read the no_ci ci-monitor marker as no-checks (#7675)
* fix(bin): read the no_ci ci-monitor marker as no-checks instead of validating
Fixes #7644
* no-mistakes(document): Rewrap nm_ci_checks_state no_ci comment
* feat(bin): add opt-in restricted permission mode for Codex workers (#7683)
* feat: add opt-in restricted permissions for Codex workers
* no-mistakes(review): Document restricted Codex network and git approval limits
* fix(test): keep serial packing at-budget fixture stable with unhinted scripts (#7699)
* fix(test): keep serial packing at-budget when a script has no hint
tests/fm-approval-failover.test.sh landed without a serial duration hint,
so the at-budget packing fixture overflowed by 1040ms. Record a measured
5410ms hint and give the fixture its own complete hint table so unmeasured
defaults cannot join the boundary shard.
Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com>
* docs: note the local approval-failover packing hint
Record the 5410 ms provisional local sample for the next CI refresh,
and describe the packi…
…cts (#57) * feat(bin): add opt-in local Claude usage threshold warner (#7421) * feat(bin): add opt-in local Claude usage threshold warner A usage window is exhausted without warning: work is cut off mid-run rather than stopping deliberately, and nothing says a window is close to its cap until it is already gone. bin/fm-usage-warner.sh is a threshold warner, not a usage viewer. quota-axi is already the one Claude-quota reader this repo depends on (bin/fm-quota-axi-lib.sh), so the warner runs that existing read rather than adding a second reader that could drift from it: one bounded `quota-axi --provider claude --json --full --no-credential-refresh`, the snapshot validated with fm_quota_json_valid, and the provider row picked with the same FM_QUOTA_ROW_JQ join the dispatch consumers use, under schema 5 and schema 6 alike. Thresholds are `<window-id>:<percent>` directives in config/usage-warner, naming quota-axi's own window ids (five_hour, seven_day, model:<name>) rather than a second vocabulary, and compared against each window's own percentUsed. Naming the window is the point: the session and weekly windows exhaust at very different times, so a figure that does not say which window is close misleads. One read with two callers and no new schedule: `check` is what a human runs on demand and what the watcher runs on its ordinary check-shim cadence once `arm` registers state/usage-warner.check.sh through bin/fm-check-register.sh. There is no daemon. Warnings post through macOS Notification Center with the same osascript call bin/fm-supervise-daemon.sh's wedge alarm makes, without sourcing or coupling to that daemon's away-mode-specific config and rate limiting. Delivery is edge-triggered against state/.usage-warner: a crossing warns once, stays quiet while it holds, and re-arms when the window next reads back below its threshold, the same standing-report contract fm-mail-check.sh and fm-tool-update-check.sh already use. bin/fm-procevent-quota.sh already reads the same snapshot, so docs name the boundary rather than leaving two similar surfaces unexplained. That source fires at most once, wakes firstmate with a durable check event, and compares a provider's aggregate effectivePercentRemaining. This warner is the standing, human-facing half: per-window, delivered to the person through Notification Center, and self-re-arming. Neither replaces the other and arming both is reasonable. Opt-in is load-bearing and enforced in code. With no valid directive, `check` returns before any read and `arm` refuses, so an unconfigured home gains no behaviour change, no new failure mode, and no new hard dependency at dispatch. Notification Center is macOS-only, so `arm` refuses on other platforms instead of registering a check that could never speak. The warner only warns. It does not stop or pace dispatch, and its coverage is exactly what quota-axi can see locally, so a plan or organisation spend cap quota-axi does not report is not covered; the doc says so rather than implying coverage it does not have. The new test script carries no measured CI duration hint yet, so the portable-serial lane balances it on the conservative default until the hints are next refreshed from a green run, per docs/fm-test-portable-shards.md. * no-mistakes(review): Key usage-warner de-dupe on window and threshold; fix docs * no-mistakes(review): Keep absent-window crossings recorded; stub osascript in tests * no-mistakes(document): Document absent-window de-dupe carry-forward in usage-warner header * fix: correct Rex secondmate grouping and lifecycle (#7656) * 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 * feat(opencode): add OpenCode 2 support with version-gated launch, plugins, 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 https://github.com/kunchenguid/firstmate/pull/5143. Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com> * 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 https://github.com/kunchenguid/firstmate/pull/5143. Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com> * 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 https://github.com/kunchenguid/firstmate/pull/5143. Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com> * 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 <nniranc@gmail.com> Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * feat(bin): add opt-in local Claude usage threshold warner A usage window is exhausted without warning: work is cut off mid-run rather than stopping deliberately, and nothing says a window is close to its cap until it is already gone. bin/fm-usage-warner.sh is a threshold warner, not a usage viewer. quota-axi is already the one Claude-quota reader this repo depends on (bin/fm-quota-axi-lib.sh), so the warner runs that existing read rather than adding a second reader that could drift from it: one bounded `quota-axi --provider claude --json --full --no-credential-refresh`, the snapshot validated with fm_quota_json_valid, and the provider row picked with the same FM_QUOTA_ROW_JQ join the dispatch consumers use, under schema 5 and schema 6 alike. Thresholds are `<window-id>:<percent>` directives in config/usage-warner, naming quota-axi's own window ids (five_hour, seven_day, model:<name>) rather than a second vocabulary, and compared against each window's own percentUsed. Naming the window is the point: the session and weekly windows exhaust at very different times, so a figure that does not say which window is close misleads. One read with two callers and no new schedule: `check` is what a human runs on demand and what the watcher runs on its ordinary check-shim cadence once `arm` registers state/usage-warner.check.sh through bin/fm-check-register.sh. There is no daemon. Warnings post through macOS Notification Center with the same osascript call bin/fm-supervise-daemon.sh's wedge alarm makes, without sourcing or coupling to that daemon's away-mode-specific config and rate limiting. Delivery is edge-triggered against state/.usage-warner: a crossing warns once, stays quiet while it holds, and re-arms when the window next reads back below its threshold, the same standing-report contract fm-mail-check.sh and fm-tool-update-check.sh already use. bin/fm-procevent-quota.sh already reads the same snapshot, so docs name the boundary rather than leaving two similar surfaces unexplained. That source fires at most once, wakes firstmate with a durable check event, and compares a provider's aggregate effectivePercentRemaining. This warner is the standing, human-facing half: per-window, delivered to the person through Notification Center, and self-re-arming. Neither replaces the other and arming both is reasonable. Opt-in is load-bearing and enforced in code. With no valid directive, `check` returns before any read and `arm` refuses, so an unconfigured home gains no behaviour change, no new failure mode, and no new hard dependency at dispatch. Notification Center is macOS-only, so `arm` refuses on other platforms instead of registering a check that could never speak. The warner only warns. It does not stop or pace dispatch, and its coverage is exactly what quota-axi can see locally, so a plan or organisation spend cap quota-axi does not report is not covered; the doc says so rather than implying coverage it does not have. The new test script carries no measured CI duration hint yet, so the portable-serial lane balances it on the conservative default until the hints are next refreshed from a green run, per docs/fm-test-portable-shards.md. * no-mistakes(review): Key usage-warner de-dupe on window and threshold; fix docs * no-mistakes(review): Keep absent-window crossings recorded; stub osascript in tests * no-mistakes(document): Document absent-window de-dupe carry-forward in usage-warner header * no-mistakes(review): Serialize usage-warner check, dedupe directives, drop vacuous greps * no-mistakes(document): List usage-warner check lock in state layout --------- Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com> Co-authored-by: Kostadin Pop-Kochev <kostadin.popkocev@gmail.com> Co-authored-by: Niranjan <nniranc@gmail.com> Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * fix(bin): stabilize remote worker process identity (#6440) * fix(bin): use clock-stable /proc starttime for remote job worker ownership Linux remote job ownership compared ps lstart, which drifts on WSL2 while /proc starttime stays fixed, so ensure treated a healthy worker as dead and started another supervisor on every call. fm_remote_job_process_start now emits a proc-starttime token when /proc is readable and falls back to ps lstart otherwise. The Linux start path hands a live worker of the configured root whose lock still records a legacy start over to one replacement, checked against the recorded and live command so no unrelated pid is signaled. Fixes #2921 * no-mistakes(review): Treat legacy lstart claim starts as indeterminate, not mismatched * no-mistakes(test): Assert legacy handoff interrupts job once * no-mistakes(test): Remove scratch debug test; legacy job case git-tracked * no-mistakes(test): Revert legacy start comparator; simplify legacy handoff test * fix(bin): drop automatic legacy worker upgrade; document manual one-time restart * chore: remove stray file * no-mistakes(document): Drop stale handoff mention from remote worker docs * fix(bin): verify pre-update remote job workers via legacy lstart When a recorded start lacks the proc-starttime= prefix, compare it against ps -o lstart= without LC_ALL=C so a healthy pre-update worker still verifies. The ordinary code-identity path then replaces it once instead of piling supervisors. Add regression coverage for the bare-lstart cookie and the lock upgrade path. * no-mistakes(document): Clarify legacy remote-job start verification docs * no-mistakes(review): Preserve C-locale legacy cookie verification, captain * no-mistakes(document): Clarify legacy process identity cookie compatibility * no-mistakes(lint): Replace deprecated fgrep with lint-compliant grep -F --------- Co-authored-by: Pitch Perfekt Collective <pitchperfekt@Pitchs-Mac-Studio.local> Co-authored-by: mehulbhagwani <270960355+mehulbhagwani@users.noreply.github.com> * feat(bin): add persistent managed-approval failover for Codex and Claude (#6722) * fix: use managed-compatible worker approval modes * no-mistakes(document): update codex and claude worker approval mode docs * no-mistakes(ci): Fixed two test files that weren't updated when the PR changed the default claude permission mode from `--dangerously-skip-permissions` (bypass) to `--permission-mode auto`. Changes: - `tests/fm-claude-trust.test.sh` lines 664 and 696: updated two `assert_grep` assertions from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` - `tests/fm-backend-orca.test.sh` line 568: updated one `assert_contains` assertion from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` Both tests now pass locally (orca: exit=0, backend-dispatch/claude-trust: exit=0) * fix: remove stray scratch directories from tests/ tests/.tmp-managed-approvals-test.bBuGhY/ and tests/.tmp-managed-approvals2.exz2qr/ were accidentally committed as worktree-local scratch dirs and do not belong in the repo. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: preserve bypass defaults with persistent managed approval failover * no-mistakes(review): fix approve-for-me fixture and bypass diagnostic messages * no-mistakes(review): restore absent-Claude-default test and fix pass messages * fix: recognize managed Codex approval prompts in the C locale * no-mistakes(review): Fix managed approval failover bounds, authorization, inheritance, and capture * Simplify managed approval recovery to persistent explicit failover * no-mistakes(review): Guard failover authorization and unlink staging before recovery * no-mistakes(document): Correct managed approval documentation and consolidate owner references * no-mistakes(document): Correct managed-approval references and stale hook guarantees * fix: require approval and inherit managed modes from primary * no-mistakes(document): Clarify live hook verification scope * no-mistakes(review): Remove dead approval_configured key from relaunch metadata * fix: resurface queued wakes from handling successors (#7466) * 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 <calebl@users.noreply.github.com> * fix(bin): preserve accents in pending-reply summaries (#7618) * 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 <alexandre.custodio@soraschools.com> * feat: add OpenRouter support for typed dispatch resolution (#7149) * 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 * feat(bin): publish lane capacity facts with beat pressure and keyed limits (#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): propagate contribution input assembly failures (#5359) * 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: correct Rex secondmate grouping and lifecycle (#7656) * 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 * feat(opencode): add OpenCode 2 support with version-gated launch, plugins, 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 https://github.com/kunchenguid/firstmate/pull/5143. Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com> * 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 https://github.com/kunchenguid/firstmate/pull/5143. Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com> * 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 https://github.com/kunchenguid/firstmate/pull/5143. Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com> * 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 <nniranc@gmail.com> Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * fix(bin): resolve the tmux container from firstmate's own session, not the most recent group member (#7662) * fix(bin): resolve the tmux container from the caller's own session, not the most recent group member * no-mistakes(test): Fall back when the $TMUX session id is stale * no-mistakes(document): Document tmux container choice under grouped sessions * fix(bin): read a fully dim Cursor idle placeholder as an empty composer (#7647) * fix(bin): read a fully dim Cursor placeholder as an empty composer cursor-agent 2026.10.19 draws the composer glyph and its idle placeholder as one SGR 2 run with no reverse-video cell, so ghost stripping empties the row and the empty-content guard returned unknown. Relaunch and exit then refused on every idle Cursor pane on tmux. When a styled bare row strips to empty and the plain row is an agent glyph followed by an anchored idle placeholder, read it empty. Bright typed text, other dim text, and unstyled rows keep their existing verdicts. Fixes #7413 * docs(verification): record the fully dim Cursor placeholder verdict and refresh command * fix(bin): say why away-mode inject deferred and pin named Claude idle composer as empty (#6163) * fix(bin): recognize a named Claude session's titled composer rule on cursorless backends `claude -n <name>` right-aligns the session name in the rule above the composer. Cursorless backends (Herdr) accepted only solid rules, so the scan saw the lower rule alone, the idle composer read `unknown`, and away-mode delivery to a named Claude primary deferred until return. A rule carrying one right-aligned title now opens a separator pair. It never closes one, the pair it opens counts only over an agent-glyph row, and it is never a valid Pi pair, so Pi's verdict is unchanged. The away-mode composer deferral now names which refusal it was: unsubmitted text, or no composer shape recognized. * no-mistakes(review): Reword composer deferral reason to cover busy harness * no-mistakes(ci): ci-3 (Greptile, user chose to fix): The rule that must always hold is that Claude's titled opening rule is accepted for any non-empty session name that doesn't start with a space and doesn't contain the rule glyph `─`, including a multiword name. The only place that check lives is the title `case` in `_fm_composer_titled_rule_row` (bin/fm-composer-lib.sh). It now reads `case "$title" in ''|' '*|*─*) return 1 ;; esac`, as the user asked, and the comment above the function mentions multiword titles. I added regression fixtures to `test_matrix_claude_named_session_titled_rule` in tests/fm-composer-lib.test.sh, next to the existing single-word `Andrew` cases. They use the title `Andrew Chen` and check that an idle composer on herdr reads `empty` and a composer with typed text reads `pending`. Something you should know: the old pattern already accepted a title with a space in the middle. It only rejected a title ending in a space. So the new multiword fixtures also pass against the old code, and the bot's failure scenario did not actually happen for "Andrew Chen". What the fix really changes is that it drops the trailing-space rejection, as instructed. Checks run: tests/fm-composer-lib.test.sh and tests/fm-composer-ghost.test.sh both pass (exit 0, no failures), and `shellcheck -x` is clean on both changed files * no-mistakes(review): Match unnamed-ghost fixture rule width to the partner rule * fix: use managed-compatible worker approval modes * no-mistakes(document): update codex and claude worker approval mode docs * no-mistakes(ci): Fixed two test files that weren't updated when the PR changed the default claude permission mode from `--dangerously-skip-permissions` (bypass) to `--permission-mode auto`. Changes: - `tests/fm-claude-trust.test.sh` lines 664 and 696: updated two `assert_grep` assertions from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` - `tests/fm-backend-orca.test.sh` line 568: updated one `assert_contains` assertion from `claude --dangerously-skip-permissions` → `claude --permission-mode auto` Both tests now pass locally (orca: exit=0, backend-dispatch/claude-trust: exit=0) * fix: remove stray scratch directories from tests/ tests/.tmp-managed-approvals-test.bBuGhY/ and tests/.tmp-managed-approvals2.exz2qr/ were accidentally committed as worktree-local scratch dirs and do not belong in the repo. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: preserve bypass defaults with persistent managed approval failover * no-mistakes(review): fix approve-for-me fixture and bypass diagnostic messages * no-mistakes(review): restore absent-Claude-default test and fix pass messages * fix: recognize managed Codex approval prompts in the C locale * no-mistakes(review): Fix managed approval failover bounds, authorization, inheritance, and capture * Simplify managed approval recovery to persistent explicit failover * no-mistakes(review): Guard failover authorization and unlink staging before recovery * no-mistakes(document): Correct managed approval documentation and consolidate owner references * no-mistakes(document): Correct managed-approval references and stale hook guarantees * fix: require approval and inherit managed modes from primary * no-mistakes(document): Clarify live hook verification scope * no-mistakes(review): Remove dead approval_configured key from relaunch metadata --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Caleb LeNoir <caleb.lenoir@constructease.com> Co-authored-by: Caleb LeNoir <calebl@users.noreply.github.com> Co-authored-by: Alexandre Custodio <xandy.alexandrec@gmail.com> Co-authored-by: Alexandre Custodio <alexandre.custodio@soraschools.com> Co-authored-by: Pedro Guimarães <21346846+0x7067@users.noreply.github.com> Co-authored-by: Konner Moshier <39997550+Moshik21@users.noreply.github.com> Co-authored-by: Oscar Santis Brante <49914973+osantis@users.noreply.github.com> Co-authored-by: Kun Chen <3233006+kunchenguid@users.noreply.github.com> Co-authored-by: Kostadin Pop-Kochev <kostadin.popkocev@gmail.com> Co-authored-by: Niranjan <nniranc@gmail.com> Co-authored-by: Girik Bajaj <bajajgirik2010@gmail.com> Co-authored-by: Tomas Perez <71987424+tomasperezcoscia@users.noreply.github.com> Co-authored-by: Cameron Aragon <69489633+camaragon@users.noreply.github.com> Co-authored-by: Brian <bthome@users.noreply.github.com> * fix(bin): keep handling successors from stranding inbox wakes after counter loss (#6467) * fix: notify handling successors about newer inbox wakes * no-mistakes(document): Document handling-successor inbox regression in watcher coverage list * no-mistakes(ci): Fixed Greptile P1 (comment 4172295712): a handling successor could miss a new inbox wake when `.wake-queue.seq` was missing or malformed. What must always hold: a row added after the successor took its snapshot must be announced and must never be consumed by an older acknowledgement. Two places were breaking this: 1. `bin/fm-watch.sh`: the successor only recorded the highest inherited sequence number. If the counter was reset, a new row could get a number at or below that and be treated as already covered. This now stays silent forever once the inherited rows are acknowledged and the queue drains. 2. `bin/fm-wake-lib.sh` `fm_wake_append_locked`: a reset counter reused the sequence number of a row still in the queue. The predecessor's pending `--ack-through` consumes rows by sequence number, so it deleted the new row before anyone handled it. This was a gap in the existing allocator, and it is what made the before-ack cases fail even after fix 1. Fixes: - Watcher: the successor now snapshots the inherited rows themselves instead of their highest sequence. On each poll it announces if any queued row is not in that snapshot. It still never consumes rows, and inherited rows alone stay silent. - Allocator: the next sequence is now one more than the larger of the counter and the highest sequence still queued, so a new row can't land inside an outstanding acknowledgement's range. - `docs/watcher-continuity.md`: the paragraph and coverage list are updated to match. Tests: `test_append_wakes_handling_successor` in `tests/fm-watch-arm.test.sh` now inherits two rows and takes a counter state (intact, missing, malformed). The four new cases are after-ack and before-ack with a missing or malformed counter, and they run real watcher, arm and drain processes. In after-ack the queue is fully drained before the new append. Evidence: - Before any production change (on 92c724d), all four new cases failed: "not ok - handling successor stranded the second inbox wake" for after-ack and before-ack. - With only the watcher fix, the after-ack cases passed and the before-ack cases still failed, which shows the allocator fix is needed. - With both fixes, all four pass. Full results: `fm-watch-arm` 36/36 (including the intact after-ack and before-ack cases, so ordinary silence and fresh-beacon delivery still hold), `fm-watch-recovery-loop` 2/2, `fm-inbox` 16/16, `fm-pi-watch-extension` 60/60, `fm-wake-queue` 67/67, and all four `fm-wake-drain-*` suites passed (9, 9, 18, 14). Canonical `bin/fm-lint.sh` with `PATH=/home/nino/.local/bin:$PATH` passed: ShellCheck clean, actionlint 1.7.12, 3 workflows valid. That lint run was in local changed-file mode with ShellCheck source following disabled. In a first run of all nine suites in parallel, `fm-wake-queue` failed on "presentation lock delayed the drain for 10s" and one `fm-pi-watch-extension` timing test failed. Both passed in full when rerun on their own, so I read that as load contention, not this change. Design decision to flag: the allocator change sits in the shared wake library, so it goes beyond the watcher comparison the bot pointed at. It is a one-expression change, and the before-ack tests can't pass without it, because otherwise the predecessor's acknowledgement deletes the new message. Not done, per the phase boundary: nothing committed, pushed or posted, and the live fleet was not touched. Evidence logs are in /tmp/fmci, not in a pipeline logs/evidence directory * no-mistakes(ci): Fixed both Greptile findings on PR #6467. Nothing was committed, pushed or posted, and the live fleet was not touched. **ci-1 (4172409813): a new wake was mistaken for an inherited one.** - Invariant that must hold: a successor treats a row as covered only if it is an unchanged inherited row in the inherited recovery episode. - Cause: after the predecessor's acknowledgement and a lost counter, a re-append with the same kind, key, payload and epoch was byte-identical to the snapshot row, so the successor stayed silent. - Fix (`bin/fm-watch.sh`): I used the existing recovery generation rather than a new identity scheme. Any append after an acknowledgement mints a new generation. The successor records the generation with its row snapshot, under the queue lock and in arm-check's lock order. Each poll counts the queue as newer if a row is not in the snapshot, or if the queue is non-empty and the generation changed. The existing arm-check then decides whether to announce. No rows are consumed, and inherited rows alone stay silent. - The row snapshot is still needed for before-ack, because an append before the acknowledgement keeps the same generation. **ci-2 (4172409821): large sequence numbers became unusable.** - Invariant that must hold: sequence numbers are always exact digit-only decimals. - Fix (`bin/fm-wake-lib.sh`): the allocator picks the largest of the counter and the queued sequences by comparing decimal text (length, then string order, leading zeros stripped), then adds 1 in bash with `$((10#$seq + 1))`. This restores the 64-bit exactness of the original bash counter. - Same fix at two places in `bin/fm-wake-drain.sh` that print sequences: `presented_max_row` and `ACK_THROUGH` print the matched text instead of `max + 0`. **Tests** - `tests/fm-watch-arm.test.sh`: two new `identical` cases, after-ack with a missing and with a malformed counter. A fake `date` pins the epoch, and the test asserts the row is byte-identical, then checks timely notification, preservation until its own acknowledgement, and no repeat notification. - `tests/fm-wake-queue.test.sh`: new `test_large_sequences_stay_exact_decimal_identifiers` starts from 2147483647, 9007199254740991 and 9223372036854775806, each with an intact, missing and malformed counter. It checks the next sequence is exact and digit-only. For the first two it also checks a real drain shows both rows, names the exact acknowledgement sequence, and acknowledging empties the queue. - `docs/watcher-continuity.md` now describes the generation check. **Evidence** (in `/home/nino/.no-mistakes/evidence/01M40CDTX2000A5TFFRZN27YFR/ci-round3/`) - Before, on 050a5fc: both identical cases failed with "handling successor stranded the second inbox wake (after-ack)". The large-sequence test failed with "advanced to '9223372036854775808', not 9223372036854775807". - After the fix, all three pass (`after-*.log`). - All nine suites passed, each run on its own, all with 0 not ok (`final-results.txt`): `fm-wake-queue` 68/68, `fm-watch-arm` 38/38, `fm-watch-recovery-loop` 2/2, `fm-inbox` 16/16, `fm-pi-watch-extension` 60/60, `fm-wake-drain-open-decisions-cursor` 9/9, `fm-wake-drain-open-decisions` 9/9, `fm-wake-drain-outcome-backstop` 18/18, `fm-wake-drain-unread-status` 14/14. - `bin/fm-lint.sh` with `PATH=/home/nino/.local/bin:$PATH` passes: ShellCheck clean, actionlint 1.7.12, 3 workflows valid (local changed-file mode). **Not run** - The only OpenCode suite is an opt-in live test, so I did not run it. **Limits** - The 2.14748e+09 symptom doesn't reproduce with the awks here (gawk, mawk 1.3.4, busybox). The failure reproduced locally is the precision loss at 64-bit values. - The drain's awk comparisons are only exact up to 2^53. That predates this PR and I left it alone, so the drain test stops at 2^53 * no-mistakes(document): Reattach successor poll-loop sentence to its subject * fix(bin): stop lock waits and test fixtures from spinning after their directory is removed (#7685) * fix(tests): bound lock waits on removed dirs and reap fixture-root processes A lock wait spun every 0.1s forever once its directory was removed, so a watcher or reconcile scan of a deleted test home never reached its own home-gone exit. fm_lock_acquire_wait now returns within 0.2s once the lock's parent directory is gone. Test teardown now signals every process naming the exact fixture root (TERM, then KILL) before removing it, in both fm_test_cleanup and the orphan sweep. The supervision-host fake harness sessions stop once their home is gone or the suite pid has died, so a hard-killed runner no longer leaves them polling under init. Fixes #7672 * fix(tests): bound the session-lock concurrency barrier Forty workers polled a find pipeline every 0.01s to wait for each other, so the barrier alone launched thousands of processes a second, and once a stopped run removed the barrier directory the workers polled forever under init. Count entries with a builtin glob every 0.05s, and end the wait once the directory is gone, the suite has died, or the stub block bound passes. Refs #7672 * fix: watch review-bot findings on owned pull requests (#7499) * fix(bin): admit listed review-bot comments as contribution signals * no-mistakes(review): Persist review-bot config in contribution check shim * no-mistakes(review): Classify allowlisted collaborators as review bots * no-mistakes(document): Document review-bot contribution signals * no-mistakes(review): Preserve review-bot config and re-raise classification * no-mistakes(review): Prevent acknowledged bot signals replaying after allowlist changes * no-mistakes(document): Document configurable review-bot contribution watching * no-mistakes(document): Clarify review-bot thread documentation * fix(bin): make review-bot contribution watching opt-in * docs(bin): state review-bot allowlist has no built-in default * no-mistakes(document): Document per-home review-bot configuration --------- Co-authored-by: Caleb LeNoir <calebl@users.noreply.github.com> * fix(brief): drop undefined heavy-test slot from the Waiting section (#7674) The generated Waiting section told workers to wait on a heavy-test slot that nothing in the repository defines. Remove the phrase and assert that a brief generated with config/wait-no-turns does not name one. * fix(bin): read the no_ci ci-monitor marker as no-checks (#7675) * fix(bin): read the no_ci ci-monitor marker as no-checks instead of validating Fixes #7644 * no-mistakes(document): Rewrap nm_ci_checks_state no_ci comment * feat(bin): add opt-in restricted permission mode for Codex workers (#7683) * feat: add opt-in restricted permissions for Codex workers * no-mistakes(review): Document restricted Codex network and git approval limits * fix(test): keep serial packing at-budget fixture stable with unhinted scripts (#7699) * fix(test): keep serial packing at-budget when a script has no hint tests/fm-approval-failover.test.sh landed without a serial duration hint, so the at-budget packing fixture overflowed by 1040ms. Record a measured 5410ms hint and give the fixture its own complete hint table so unmeasured defaults cannot join the boundary shard. Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com> * docs: note the local approval-failover packing hint Record the 5410 ms provisional local sample for the next CI refresh, and describe the packing-boundary fixture as independent of unhinted scripts. Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Kun Chen <kunchenguid@users.noreply.github.com> * fix(inbox): newline-terminate steering records (#6309) * fix: terminate steering inbox records with newline * no-mistakes(ci): Fixed Greptile P2 by updating the shared generated `INBOX_SECTION` in `bin/fm-brief.sh`, which is the single guidance source consumed by ship, scout, and secondmate scaffolds. The guidance now tells workers to prefer `fm_task_inbox_body`, explains that `body-terminator=1` marks exactly one synthetic record-termination newline that is not logical body content, and says to remove only that marked terminator while preserving intentional trailing newlines and legacy EOF bodies. Added generated-brief behavioral coverage for all three scaffold paths in `tests/fm-brief.test.sh`. Verified with `./tests/fm-brief.test.sh && bash ./tests/fm-task-inbox.test.sh` * fix: print fm-send help before resolving FM_HOME (#6402) * fix(bin): make fm-send.sh --help print usage before FM_HOME resolution * fix: parse list-form Lavish results without dropping answers (#5404) * fix(bin): parse Lavish list-form results and refuse unparsed blocks Lavish emits its queued prompts in TOON list form instead of table form as soon as the items stop being uniform, for example when some annotations carry a nested target object or a message carries an attachments table. The adapter only recognized the table header, so read reported a complete, empty result and answers closed nothing. Move the result parsing into one shared reader used by read, answers, and reconciles that accepts both forms, keeps only column-zero headers, skips nested structures only beneath the field that opened them, and counts anything it cannot account for as malformed. An unrecognized header naming the block is now malformed rather than an empty result, answers and reconciles exit nonzero when the result is not fully accounted for, and the queued-content check treats a list header as content. Refs #4726 * no-mistakes(document): Document Lavish capture formats and incomplete-result handling * test: expect captain_message_count for the open-board list-form capture * fix: correct Pi wake ownership and processing-turn handling (#5835) * fix(pi): let the supervision branch claim Orca stale wakes The watcher keys Orca endpoints by terminal=, but the branch dispatcher only indexed window=, so every Orca stale row vetoed the wake scan and went to main. Index both endpoint fields. Local hotfix ahead of upstream; refs kunchenguid/firstmate#5623. * test(pi): cover terminal-keyed Orca stale rows in branch dispatch Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with another eligible row must resolve to its task in both routine and heartbeat scans, instead of vetoing the wake to main. * no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows * fix(pi): reject conflicting wake endpoint ownership Index task keys and window/terminal aliases through one ownership check. Ambiguous records must leave the wake on MAIN instead of selecting the last task and possibly bypassing another owner's open decision. Cover duplicate terminals and collisions with window and task keys in both record orders while preserving unique terminal routing. * no-mistakes(document): Document conflicting alias ownership as scope corruption * fix(pi): retain ownership claims from incomplete task records Check endpoint and task alias ownership before project eligibility so a projectless record cannot lose its open decision to another terminal owner. Require project context before decision filtering can grant routing scope. Cover missing and empty project fields in both record orders, and preserve refusal for a uniquely mapped terminal without project context. * no-mistakes(review): Fix canonical routing ownership and custom SDK event handling * no-mistakes(review): Preserve dedicated custom processing run ownership * no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation * feat(bin): add a forge=external review rail that never pushes task branches (#7368) * feat(bin): add a forge=external review rail that never pushes task branches A project whose review tool uploads its own snapshot of the worker's local commits can now be registered [direct-PR forge=external]. Workers on such a project never need to push a branch to publish, and must never push a task branch to the shared origin. - fm-project-mode.sh: external joins the closed forge set; never detected, refused on local-only, and +yolo reports yolo=off with a refusal. - fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin and task-prefixed pushes, its Definition of done renders the home's config/external-review.md adapter verbatim, and the ready-report gate accepts `done: review <url> uploaded for review` on the URL alone or, with a recorded backup remote, once HEAD is on the backup namespace. - fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to origin or a URL matching origin's, task-branch and task-prefixed refs on any remote, and refs outside the backup prefix on the backup remote. - fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip. - fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup remote before launch; installs the guard even under keep-ai-trailers; and records forge=external, backup_remote=, and backup_prefix=. - fm-review-check.sh (new): records review= and review_head= with no merge watch, and publishes the child's ready line in a secondmate home. - fm-promote.sh refuses promotion onto forge=external, because a scout launches without the guard. - Docs: docs/external-review-forge.md (design), configuration.md's new "External review tool" section, scripts.md, and the ship-landing and project-management skills. * no-mistakes(review): Drop string-grep hook assertion from external-review spawn test * no-mistakes(document): Note forge=external contract token and direct-PR-only composition * test(pi): Lauf ohne prompt in before_agent_start festnageln (#7387) Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder solche Lauf mit einem Fehler auftauchte statt zu starten. Die Verengung dagegen steht seit 8c9c67de im Zweig, ein Test, der sie benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher Lauf weder wirft noch als Dialog gespiegelt wird. Gegenprobe: ohne die Verengung wirft genau dieser Fall mit "Cannot read properties of undefined (reading 'trim')". Co-authored-by: thelad-dev <ladwein@firstmate.bost8.thelad.loc> * fix(bin): stop tmux target checks reporting gone windows as alive (#7409) * fix(tmux): verify exact endpoint membership * fix(tmux): preserve exact target forms * test(tmux): align endpoint fixture lifecycles * test(tmux): guard isolated cleanup and shell reader * no-mistakes(review): Limit tmux .pane target split to window indexes * fix(composer): prove opencode 1.19 de-emphasised mode footer from the plain row (#7395) * fix(bin): stop misreading opencode's own footer as pending composer text An idle OpenCode composer classified as `pending`, and that verdict gates every typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control refuses both relaunch and exit. A firstmate operator lost a full session to it and had to type into worker panes by hand three times. Root cause: opencode 1.19 draws the mode/model footer's identifying cells de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105, luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128 threshold). That helper exists to answer "what did the human type?", so it deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor then became unreachable on every styled backend - tmux, Herdr, and Zellij - not just one pane, because the unstyled row keeps its styling bytes everywhere. The fix proves the footer from both forms of that row: the ghost-stripped content and the ANSI-stripped plain row. Proving it on the form ghost stripping cannot reach is the whole repair. What makes that safe, and why the previous argument was not: the earlier draft argued safety by noting that on a plain capture the two forms collapse to one string, so the verdict is unchanged. That is true and carries no weight, because styled=0 is the only configuration where the new proof does nothing. The exemption is safe because a row reaches the plain form only when the ghost-stripped row still fails the pattern, which means the stripped content is non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing opencode draws de-emphasises a typed row's leading cells - only its furniture is drawn dimmed - so the only rows the plain form admits beyond the stripped one are de-emphasised furniture, and the mode footer is the only furniture opencode draws that opens with a mode word. That is self-confirming rather than asserted, and it is the argument to recheck when a new opencode release moves a colour. A review also caught a second change riding along in the same diff: the footer pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting `Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so they moved the verdict in exactly the direction this rule exists to prevent. No recorded opencode footer ends at the dot, so the original `+` matches every real capture and the widening is reverted. Verification: - fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12. - fm-doc-audience-check.sh ok across 119 surfaces and 757 local links. - tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh. - The new regression case fails on exactly one assertion when this change is reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got 'pending'", which is the reported symptom. - Confirmed end to end against live panes rather than only fixtures: a real idle opencode 1.19.0 worker classified empty after the change and pending before, and firstmate reached the worker over the steer channel afterwards. * no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim * no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage * no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture * no-mistakes(document): document opencode de-emphasised footer recognition invariant * no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction * no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle * no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md * no-mistakes(document): document leftbar footer override and opencode 1.19 pointer * test(send): codex im Tuerklingel-Test hook-frei starten (#7406) Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei --disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt. Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil schon die projekteigene .codex/hooks.json den Dialog aufzieht. Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim naechsten Umbau nicht wieder still ausfaellt. Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc> * fix(bin): store only classified review fields in contribution records (#7096) * fix(bin): store only classified review fields in contribution records A pull observation stored GitHub's raw reviews payload, so a PR with a few hundred reviews wrote a record past the 1 MiB read cap and every pending, verdict and ack read then refused the whole home. Project each stored review to id, state, submitted_at, commit_id and user.login, the only fields the classifier reads, and add a many-review regression. * no-mistakes(document): clarify contribution record read cap in script header * fix: handle Pi 1.1 and 1.2 supervision events correctly (#7216) * fix(pi): retain custom-event handling and processing cancellation * fix(pi): identify custom triggers before legacy prompt narrowing * no-mistakes(test): Correct branch fixture retirement and verify real notification ownership * no-mistakes(document): Clarify Pi event boundaries and verification scope * fix(pi): retain custom-event handling and processing cancellation * fix(pi): identify custom triggers before legacy prompt narrowing * no-mistakes(test): Correct branch fixture retirement and verify real notification ownership * no-mistakes(document): Clarify Pi event boundaries and verification scope * no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context * no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification * no-mistakes(test): Require dual-SDK compiler checks; execution remains pending * no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims * no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers * no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor * fix(test): reconcile queued processing probes after rebase * no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments * fix(bin): verify cursor launch binaries with a bounded probe (#6380) * fix(cursor): verify cursor-agent by running it, not by name Cursor's installer writes its `cursor` IDE shim through the ~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned cursor-agent with a script that only prints "No Cursor IDE installation found" and exits non-zero. That file keeps Cursor's own name and install-tree path, so the name shortcut (and the structural check alone) accepted it and every Cursor spawn launched the broken file instead of the working agent alias. A launch candidate now has to print Cursor's CLI identity under the bounded probe, or carry the structural evidence and run --help successfully. Hosts without a bounded runner keep the structural verdict, as before. * no-mistakes(document): Align cursor launch-verify docs with runtime * no-mistakes: apply CI fixes * test: restore fm-watch-triage ack_stopped_cycle assertion The CI fix round loosened ack_stopped_cycle so a drain that prints no acknowledgement command and exits zero counts as success. That test is unrelated to the Cursor executable verification this branch changes, so restore its original assertion rather than mask a watcher failure here. * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * fix(bin): restore fm-afk-contract clock sampling A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch. That away-mode behavior is unrelated to the Cursor executable verification this branch changes, so restore it here and leave any fix to its own change. * fix(cursor): load the timeout library only when a probe runs Sourcing bin/fm-timeout-lib.sh at load time made every consumer of fm-cursor-lib.sh, including the session-lock and turn-end hook paths that never probe, depend on that file being next to it. Load it lazily from the probe instead. * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * test: restore herdr focus-flash e2e test A CI fix round edited this Herdr end-to-end test, which is unrelated to the Cursor executable verification this branch changes. Restore it here and leave any fix to its own change. --------- Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc> * fix: require actual PR references in CI-ready ship notes (#7422) * fix(dod): require a PR reference in CI-ready notes * no-mistakes(review): Recognize Forgejo plural pull request URLs * feat(herdr): opt-in project groups with status tags and a sorted agents view (#7434) * feat(herdr): opt-in project groups with status tags and a sorted agents view Add config/herdr-project-groups (absent or off: unchanged behavior). When on, Firstmate tags each Herdr task pane, and its own projected workspace, with display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents view sorted by group then status (needs-captain, problem, running, done), and places a new projected task at the end of its own group inside the parent block with the same single verified move as before. The watcher reconciles tags once per poll and a spawn tags its task at once; bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends suggested sidebar rows with a backup. The agents view helper needs python3. The only test-runner change is the serial weight hint for the new suite. * docs(herdr): record the live lab check of project groups The four hand checks for tags, the sorted agents view, placement at the end of the group, and clear passed against a real Herdr 0.9.5 server (protocol 22) in a guarded lab session. * docs(herdr): align project group verification notes with the live check * fix(bin): pin LC_ALL=C for remote job process identity reads (#7410) ps -o lstart= renders in the caller's locale, so a lock or claim owner recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity verification under another, was declared dead, and a second worker split the queue: two serve loops reclaimed and reaped each other's live jobs, which vanished mid-claim and failed staged jobs with exit 125 and no output. Pin LC_ALL=C in fm_remote_job_process_start and pin the cross-locale invariant with a regression test. Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com> * fix(opencode): ignore child stdin EPIPE in guard and encoder (#7447) * fix(bin): ignore crew state overrides for other tasks (#5881) * Guard fm-crew-state overrides by task-name basename bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name. An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory. A snapshot's own override, which names the task it was captured for, is still honoured. This is complementary to #5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task. Regression tests cover a mismatched over…
What Changed
nm_ci_checks_stateinbin/fm-crew-state.shnow recognizes the no-mistakes marker "repository declares no CI (no_ci: true) - treating as all checks passed". It maps this marker tono-checks, notgreen, even though the text says "all checks passed". No check verified the PR, so a worker's own "checks green" claim is not promoted.no-checksrun detail now reads "no CI checks reported (or repository declares no CI): nothing has verified the PR (still monitoring for merge/close)". The comment above the function documents the new marker.tests/fm-crew-state.test.shadds 52 lines of cases for theno_cimarker.Risk Assessment
✅ Low: The change adds one marker to an existing grep and case statement. That marker maps to the existing no-checks verdict. The case order puts it before the "checks passed" arm, so the sentence's "all checks passed" text cannot read as green. A later marker still wins. The regression tests use the sentence from the binary as their oracle, and they would fail on the old "validating (running)" reading.
Testing
I ran tests/fm-crew-state.test.sh. It drives the real fm-crew-state.sh against a faked axi/no-mistakes CLI. The three new no_ci tests and all existing tests passed. I did not run the real no-mistakes binary or a Herdr lab, so none of this is live.
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-crew-state.sh:911- The comment says the no_ci sentence was "pinned from no-mistakes v1.84.0". The installed binary is v1.100.0 (cc062e8). It still contains the exact sentence "repository declares no CI (no_ci: true) - treating as all checks passed - still monitoring until merged or closed", so the matcher is correct; only the version label in the comment is stale. The binary also has a sibling sentence: "... - validation complete, releasing without waiting for the merge". The same grep matches it and reads it as no-checks, which is the correct reading. That sentence ends the ci step, so nm_ci_checks_state never runs on it. No action needed.bash tests/fm-crew-state.test.sh(full file, includes the three new no_ci tests; exit 0, 'all fm-crew-state tests passed')✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
CI notes