Repository navigation
Merge upstream kunchenguid/firstmate main into the fork - #42
Conversation
…nchenguid#5695) * fix(bin): strip AI co-author trailers from fleet-launched commits Cursor and other non-Claude runtimes append the trailer after the typed message. A per-task commit-msg hook removes it and leaves human co-authors and the author identity untouched. * no-mistakes(review): Export pane hooksPath override and drop generated-with stripping * no-mistakes(ci): This PR caused all three CI failures, and the fix is test-only: 4 test files change, no product code. **Cause.** `fm-spawn.sh` now installs the AI-trailer strip hooks for every spawn, secondmates included. The installer refuses a worktree that is not a git repository, and the PR deliberately keeps that fail-closed rule because real secondmate homes are firstmate clones. Four test fixtures still gave secondmates a plain directory as their home, so each spawn failed with "not a git worktree ... could not install the AI-trailer strip hooks": - serial 5: `tests/fm-backlog-atomicity.test.sh` ("secondmate spawn failed"). - serial 8: `tests/fm-secondmate-harness.test.sh` ("split: no meta written"). - Herdr: `tests/fm-backend-herdr-launcher-workspace-e2e.test.sh` and `tests/fm-backend-herdr-workspace-per-home-e2e.test.sh`. **Rule that must hold.** Every home a test spawns as a secondmate must be a git worktree. I checked the other places in the changed area: the only secondmate spawns in these tests are the ones listed. The earlier rounds already fixed the other fixtures (`fm-secondmate-liveness`, `fm-secondmate-safety`) the same way. **Fix.** - Each of those four secondmate homes now gets the same `.gitignore` plus `git init -q -b main` that the liveness and safety tests already use. - The two Herdr tests clean up with their own plain `rm -rf "$TMP_ROOT"`, not the shared `tests/lib.sh` helper. Because the installer leaves each `state/<id>.git-hooks` directory read-only, that cleanup printed "Permission denied" and left the directories behind. Both cleanups now restore the owner's write bit on every directory before removing (`find ... -exec chmod u+rwx`), which is what `fm_test_remove_tree` in `tests/lib.sh` does. **Verification.** - `tests/fm-secondmate-harness.test.sh` passes. - `tests/fm-backlog-atomicity.test.sh` passes (99 ok, exit 0). - shellcheck is clean on all four files. - I could not run the two real-Herdr tests locally: the Herdr lab on this host refuses to start because it needs exactly one running default session, and I did not change the host's Herdr state to get around that. Instead I checked their two changed steps directly: the installer succeeds on a home set up the new way, and the new cleanup removes the read-only hooks directory completely. Those two tests will only be proven on CI
…id#5683) * fix(bin): treat Pi's dollar-first cost footer as furniture An idle Pi status row opening with $0.000 was read as a dead-shell prompt, so exit and relaunch refused on an empty composer. * test: wait for the draining holder to exec sleep before reading its identity The procevent drain fixture read fm_pid_identity immediately after backgrounding setsid sleep, racing the child's exec chain. Mid-exec the cmdline can read empty, failing the fixture on a loaded CI runner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…5534) * fix(bin): refuse a merge when a required check never reported fm-pr-merge.sh built its GitHub refusals only from checks present in statusCheckRollup, so a required check that never ran was simply absent and the merge proceeded on the subset that reported, contradicting its own "every required check green" claim. The GitHub verify now reads the base branch's required contexts from the forge itself - the classic branch protection summary on GET repos/{o}/{r}/branches/{b} and the active ruleset rules on GET repos/{o}/{r}/rules/branches/{b} - and refuses when a required context has no entry in the same rollup, at the same head, that the merge is bound to. Absence reads as unknown, never green. The required-set read joins the existing refusal list, so a draft, a red check, and an unreported required check are all reported together. Could not read vs nothing required: both endpoints need only repository read access. The admin-only GET .../branches/{b}/protection endpoint is deliberately not used: it answers a non-admin token with the same 404 an unprotected branch gets (observed live on kunchenguid/firstmate main with this token), which would read a missing permission as "nothing required". Any failed or malformed read of either source (auth, missing fine-grained permission, rate limit, network, 404, unexpected shape) refuses the merge with a line naming the unreadable source. The one exception is GitHub's plan-gated 403 on the rules endpoint ("Upgrade to GitHub Pro or make this repository public"), which already means "this repository has no branch rules" for the merge-queue reader; that check moves into one shared helper and the classic summary still decides for such a repository. Attended waiver: --allow-missing <check-name> is the twin of --allow-red and follows the same design and recording path: once, separate name argument, waives only that exact unreported required check, still requires every other required check reported and every check green, never waives an unreadable required set, refused while the away-posture record exists, and refused on GitLab. Merge-state BLOCKED policy is unchanged. How this differs from the withdrawn kunchenguid#5353 (read from its diff): - kunchenguid#5353 read the admin-only branches/{b}/protection endpoint and treated its 404 as "no required checks", so for any non-admin token the required set silently read as empty; this change reads the read-access branch summary and treats every failure as unreadable. - kunchenguid#5353 ignored rulesets; this change also reads required_status_checks rules from the effective branch rules. - kunchenguid#5353 made separate per-head REST reads of statuses and check-runs capped at per_page=100 with no pagination; this change checks presence in the same statusCheckRollup view the red-check gate already reads at the verified head. - kunchenguid#5353 stopped at the first unreadable read; this change reports it as one refusal among all the others. - kunchenguid#5353 also claimed kunchenguid#5345 (lock stealing) and changed 39 files, most unrelated; this change is kunchenguid#5344 only. Live proof, read-only (a gh wrapper refused every merge and mutating call): - cli/cli#14474 (trunk requires 3 classic build contexts, none ran): refused, naming build (macos-latest), build (ubuntu-latest), build (windows-latest); with --allow-missing "build (macos-latest)" it still refused, naming the other two. - cli/cli#13665 (ran build (ubuntu-24.04-firewall) instead): refused, naming build (ubuntu-latest). - hashicorp/terraform#39262 (ruleset-required checks absent): refused, naming Code Consistency Checks, End-to-end Tests, Race Tests, Unit Tests. - cli/cli#14485 (all required reported and green): verified; the wrapper blocked the merge call and the pull request read back open. Fixes kunchenguid#5344 * fix(review): Preserve required-check producers and aggregate independent read failures * fix(document): Clarify required-check verification and waiver documentation * fix(bin): match an app-bound required commit status by name The producer-identity check resolved an app-bound required context only against check runs, so a required context that the required app reports as a commit status could never match and always read as "has not reported". A commit status carries no app id to compare, so an app-bound requirement that arrives as a status now matches by name, as before producer binding; check runs keep requiring the configured producer app. Live, read-only: hashicorp/terraform#39262 requires license/cla from integration 865473, reported green as a commit status by the CLA app. The previous head refused it as unreported; this head no longer does, while still naming the four required check runs that never ran there. Refs kunchenguid#5344 * fix(document): Clarify accepted commit-status producer verification limitation --------- Co-authored-by: firstmate-oss <firstmate-oss@kunchenguid.local>
…uid#5696) * fix(bin): never offer a persistent secondmate for teardown The return brief's "Landed, cleanup due" scan listed every state/*.meta record carrying a pr= and a merge-notified marker without regard to kind, so a secondmate record holding a relayed child's merged PR put the mate itself up for "bin/fm-teardown.sh <mate>" cleanup. A secondmate is a persistent worker, never landed work. - bin/fm-afk-return.sh: skip kind=secondmate in the landed-cleanup scan. - bin/fm-pr-check.sh: refuse to record pr= or arm a merge watch on a kind=secondmate record before any side effect; a PR reported on its routed status channel belongs to a task in the mate's own home, which arms its own watch. - bin/fm-watch.sh: a merged result from a poll already armed on a secondmate retires the poll silently - no merge outcome, marker, or wake. * no-mistakes(document): Document secondmate merge-watch and return-brief exclusions * no-mistakes(ci): CI failed in an unchanged watcher-shutdown test whose three-second wait was sensitive to runner load. Increased the wait for both state- and home-deletion cases without changing watcher behavior. The full fm-watch-arm suite passed locally; syntax and diff checks passed
…unchenguid#5702) * fix(bin): refuse unknown dash-leading args in public-posting fm-x scripts fm-x-reply.sh collected any unrecognized argument into the positional pool and took the first one as the reply text, so an invocation like "fm-x-reply.sh <id> --followup --final <text>" posted the literal string "--final" to X and silently dropped the real text. Make argument parsing strict in every script that can post publicly: an unknown dash-leading argument, a dash-leading request_id/task id, a dash-leading option value, or a surplus positional now exits 2 with a usage error before any config load, outbox write, or network call. Reply text starting with '-' is still accepted via --text-file or stdin, and --help is honored wherever it appears instead of becoming text (a --help forwarded through fm-x-followup.sh would have counted as a posted follow-up and mutated the link). fm-x-link.sh and the fm-public-followup scripts already refuse unknown arguments; fm-x-poll.sh takes none. * no-mistakes(review): Refuse surplus follow-up text sources; drop post-ID help branches * no-mistakes(document): Clarify reply and follow-up argument usage * no-mistakes(review): Refuse dash-leading --text-file operands in fm-x-reply * no-mistakes(document): Correct follow-up argument parsing comment * no-mistakes(document): Document dismiss argument rejection in script header
…nchenguid#5701) * feat(bin): latch the supervision host after repeated engine errors Rung 3c-1 of the PR 5631 re-cut: the host copies the Pi branch's broken-session policy. Two consecutive engine errors latch the session; every away wake then reaches main with one supervision-host line for a five-minute cooldown, after which one wake probes the engine, and each failed probe doubles the cooldown up to one hour. A reported turn without an engine error clears it. The latch is kept per main session, engine, and model in state/.supervision-host-health, and the engine conversation now uses the same main-session key, which includes the lock holder's process identity so a recycled pid never shares either. Lifted from the validated 5631 tree and adapted to main's away-only host: the attended recovery line and attended cooldown pass-through are left for the attended core, so a recovery is only logged. * no-mistakes(document): Consolidate supervision-host latch documentation
…kunchenguid#5535) * fix(bin): absorb routine second-mate progress while surfacing routed replies Fixes kunchenguid#2959 A kind=secondmate task's status signal was never absorbable, so a healthy mate's routine working: and paused: appends woke the primary every time. signal_crew_provably_working now reads the mate's lines new since the watcher's classified position: a decision, blocker, terminal outcome, note:, correlation-marked line, or unknown verb still surfaces regardless of busy evidence, while unmarked working:, paused:, and resolved: fall through to the same provably-working absorb an ordinary crewmate gets. * no-mistakes(review): narrow secondmate routine absorb to working and paused
* fix(bin): use gh-axi for the ship DoD draft check * no-mistakes(review): use PR number not URL in gh-axi draft check
… only (kunchenguid#5520) * fix(bin): drop status prose from the inactive-outcome dedupe identity The inactive-outcome receipt fingerprint included the child's sanitized last status line, so a persistent child appending routine prose after one terminal outcome minted a fresh parent event per sentence. Bind the identity to incarnation, task id, terminal state, and PR only, keeping the last line in the record as status_head evidence. Fixes kunchenguid#2960 * no-mistakes(document): note structured-only inactive receipt identity in regression coverage
…unchenguid#5707) * feat(bin): record the supervision host's dialog mirror on Claude and Cursor Add bin/fm-host-mirror.sh, the one owner of the supervision host's dialog mirror file, cursor, lock, and feed, plus the main-session key it keys entries to. The tracked Claude UserPromptSubmit and Stop hooks and the Cursor beforeSubmitPrompt and afterAgentResponse hooks record the captain's prompt and main's reply, only on a home with config/supervision-host, from a genuine primary checkout, for the lock-owning session. The mirror lands inert: writers record and nothing reads it yet; attended supervision on the host is the later step that consumes the feed. Codex, Grok, OpenCode, and omp have no writer here. * no-mistakes(review): Scope mirror dedup to session, atomic appends, marker-inclusive caps * no-mistakes(document): Clarify dialog mirror scope and remove duplicate contract details * no-mistakes(document): Correct Cursor hook documentation for dialog mirror registration * no-mistakes(review): Pass mirrored dialog text to jq via stdin * no-mistakes(document): Clarify dialog mirror documentation and remove duplicate claims * no-mistakes(review): Preserve internal dialog whitespace; drop mirror check and verified modes * no-mistakes(review): Drop only identical mirror repeats; remove redundant chmod guard
… escalations are not repeated (kunchenguid#5731) * fix(bin): retire check-row receipts on branch acks and report an unchanged situation once * fix(bin): scope a branch acknowledgement's check-row receipt retirement to its granted sequences The away posture lifts the attended partition's check/decision exclusions, so a branch grant can name check-kind rows - but the branch-actor ack still assumed check rows were main-only and skipped every receipt scan. The queue row was consumed while its terminal-outcome .pending receipt stayed behind, and each inactive-reconcile cadence scan re-queued the same fingerprint. In the first real away window on the supervision host that re-escalated one unchanged held-PR situation on every cycle (~1,734 of 4,149 outcomes). A branch ack now scans inactive-outcome and inactive-reconcile receipts and commits secondmate stall receipts against exactly the sequences in its eligible-row snapshot - the same rows it consumes - instead of none. Attended grants still name no check row, so the scans find nothing. * fix(bin): store a repeated captain verdict as routine while the task's durable situation is provably unchanged fm-branch-outcome.sh append computes a mechanical situation key per captain row - metadata bytes, captured status-log endpoint and identity, live crew-state verb, worktree head - and anchors it in state/.<task>.branch-captain-key. A later captain verdict whose recomputed key matches is stored as routine with "unchanged since seq <N>:" prefixed to its summary, so one situation escalates once until something provably changes. A task with no readable status ledger is never demoted, an unreadable record fails toward reporting, and teardown removes the sidecar with the task's other branch records. The append-only store schema is unchanged. This covers both hosts: the Pi supervision branch and the supervision host both funnel reports through append. * docs: check rows are main-owned only while attended; the away posture grants them to the branch, whose ack retires their receipts exactly * test: the away-flood reproduction as a regression test (branch ack retires the receipt and later scans stay quiet), store-level dedupe coverage, and a branch-ack secondmate stall receipt case * fix(bin): restore the secondmate child devin-config cleanup path The branch-captain-key sidecar addition mistyped the sibling entry as .$child_id.devin-config.json, so a forced secondmate teardown would have stopped removing each child's real <id>.devin-config.json. Restore the original path and add a behavioral test that stops the child sweep mid-loop on a refused close, proving the cleaned child's devin config and captain anchor are both removed while the unconsumed child's records are retained. * no-mistakes(review): Key captain dedupe on the covered wake rows' fingerprint * no-mistakes(review): Drop captain-key demotion; prove one escalation on both surfaces * no-mistakes(review): Drop unrelated teardown test; cite both receipt test files * no-mistakes(document): Docs already match branch-ack check-receipt retirement
…oorbell (kunchenguid#5664) * fix(calm): deliver Claude-bound operational input as a record-backed doorbell Claude Code 2.1.280 removes U+2063 from every submitted prompt, so a typed operational envelope reaches a Claude Code primary as plain text. The away daemon now writes the envelope to a record under state/operational-inbox and types only a plain doorbell naming it; the /afk return check and the Calm mod recognize the doorbell only when that record holds a current envelope. Marker- preserving harnesses keep the typed envelope. The live Calm guard accepts the 2.1.280 module-load log line, drives the doorbell, and asserts thinking stays hidden. * no-mistakes(review): Fix operational record retention at 7 days and document prune limit * no-mistakes(document): Point Calm bounds at 2.1.280 evidence; fix afk-exit comment * no-mistakes(lint): Pick newest Calm e2e transcript without parsing ls * docs(calm): add a minimal turning-Calm-on step for Claude Code * fix(spawn): deliver the Claude launch brief as a record-backed doorbell Claude Code strips U+2063 from the launch-prompt argument too, so a worker's launch brief arrived with its operational marker removed. Publish the brief as a record in the receiving home's operational inbox - a secondmate's own state, not the primary's - and pass only the printable doorbell naming it, falling back to the typed envelope when the record cannot be published so the brief body still delivers. Unwrap doorbell-carried digests in the daemon digest tests that still read the raw send log under the claude pin, and update the documented bounds now that launch briefs hide like the other operational rows. * test(spawn): cover a secondmate's launch-brief record landing in its own home The record-backed doorbell resolves its state through the receiving pane's home, so prove a claude secondmate launch publishes into the seeded secondmate's operational inbox and never leaks a record into the primary's. * no-mistakes(review): Pass primary harness to daemon, tighten retention, refresh verdicts * no-mistakes(review): Prune operational records by exact seven-day elapsed age * no-mistakes(review): Batch record pruning so large inboxes still expire * no-mistakes(review): Refuse Claude spawn when brief record cannot publish * no-mistakes(review): Drop thinking probe from Claude Calm live test and docs * no-mistakes(review): Record dated Claude Code 2.1.282 reproduction evidence * no-mistakes(document): Clarify operational doorbell documentation and record expiry * no-mistakes(document): Correct AFK escalation carrier guidance * no-mistakes(review): Describe operational record retention as about seven days * no-mistakes(document): Clarify Calm delivery and operational record retention * no-mistakes(review): Remove out-of-scope Calm launch guide from Claude docs * no-mistakes(document): Document Claude launch-brief delivery and refusal * no-mistakes(document): Correct stale operational-input documentation * no-mistakes(ci): Fixed the stale Claude trust test to verify that worker and secondmate launches deliver readable, record-backed briefs instead of expecting brief paths in their commands. Annotated the daemon’s output variable for ShellCheck without changing behavior. The affected tests, daemon tests, ShellCheck, and diff check pass locally * no-mistakes(ci): parse rebased Claude launch after trailer hook prefix * no-mistakes(review): Trust launch-brief record and restore thinking bound doc * no-mistakes(review): Parse final Claude launch statement; drop Stop-hook docs --------- Co-authored-by: Mike Sewell <maikunari@protonmail.com> Co-authored-by: no-mistakes <no-mistakes@localhost>
kunchenguid#5583) A host-local relaunch rewrote only the far endpoint, so this home kept the old harness, model, and effort, and appending those keys after pr= broke pull-request poll authentication.
…ound (kunchenguid#5516) tests/fm-watch-triage.test.sh finishes in about 434s alone and about 698s under CI load, so the 900s bound the changed-suite runner applies produced a false timeout under ordinary concurrent validation. Raise the automatic bound to 1500s, which keeps every measured script under it while staying below the 30-minute normal CI tier so a genuinely hung script still fails here with its output before the job cap cancels the lane. Fixes kunchenguid#3869 Refs kunchenguid#3565
…kunchenguid#5728) * Fix nested watcher lock reclaim * no-mistakes(review): Elect a single steal-mutex reaper and bound arm TERM wait * no-mistakes(review): Reclaim self-held steal mutex and unify autoarm steal reaping * no-mistakes(review): Resume own interrupted steal reap from its tombstone
…nguid#5710) * test: hold the back-to-back boundary close on the host's own clock test_park_boundary_holds_under_back_to_back_closes assumed two engine turns fit in the ~16s pre-refusal window and that the stub finished a turn in 3s. Under load the stub's real drain, report, and acknowledgement take ~13s, so the turn either died at its bound (which hands the wake to main, no boundary line) or the second close landed past the window and the fixture failed while the boundary held. 3 failures in 5 runs at a load average near 11. Hold the first turn on a release file instead: once the engine is in flight, a second close is appended mid-turn and the turn is released as the refusal window opens (park bound minus turn bound and grace, read off the host's own start record). The queued close can then only wait for the boundary on any machine speed, which is what the test asserts: the boundary line ends the output, the demo.status row stays queued for main, and no second engine turn ever starts. A host too loaded to start the turn at all hands the first close to the same boundary exit. After: 12/12 at load ~15-42. * no-mistakes(review): Print boundary test deadline as a decimal integer * no-mistakes(review): Hold boundary test turn on a FIFO, require full sequence * no-mistakes(review): Remove stray before/after supervision-host test copies * test: hold the late close's render until the refusal window opens The boundary recheck test's node shim slept a fixed 10s, which assumed the first close was read before the host's refusal window opened. Under load the close arrived after the refusal check, so the host correctly refused it before the successor started and the render snapshot never appeared. Block the wake-prompt render on a FIFO released at the refusal-open instant read from the host's own start record, so the pre-turn recheck must refuse on any machine speed. * no-mistakes(review): Derive minimal park bounds and refresh supervision-host shard hint * no-mistakes(review): Drive park-boundary tests from a seam-gated host test clock
* fix(bin): stage remote home clones before publishing them A remote home provision cloned the code root directly into the public FM_HOME path while rollback() claimed rm -rf of that same path on any failure. Bash defers trapped signals past a foreground child, but any other cleanup or lifecycle path that removes the home directory races the live clone's object copy, producing the CI flake "fatal: failed to copy file to .../.git/objects/...: No such file or directory". Clone into a private staging directory beside the home and publish with an atomic rename once complete, so no cleanup can remove a directory a live clone is still writing; a home that appears mid-provision now dies cleanly instead of inheriting torn state. The regression coverage holds a real clone mid-copy, removes the public path, and requires the provision to finish and publish intact. * no-mistakes(review): Prove home ownership by sentinel and hold only a live clone * no-mistakes(review): Assert raced provision publishes a complete, intact clone * no-mistakes(document): Document remote home staging and publication safety * no-mistakes(lint): Fix ShellCheck warning in clone integrity assertion * no-mistakes(document): Clarify remote home publication and rollback guarantees
* fix(control): keep a relaunched Pi worker's herdr pane status authority alive Defect: after `bin/fm-control.sh <id> relaunch` (observed live on a herdr Pi crewmate whose pane read idle while it ran its validation pipeline), the pane froze at whatever its previous agent had last reported. Cause, measured on herdr 0.9.1 against a real Pi: a pane has one status authority, and for Pi with its integration installed that authority is the lifecycle hooks, so herdr also skips screen detection for the pane. In the crew shape the registration outlives its agent process (upstream issue kunchenguid#4115; docs/herdr-backend.md "Restart and liveness behavior"), and herdr applies only reports carrying the session identity it bound. A replacement started fresh in that pane reports a NEW session, so its state reports are ignored and the pane stays frozen. Nothing from outside repairs it: `pane report-agent-session` and `pane report-agent` for `herdr:pi` are accepted (rc=0) without being applied unless the reporter is the registered pane agent, and `pane release-agent` on the stale record changes nothing. Fix: a relaunch preserves the binding instead of fighting it. The launch owner reads the session reference the endpoint's own runtime recorded (`fm_backend_herdr_pane_agent_session_ref`) and passes it back as Pi's own `--session <path-or-id>` (`relaunch_resume_args`; `fm_control_relaunch_resume_flag` owns which adapters and which registered-agent labels qualify). That is the same reference herdr itself resumes Pi panes with after a server restart, and the resumed session's reports land again, which the live check confirmed: the pane returned to working while the replacement worked and idle when it settled, on the same session identity. Safety: relaunch-only (a fresh spawn binds nothing), herdr-only (the one adapter that records a per-pane session), Pi-family only, and only when the registration's own agent label matches - so no other adapter's conversation can be handed to a Pi launch. An unreadable, missing, or malformed reference degrades to exactly the fresh-session launch that existed before. No lifecycle, liveness, isolation, or merge guard is touched, and an empty result leaves every non-Pi launch byte-identical. `resume` remains a refused verb; docs/agent-control.md and the harness-adapters references are corrected where they claimed Pi had no verified resume form at all. * no-mistakes(document): docs: correct relaunch session-authority ownership and skill paths * no-mistakes(document): docs: correct stale control-plane ownership claim * no-mistakes(document): docs: drop unverified Herdr restart resume claim * no-mistakes(test): Added offline Herdr Pi session-authority relaunch coverage * no-mistakes(document): Document Herdr Pi relaunch session continuity * no-mistakes(ci): The failing remote relaunch test tried to arm a PR poll for a secondmate, which `fm-pr-check.sh` correctly refuses. Removed that invalid test scenario; the remaining remote relaunch tests pass, and `git diff --check` is clean
…nchenguid#5758) Main has been red since fm-pr-check.sh began refusing to arm a merge poll on a kind=secondmate record (kunchenguid#5696): the relaunch-ordering case in tests/fm-remote-secondmate-relaunch.test.sh armed its fixture through that entry point and could no longer be set up. The ordering guarantee still matters: a secondmate record armed before the refusal can legitimately carry a trailing pr=/pr_head= identity block until the watcher retires it, and fm-remote-secondmate-relaunch.sh must still keep that block last when republishing harness/model/effort. Seed the fixture the way such a record was really written - pr= appended last to the meta, then the poll artifacts published through the same fm_pr_poll_prepare/fm_pr_poll_publish_prepared pair fm-pr-check.sh uses, a pattern tests/fm-pr-check-security.test.sh already follows - and drop the now-unused fake gh fixture. The kunchenguid#5696 refusal itself stays pinned by the security suite's secondmate-record case.
…id#5748) * feat: run attended supervision on the host for Claude and Cursor On a home opted into config/supervision-host with a Claude or Cursor primary, the supervision host now takes the attended wakes the Pi branch would take: routine outcomes stay off main, and a captain outcome wakes main once with a branch-outcome line and waits in the drain's new BRANCH OUTCOMES section until main acknowledges it with mark-processed. - The offer rule moves into branchOfferForWake, shared by the Pi watcher and the host through bin/fm-branch-dispatch.mjs offer. - The host feeds the dialog mirror at the head of each attended wake and passes a close through unchanged when it is main-only, the engine or a tool is missing, the primary has no verified mirror, the main session cannot be identified, or the session is cooling down. - The drain presents captain outcomes first, one line per task, never behind older routine outcomes, and collapses routine overflow into a count that is marked read. - The return advances the store's read cursor through the away window once the brief has rendered, so the first drain does not replay it. - The branch prompt's mirror wording is host-neutral, and the rule to report what main must act on as captain, once per unchanged situation, applies only to the attended posture on the host. * docs: record the attended supervision host live check * no-mistakes(review): Present pre-window unread outcomes and contiguous captain prefix * no-mistakes(review): Return brief presents every row it marks read * no-mistakes(review): Return brief lists every unread outcome in one list * no-mistakes(review): Keep return list in store order and gate cursor failures * no-mistakes(review): Make the drain the only branch-outcome presenter after return * no-mistakes(review): Gate return on drain outcome failures; byte-count outcome budgets * no-mistakes(review): Gate drain on projection failures; UTF-8-safe byte cuts * no-mistakes(review): Fail drain without jq; hand unreadable prompt mirror to main * no-mistakes(document): Correct supervision-host return and drain documentation * no-mistakes(review): Recheck attended offer at turn start; honest failed-drain brief * no-mistakes(document): Correct supervision-host posture and drain documentation * no-mistakes(document): Documentation remains accurate for attended supervision
…unchenguid#5753) Each '# shellcheck source=' directive makes ShellCheck's external-source traversal expand that library's whole transitive graph again at the site. fm-pending-reply-lib carried three directed lazy sources of fm-wake-lib and two of fm-parent-channel-lib on identical per-call re-source sites, so one file analysis peaked above 4 GiB and every caller (fm-watch, fm-teardown) inherited the multiplier - the root cause of the PR kunchenguid#5732 Lint 1 OOM kill. Keep the runtime '.' commands byte-identical: the lazy re-source under 'local STATE FM_WAKE_QUEUE FM_WAKE_QUEUE_LOCK' is real behavior. Drop the duplicate directives so each library expands once per unit, and drop the tmux/classify directives since classify already arrives through the kept fm-wake-lib expansion and no tmux symbol is referenced here. The directive above the lib-dir assignment is kept - it binds the bin/ prefix so the undirected sites still resolve without SC1091. Measured peak RSS, ShellCheck 0.11.0 -x on Linux arm64: bin/fm-pending-reply-lib.sh 4.06 GiB -> 1.96 GiB, zero findings
kunchenguid#5773) * fix: split bash 5.2 sibling $() in recovery mint and delivery log Sibling command substitutions on one line can empty a recovery generation under bash 5.2 when a CHLD trap is set. Mint pid/epoch sequentially, refuse empty tokens before write, and clean delivery fields before printf. Co-authored-by: Cursor <cursoragent@cursor.com> * fix: split bash 5.2 sibling $() in recovery mint and delivery log Sibling command substitutions on one line can empty a recovery generation under bash 5.2 when a CHLD trap is set. Mint pid/epoch sequentially, refuse empty tokens before write, and clean delivery fields before printf. Co-authored-by: Cursor <cursoragent@cursor.com> * fix: keep recovery mint failure semantics after sibling $() split Remove the new pid/date refusal and grammar guard so a mint miss still yields a grammar-valid token and a durable wake row, matching accepted review intent. Drop the fake-failing-date case that locked in the refuse. Co-authored-by: Cursor <cursoragent@cursor.com> * no-mistakes(document): Point recovery-mint hazard comment at its regression test --------- Co-authored-by: Cursor <cursoragent@cursor.com>
…stop calling Escape safe there (kunchenguid#5791) Fixes kunchenguid#4520
…unchenguid#5790) Fixes kunchenguid#4756 The voice status reader in bin/fm_voice_records.py reports each worker's state from the last non-blank line of its status log. When a worker appends a status line and then a line of plain prose, the reader reported "note" with the prose line instead of the declared state, diverging from bin/fm-classify-lib.sh's shell scan. Scan back through the tail for the newest line whose prefix is a single lowercase verb-shaped word (letters and hyphens), and report that event's verb instead of always taking the last line. An unrecognised verb-shaped prefix still reports "note" rather than letting an earlier recognised line answer for it, and free text with no colon is skipped as prose. When the tail holds no such event, the last line is reported exactly as before.
…newer version (kunchenguid#5786) * fix(bin): stop reporting an already-installed version as an available update An update announcement named its version first ("current -> new"), so reading the first dotted number as the announced version compared the current version against itself and always looked newer. Read the last dotted number instead, and only report an available update when that announced version is newer than the newest installed copy found; when that version is already installed, report only PATH skew. Fixes kunchenguid#5151 * no-mistakes(document): docs: gate announce update-available report on newer-than-installed
…h their launch config (kunchenguid#5799) * fix(bin): pass the profile effort to OpenCode workers through their launch config The dispatch profile's effort axis was recorded in task metadata but never reached an OpenCode worker: the launch wrote only a permission grant into the config it constructs. OpenCode 1.18.32's config schema carries per-model reasoning effort as agent.<name>.variant, so the chosen effort is now merged into the same OPENCODE_CONFIG_CONTENT JSON as the default build agent's variant, keyed to the resolved model. With no effort chosen the launch stays byte-identical. Fixes kunchenguid#1373 * no-mistakes(review): gate OpenCode effort variant by model provider family * no-mistakes(document): docs(opencode): note provider-family gating for effort variant
…nchenguid#5815) * fix: preserve cancellation as no verdict in crew state Reuse the green-delivery safeguard for cancelled CI monitors and permit a skipped rebase. Other cancelled outcomes and coarse ledger records use the existing unknown state. Four delivered-PR regressions failed before the fix and pass afterward. The isolated public resolver and fleet-summary tests prove that undelivered cancellation no longer creates a failure contradiction, while preserving historical records and the terminal_in_flight invariant. Evidence uses fixture no-mistakes responses, not a live daemon cancellation. Update the existing coarse cancellation assertion from failed to unknown because it encoded this defect; retain its newest-run precedence check. Full fm-crew-state suite and pinned lint pass. * fix(review): Verify PR disposition before reclassifying terminal validation runs * fix(test): Add captured cancellation replay coverage for resolver and fleet * fix(document): Clarify cancellation and terminal delivery documentation
…henguid#5812) * fix: declare worker background and pipeline waits Require ship and scout workers to declare owned-work waits with the existing paused verb before ending a turn or waiting on a pipeline or long command. Keep the first-sight alert and existing liveness classification unchanged; subsequent inspection follows the existing long pause cadence. Validation: emitted brief regression failed before the instruction change and passes afterward. Public watcher/drain regressions cover the first alert, repeated wedge suppression, bounded rechecks, and undeclared idle alarms using isolated backend fixtures. Brief suite, pinned lint, Bash syntax, documentation inventory, and whitespace checks pass. No real worker harness was exercised for wait behavior. * fix(document): Clarify declared worker waits and documentation ownership * fix(ci): Captain, fixed the cadence test to age both the declaration and first-alert throttle while preserving declaration identity. Reproduced the CI failure using stable identity; corrected tests pass with both stable identity and native macOS behavior. Focused ShellCheck and diff checks pass. Production behavior is unchanged; Linux CI was not rerun locally
…5770) * fix(bin): bound each lint root in its own ShellCheck process CI job "Lint 1" died twice at about ten minutes because the two shard workers each packed about 110 canonical roots into one unbounded ShellCheck process, and a byte-weight rebalance moved the analysis-heavy fm-watch.sh into a partition with other heavy roots, so the pair outgrew the 16 GiB runner before anything could name a culprit. Run one canonical root per ShellCheck process under an enforced envelope: a wall deadline plus terminate-then-kill grace via the shared fm-timeout-lib.sh watchdog, and a per-root rlimit spec applied inside the child before exec (default a 4 GiB address-space cap, so two workers stay inside a 16 GiB job with headroom). A root that exceeds the envelope fails by name with a recorded reason - timeout, memory, signal, or limit-unavailable - instead of taking the runner down. The per-root watchdog runs in its own process group so the owner's group sweep cannot orphan the bounded subtree, and fm_exec_timed now starts the same escalation when its parent dies before it can be signalled. FM_LINT_REQUIRE_BOUNDS=1, set in CI, refuses the run outright when a configured bound cannot be enforced on the host rather than lint uncapped. Each root's begin/end, reason, duration, and peak RSS stream to stderr in partition mode and append to a retained <telemetry>.roots.tsv sidecar uploaded beside the partition telemetry. Coverage is unchanged: pinned ShellCheck 0.11.0, --norc, --external-sources full analysis, complete and disjoint partition inventory, workflow lint, and the backend-purity check, with byte-identical diagnostics across jobs=1/2 proven by tests/fm-lint.test.sh. * fix(bin): fail closed on unenforceable lint bounds and size the cap Required-bounds mode (FM_LINT_REQUIRE_BOUNDS=1, set by CI) now refuses the run with named errors before any root starts: a missing fm-timeout-lib.sh, a watchdog that cannot actually bound a probe command, or a host that rejects the address-space limit all stop the run rather than lint uncapped. The generalized FM_LINT_ROOT_RLIMITS flag:value interface is replaced by a single FM_LINT_ROOT_MEMORY_KIB, and the roots sidecar and telemetry record the run's final exit status after backend-purity and workflow checks instead of the pre-check lint status. The default cap is 6 GiB of address space per root, not 4 GiB: ulimit -v bounds virtual address space rather than resident memory, and ShellCheck's GHC runtime keeps roughly a third of that space as reservation, so 6 GiB yields about a 4 GiB working heap budget. A Linux measurement during this change showed eleven real canonical roots running out of memory under the earlier 4 GiB cap while the largest passing root peaked near 2.8 GiB resident; two 6 GiB roots plus runner overhead still fit the 16 GiB job. Roots that still exceed the cap keep failing by name, and the sidecar's per-root peak RSS keeps roots approaching the budget visible. tests/fm-lint.test.sh now proves the memory primitive where it can be proven: on hosts that accept ulimit -v a perl allocator is refused under a 256 MiB limit and reported by name as a memory death, the pinned ShellCheck lints a small file under the configured cap and is named when a far smaller cap binds it, and a watchdog-less copy refuses under REQUIRE_BOUNDS; the bounded cases skip on macOS, which cannot enforce the address-space limit. * no-mistakes(review): Prove memory cap binds, pass watchdog owner, drop unused modes * no-mistakes(review): Capture watchdog owner before startup for every fm_exec_timed caller * no-mistakes(document): Clarify bounded lint documentation and telemetry * no-mistakes(document): Correct bounded lint documentation and sidecar path * docs(bin): restore the per-root memory cap sizing rationale The pipeline's document step rewrote the ROOT_MEMORY_KIB comment and dropped the sizing reasoning the change is required to record: address space vs resident memory, the GHC reservation share, the measured 4 GiB failures and ~2.8 GiB peak, and the two-roots-plus-runner capacity arithmetic. Restore it beside the default while keeping the corrected "not a resident-memory ceiling" framing. * no-mistakes(review): Document memory cap RSS reduction threshold and first candidate * no-mistakes(review): Scope owner-death escalation docs to the perl watchdog * no-mistakes(document): Clarify bounded lint and timeout documentation * no-mistakes(review): Install perl watchdog signal handlers before forking the command * no-mistakes(document): Correct bounded lint documentation and stale watcher comments * no-mistakes(ci): Fixed the supervision-host test’s obsolete expectation: the watchdog now reaps an engine when its host dies. The timeout and supervision-host tests pass locally; the watcher test also passes locally. Lint 1 and 2 remain unresolved: seven canonical roots exceeded the required 6 GiB address-space cap in CI. I did not raise the cap, exempt roots, or reduce source-following coverage to make those failures disappear * no-mistakes(ci): The two lint checks failed when eight canonical roots hit the enforced memory cap. I reduced repeated ShellCheck source-graph expansion while keeping runtime imports and the canonical root inventory intact. Pinned ShellCheck passes for all changed roots; the relevant local tests pass. The 6 GiB Linux CI run remains unverified * no-mistakes(review): Restore source directives, raise cap to 8 GiB, classify OOM * no-mistakes(review): Classify memory deaths from root stderr, not source excerpts * no-mistakes(review): Match only whole runtime memory-error lines for memory reason * no-mistakes(document): Clarify lint memory classification in script documentation * no-mistakes(ci): Fixed both lint checks’ memory-limit failure: each CI lint job now runs one root at a time with a 12 GiB address-space cap. Kept the local two-worker default and updated the sizing comment and test expectation. The lint tests and workflow validation pass locally; Linux CI remains to confirm the heavy roots
…id#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
…imits (kunchenguid#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.
…#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 kunchenguid#5349 * test: narrow contribution-input regression to final assembly failure The ARG_MAX transport is already fixed on main by kunchenguid#6830, so keep only the regression proving a failing final jq assembly exits non-zero.
* Fix Rex secondmate session lifecycle * no-mistakes(review): Retire Rex secondmate sessions under the owning home identity * no-mistakes(review): Limit Rex FM_ROOT label override to secondmate launches * no-mistakes(document): Clarify Rex secondmate grouping and lifecycle documentation
…gins, and exit (kunchenguid#7336) * feat(opencode): add OpenCode 2 support with version-gated launch and plugins OpenCode 2 dropped the v1 server-plugin hook API, so the five fm.primary.* plugins now export a default definition with an id and a setup function alongside their legacy OpenCode 1 server export, backed by a new shared lib/fm-opencode2.js helper; the turn-end guard, watch-arm, cd-check, pretool-check, and sessionstart-nudge install their behavior from setup(ctx) on OpenCode 2 and keep the server entrypoint for OpenCode 1. fm-spawn probes the resolved opencode executable's --version once and branches the launch, model flag, reasoning config, exit key, and busy-state plugin off the detected major. A parsed major >= 2 takes the OpenCode 2 shape (no --model, the model pinned through OPENCODE_CONFIG_CONTENT, a raw Ctrl-C exit, the session.execution.* busy plugin); OpenCode 1.x and any undetected or unparseable version fall back to the 1.x shape (--model, 1.x config, /exit) everywhere. The worker busy-state plugin is always provisioned, but OpenCode 1 keeps the pre-port session.status/session.idle plugin so its busy-state wiring is unchanged, and only a major >= 2 gets the session.execution plugin. Adapter and supervision docs, OpenCode 2 live fixtures, and regression tests for the unknown->1.x launch path and the version-gated busy-plugin shape are included. * no-mistakes(review): gate OpenCode 2 busy plugin turn-end touch on notifyTurnEnd * feat(opencode): launch detected OpenCode 2 workers with --standalone OpenCode 2's default launch attaches to the shared background service, which hosts plugins with the service's environment and ignores the pane's OPENCODE_CONFIG_CONTENT. A private server keeps per-worker model, permissions, FM_HOME, and lock ancestry correct. 1.x and undetected versions are unchanged. Ported from kunchenguid#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 kunchenguid#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 kunchenguid#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>
…t the most recent group member (kunchenguid#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
…er (kunchenguid#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 kunchenguid#7413 * docs(verification): record the fully dim Cursor placeholder verdict and refresh command
… composer as empty (kunchenguid#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
…process groups (kunchenguid#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
…alidating (kunchenguid#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.
…unchenguid#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 kunchenguid#3396 Claude-Session: https://claude.ai/code/session_01F9T29YDqYSkQeDTC2Nfi7h (cherry picked from commit 8b281b7) * 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 0baf64f) * 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 9256182) * 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>
…d#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 (kunchenguid#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 (kunchenguid#7336) * feat(opencode): add OpenCode 2 support with version-gated launch and plugins OpenCode 2 dropped the v1 server-plugin hook API, so the five fm.primary.* plugins now export a default definition with an id and a setup function alongside their legacy OpenCode 1 server export, backed by a new shared lib/fm-opencode2.js helper; the turn-end guard, watch-arm, cd-check, pretool-check, and sessionstart-nudge install their behavior from setup(ctx) on OpenCode 2 and keep the server entrypoint for OpenCode 1. fm-spawn probes the resolved opencode executable's --version once and branches the launch, model flag, reasoning config, exit key, and busy-state plugin off the detected major. A parsed major >= 2 takes the OpenCode 2 shape (no --model, the model pinned through OPENCODE_CONFIG_CONTENT, a raw Ctrl-C exit, the session.execution.* busy plugin); OpenCode 1.x and any undetected or unparseable version fall back to the 1.x shape (--model, 1.x config, /exit) everywhere. The worker busy-state plugin is always provisioned, but OpenCode 1 keeps the pre-port session.status/session.idle plugin so its busy-state wiring is unchanged, and only a major >= 2 gets the session.execution plugin. Adapter and supervision docs, OpenCode 2 live fixtures, and regression tests for the unknown->1.x launch path and the version-gated busy-plugin shape are included. * no-mistakes(review): gate OpenCode 2 busy plugin turn-end touch on notifyTurnEnd * feat(opencode): launch detected OpenCode 2 workers with --standalone OpenCode 2's default launch attaches to the shared background service, which hosts plugins with the service's environment and ignores the pane's OPENCODE_CONFIG_CONTENT. A private server keeps per-worker model, permissions, FM_HOME, and lock ancestry correct. 1.x and undetected versions are unchanged. Ported from kunchenguid#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 kunchenguid#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 kunchenguid#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): 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 kunchenguid#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>
…ude (kunchenguid#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 (kunchenguid#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 (kunchenguid#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 (kunchenguid#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 (kunchenguid#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 (kunchenguid#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 kunchenguid#5349 * test: narrow contribution-input regression to final assembly failure The ARG_MAX transport is already fixed on main by kunchenguid#6830, so keep only the regression proving a failing final jq assembly exits non-zero. * fix: correct Rex secondmate grouping and lifecycle (kunchenguid#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 (kunchenguid#7336) * feat(opencode): add OpenCode 2 support with version-gated launch and plugins OpenCode 2 dropped the v1 server-plugin hook API, so the five fm.primary.* plugins now export a default definition with an id and a setup function alongside their legacy OpenCode 1 server export, backed by a new shared lib/fm-opencode2.js helper; the turn-end guard, watch-arm, cd-check, pretool-check, and sessionstart-nudge install their behavior from setup(ctx) on OpenCode 2 and keep the server entrypoint for OpenCode 1. fm-spawn probes the resolved opencode executable's --version once and branches the launch, model flag, reasoning config, exit key, and busy-state plugin off the detected major. A parsed major >= 2 takes the OpenCode 2 shape (no --model, the model pinned through OPENCODE_CONFIG_CONTENT, a raw Ctrl-C exit, the session.execution.* busy plugin); OpenCode 1.x and any undetected or unparseable version fall back to the 1.x shape (--model, 1.x config, /exit) everywhere. The worker busy-state plugin is always provisioned, but OpenCode 1 keeps the pre-port session.status/session.idle plugin so its busy-state wiring is unchanged, and only a major >= 2 gets the session.execution plugin. Adapter and supervision docs, OpenCode 2 live fixtures, and regression tests for the unknown->1.x launch path and the version-gated busy-plugin shape are included. * no-mistakes(review): gate OpenCode 2 busy plugin turn-end touch on notifyTurnEnd * feat(opencode): launch detected OpenCode 2 workers with --standalone OpenCode 2's default launch attaches to the shared background service, which hosts plugins with the service's environment and ignores the pane's OPENCODE_CONFIG_CONTENT. A private server keeps per-worker model, permissions, FM_HOME, and lock ancestry correct. 1.x and undetected versions are unchanged. Ported from kunchenguid#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 kunchenguid#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 kunchenguid#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 (kunchenguid#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 (kunchenguid#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 kunchenguid#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 (kunchenguid#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>
…ounter loss (kunchenguid#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 kunchenguid#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
… directory is removed (kunchenguid#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 kunchenguid#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 kunchenguid#7672
* 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>
Local tool state left untracked in a home makes bin/fm-ff-lib.sh dirty_status count the home as dirty, so the fleet updater would skip it.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0ae856891
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pair_rc=0 | ||
| FM_SPAWN_NO_GUARD=1 "$FM_ROOT/bin/fm-spawn.sh" "${pair_args[@]}" || pair_rc=$? | ||
| if [ "$pair_rc" -eq "$FM_PROJECT_CAPACITY_DEFER_EXIT" ]; then | ||
| echo "batch: DEFERRED ${pair%%=*} (${pair#*=}) - its project is at capacity, so it stays queued" >&2 |
There was a problem hiding this comment.
Forward upstream consent into each batch spawn
When a batch invocation supplies --upstream-consent and its briefs record matching consent, the parent accepts the flag but never adds it to shared_args. Each child therefore receives empty consent and refuses with upstream-consent mismatch, preventing otherwise authorized tasks from launching. This reproduces even with a single id=repo pair, whereas the equivalent single-task invocation passes the check. Forward the consent flag alongside the other shared delivery-contract arguments.
AGENTS.md reference: AGENTS.md:L198-L198
Useful? React with 👍 / 👎.
A batch spawn re-runs fm-spawn.sh once per id=repo pair with the shared delivery-contract flags but never passed --upstream-consent, so each child whose brief records the consent refused with an upstream-consent mismatch. Upstream has the same gap; the batch case is added beside the single-task consent agreement test.
…namespace Upstream moved the Herdr presentation lock directory to a per-user /tmp/firstmate-herdr-presentation-<uid>, but the fork's cleanup deadline recovery still accepted only the old shared path, so it silently skipped reclaiming the timed-out worker's locks and left the candidate task lock held.
- fm-send-strict: list the fork's --key case window in the tmux stub, since upstream's exact window-membership check now rejects unlisted windows. - fm-watch-wedge-cap: wait for completed cycles through the watcher's cycle-start trace, as the fork's other watcher suites do, because the fork's per-step beacon renewals advance the beacon within a cycle. - fm-spawn-pool-base-freshen: give the cursor stub its --help identity so the foreign-clone case reaches the custody guard, forget each spawn's leftover fake window, and accept the fork's rooted treehouse get in the pool-world stub.
CI run 40030970526 measured the merged host scripts at 895113 ms and 184688 ms, so they replace the 1300000 ms and 900000 ms placeholders.
The upstream merge grew the serial lane to about 12093 s of measured work against nine 1200 s shards, and grew tests/fm-watch-triage.test.sh from 141 to 160 cases and 1570 s in CI, longer than any shard can hold. - Split the triage cases, in order, after the 102nd into tests/fm-watch-triage.test.sh (824285 ms) and tests/fm-watch-triage-late.test.sh (745530 ms) on a shared tests/watch-triage-helpers.sh fixture, as the supervision host suite is split; helpers only one half uses stay in that half. - Raise PORTABLE_SERIAL_SHARDS and the CI serial matrix from 9 to 11. - Refresh every serial hint from the slowest successful FM_TEST_END marker across fork main run 40025805930 and PR run 40030970526, keeping the documented native-Windows measurement and the earlier hint for a script with no successful sample.
|
Final review disposition for head f014949:
Checks: all 22 real checks green on f014949. The "PR must be raised via no-mistakes" check is red by construction for a direct PR of a fork sync and is waived at merge on the captain's instruction. |
Land this with a merge commit, not squash or rebase. The previous sync (#33) was squash-merged, so upstream's history never reached the fork and this sync had to reconcile everything again. A merge commit keeps both parents, so the next sync starts from this one.
What this does
Merges upstream
kunchenguid/firstmatemain into the fork with a realgit merge(merge commit, no rebase, squash, reset, or force).d1617865Fix dropped Claude handbacks with healthy successors (#41)86437e28b42d4fa8(upstream kunchenguid#5566)e06a46fe, the upstream tip #33 squashed into the forkBecause #33 was a squash, Git's merge base is the older
b42d4fa8, which produced 142 conflicted files that were mostly #33's own content colliding with itself.The merge was set up with
git merge --no-commit upstream/mainand its tree was then computed withgit merge-tree --merge-base=e06a46fe, which cut the conflicts to 45 files holding only changes made on either side since that sync.The commit still records the fork tip and upstream tip as its parents.
A second commit, at firstmate's request, adds
.serena/(Serena MCP project cache) and.claude/.headroom_wrap_settings.lock(Headroom wrap lock) to.gitignore, becausebin/fm-ff-lib.shdirty_statuscounts untracked paths and the fleet updater would otherwise skip a home that has them.Non-trivial conflict resolutions
Rule applied: fork behavior wins where it was a deliberate fork decision; upstream wins everywhere else; where both sides added independent behavior, both are kept.
opencode mini --modellaunch, v2-only busy plugin) and refusing OpenCode secondmates because the primary plugins were not ported. Upstream feat(opencode): add OpenCode 2 support with version-gated launch, plugins, and exit kunchenguid/firstmate#7336 has since shipped a version-gated port (1.x and 2.x launch, plugin, and exit shapes) and dual-export primary plugins. Upstream's implementation is taken throughout, and the fork's 2.0-only residue is reverted inbin/fm-spawn.sh,bin/fm-control-lib.sh,bin/fm-busy-lib.sh,bin/fm-harness.sh,bin/fm-remote-doctor.sh(plus theDOCTOR_SHA256pin inbin/fm-remote-entrypoint.sh, re-verified to equal the doctor's hash),bin/fm-remote-secondmate-control.sh,bin/fm-test-run.sh,README.md,AGENTS.mdsection 4,harness-adapters(SKILL andopencode.md),docs/configuration.md,docs/architecture.md,docs/trace-context.md,docs/remote-secondmates.md, anddocs/verification/runtime-backends.md(the fork's 2.0.16 evidence section).tests/fm-busy-adapter-wiring.test.sh,tests/fm-control.test.sh, andtests/fm-spawn-dispatch-profile.test.shtake upstream's versions, and the fork-only live guardtests/fm-opencode-adapter-live-e2e.test.sh, which tested the removed 2.0-only launch, is deleted.bin/fm-dispatch-resolve.sh(both kept, plus a fix). The fork's resolution and dispatch receipts (feat(bin): add head-keyed PR review ledger with opt-in reviewed-head merge handoff #16 and later), itsx-typesafe-request-idheader capture, and its typesafe model pinjev-1.13.0are kept, alongside upstream's new OpenRouter provider. Both sides used a variable namedDISPATCH_MODEL(fork: the--record-dispatch --modelflag; upstream: the provider model fromFM_DISPATCH_MODEL), so a plain merge would have refused every ordinary resolve run with "dispatch profile flags need --record-dispatch". The fork's flag variables are renamedDISPATCHED_HARNESS/DISPATCHED_MODEL/DISPATCHED_EFFORT, the receipt'srequested_modelnow records the model actually sent, and the response-header capture is limited to the typesafe request.docs/configuration.mdand the script header describe both providers and the pin.bin/fm-supervision-host.shmain-only hand-back (both kept). Fork fix: restore main-only watcher handoff before successor start #39 and upstream fix(bin): restore watcher downtime before main-only hand-back kunchenguid/firstmate#6588 fixed the same lost-wake bug in different places: the fork republishes downtime before starting the successor, upstream republishes after it starts and prints awatcher: FAILEDline if that fails. Both publishes are kept (they are idempotent), the fork's nonzero exit after printing the close covers a failed first publish or successor start, and upstream'sFAILEDpath covers a failed second publish. The header comment anddocs/supervision-host.mddescribe the combined order.tests/fm-supervision-host.test.shsplit (fork wins on layout). Fork feat(bin): add in-house merge queue with landing-crew briefs #38 split this suite intotests/fm-supervision-host.test.sh,tests/fm-supervision-host-late.test.sh, andtests/supervision-host-helpers.shfor shard runtime. Upstream's 23 hunks to the unsplit file were ported onto the split layout hunk by hunk, each into the file that now holds its context; the new run-list entries go into the script that defines those cases.bin/fm-branch-prompt.sh,bin/fm-pr-merge.sh,AGENTS.mdsection 7, anddocs/pi-supervision-branch.mdkeep the fork's review-ledger merge path (fix(bin): route away-mode GitHub merges through the review ledger and stop phantom required-check holds #36) and add upstream's--allow-no-pipelineGitLab flag and its away-mode refusal. Inbin/fm-pr-merge.sh, upstream's refusal is placed insiderequire_current_away_authoritybefore the fork'srequire_away_review_merge_decisioncall.bin/fm-brief.sh,bin/fm-promote.sh,bin/fm-spawn.shflags (both kept). The fork's--tests,--budget-*, and--landing-crewsit beside upstream's--upstream-consent,--project, andforgejo/externalforges;bin/fm-dod-lib.shkeeps both new functions.bin/fm-watch.sh(both kept). The fork's per-stepwatch_step_donebeacon renewals (fix(bin): renew watcher beacon after each completed step in slow cycles #24) are kept around upstream's new Herdr project-group and lane-capacity steps and itswatcher_capturedialog read; a failed capture still renews beforecontinue.bin/fm-fleet-snapshot.sh(upstream wins). Both sides moved the contribution input off argv; upstream's version, which also removes its temp directory, is taken.bin/fm-teardown.shandbin/fm-config-push.sh. Fork cleanup paths (budget wake, pane question, sleep marker) and upstream's (Claude settings, Polytoken) are both kept; upstream's status archival functions sit beside the fork's handoff-lib source; the config-push header keeps the fork's asleep-home skip beside upstream's reread obligation.fmx-respond) are carried into upstream's shorter form.harness-adapterskeeps the fork's Rovo fix in the crewmate-only list.docs/architecture.md,docs/captain-hold-lifecycle.md,docs/scripts.md,docs/watcher-continuity.md,docs/verification/dispatch-resolve.md,CONTRIBUTING.md, and the test-family lists inbin/fm-test-run.shkeep both sides' additions.Fixes after the merge
These follow-up commits fix failures the merge introduced in CI or review; none changes behavior on either side beyond the named fix.
bin/fm-herdr-session-cleanup.sh). Upstream moved the Herdr presentation lock directory to a per-user/tmp/firstmate-herdr-presentation-<uid>, but the fork's deadline recovery (feat(bin): add head-keyed PR review ledger with opt-in reviewed-head merge handoff #16) still accepted only the old shared path, so it silently skipped reclaiming the timed-out worker's locks and left the task lock held. It now validates against the backend's own namespace. Both parents passtests/fm-herdr-session-cleanup.test.sh; only the merge failed it.--upstream-consentforwarding (bin/fm-spawn.sh). A batch spawn never passed the shared consent flag to its per-pair children, so every child whose instructions record consent was refused with an upstream-consent mismatch. Upstream has the same gap, so this is not merge-induced; the fix forwards it with the other shared delivery-contract flags, andtests/fm-self-repo-role.test.shgains a batch case that failed before the fix.tests/fm-send-strict.test.shlists the fork's--keycase window in its tmux stub, because upstream's exact window-membership check (fix(bin): stop tmux target checks reporting gone windows as alive kunchenguid/firstmate#7409) now rejects unlisted windows.tests/fm-watch-wedge-cap.test.sh(upstream) waits for completed cycles through the watcher's cycle trace, as the fork's other watcher suites do, because the fork's per-step beacon renewals (fix(bin): renew watcher beacon after each completed step in slow cycles #24) advance the beacon within a cycle.tests/fm-spawn-pool-base-freshen.test.shgives its cursor stub a--helpidentity so the foreign-clone case reaches the custody guard, clears each spawn's leftover fake window, and lets upstream's new pool-world stub accept the fork's rootedtreehouse --root '<pool>' get(fix(bin): bind new Treehouse worker allocations to the spawning clone's Git common directory #8, fix(bin): isolate Treehouse crew pools per project clone #14). Executable verification is unchanged.CI topology change: 11 portable serial shards
The merge grew the portable serial lane past what nine shards can hold, so this PR changes the CI layout in its own commit.
Measured from the slowest successful script markers across fork main run 40025805930 and this PR's run 40030970526, the 248 serial scripts total about 12,093 s against nine 1,200 s shards (10,800 s), and
tests/fm-watch-triage.test.sh, grown by upstream from 141 to 160 cases, alone measured 1,570 s (upstream main run 40002902888 measured it at 1,521 s against upstream's stale 1,075 s hint), so no honest hint set could pass the coverage guard and serial 2 was cancelled at its 30-minute cap.The triage cases are split in order, after the 102nd, into
tests/fm-watch-triage.test.sh(824 s) andtests/fm-watch-triage-late.test.sh(746 s) on a sharedtests/watch-triage-helpers.shfixture, as the supervision host suite is split;PORTABLE_SERIAL_SHARDSand the CI serial matrix go from 9 to 11; and every serial hint is refreshed from those measurements, after which the largest modeled shard packs 1,099,718 ms against the 1,200,000 ms budget.This adds two runners per CI run, and the branch-protection list in
CONTRIBUTING.mdnow namesBehavior portable serial 1through11;docs/fm-test-portable-shards.mdrecords the measurements and method.Test results
CI run 40052253163 on head
f0149494passed every job except the no-mistakes provenance check, which firstmate waives at merge for this direct PR.Script time per behavior job, summed from its
FM_TEST_ENDmarkers (parallel jobs run scripts concurrently, so their wall time is lower):Lint 1-3, Test coverage guard, Repo invariants, Stock macOS Bash snapshot compatibility, and Behavior timing aggregate also passed.
All 248 serial scripts ran across the 11 shards; the triage halves measured 837023 ms and 763007 ms and the host halves 767674 ms and 145433 ms, each within its shard.
Earlier run 40030970526 on the merge head failed on the wedge-cap, strict-send, pool-base, and Herdr cleanup tests fixed above, plus the coverage guard and a serial shard cancelled at its cap, which the topology change resolves.
Disclosed local-only failures (each passes in CI):
tests/fm-pr-merge.test.shcasegithub-zero-exit-queue-requiredfails locally withmise ERROR No version is set for shim: nodeand fails identically on the unmodified fork main snapshot, so it is this machine's toolchain, not the merge.tests/fm-ci-workflow.test.shneeds Ruby to parse the workflow YAML and this machine has none; the same matrix-versus-runner-lane check was reproduced with Python and matches all 11 lanes.tests/fm-watch-triage.test.shtimed out locally while other watcher suites ran concurrently, and does so identically on the pre-split file; it passes in CI.Structure pass
No new modules were written; the resolutions edit existing functions in place.
The largest added logic is the
leave_successor_for_maincaller branch inbin/fm-supervision-host.sh(a few lines) and the provider branch inbin/fm-dispatch-resolve.sh's request block; both stay cohesive within their existing functions.