Repository navigation
feat: sync upstream worker integrations and supervision updates - #29
Merged
Merged
Conversation
…nchenguid#5352) * fix(bin): format, validate, and surface public-followup deliverables brief pre-fills report_path=data/<work-id>/report.md and states the accepted format of every value it cannot know instead of a bare <value> placeholder. fm-public-followup-emit.sh refuses a deliverable tasks-axi would refuse, in both the direct and staged destinations, naming the key, value, and format. consume records the specific deliverable, outcome, or missing key behind a tasks-axi refusal, and each refusal wakes the owning home once through the existing relay poll. * no-mistakes(review): refuse emits missing a required deliverable in both destinations * no-mistakes(review): require promised deliverables and keep rejections recoverable * no-mistakes(review): mirror tasks-axi's canonical pull request URL rule * no-mistakes(review): keep a rejection wake whose line cannot be read * no-mistakes(review): key emit-time rules on the promise, not the outcome * no-mistakes(review): bound deliverable keys and values as tasks-axi does * no-mistakes(review): state rejection wakes as at-least-once and pin it * no-mistakes(review): enforce the promised contract tasks-axi holds at emit * no-mistakes(review): stop inferring a staged promise from its outcome * no-mistakes(document): Refresh public follow-up documentation * no-mistakes(ci): Fixed both CI flakes. Watcher cleanup is now installed before singleton acquisition, preventing timeout races from leaving stale locks while preserving recovery-failure evidence. Bearings render fixtures now publish a valid isolated Lavish session store and retire each listener after rendering, eliminating false unowned-source races. Verified with checkpoint stress, fm-watch-checkpoint, fm-watcher-lock, repeated fm-bearings-board-render runs, project lint, syntax checks, and git diff checks * Revert unrelated CI auto-fix edits to the watcher and bearings board test The CI step's automatic repair changed bin/fm-watch.sh and tests/fm-bearings-board-render.test.sh to chase two intermittent CI failures that also occur on main and are not part of this change. Restore both files so this branch carries only the public-followup deliverable fix. * no-mistakes(review): Refuse a repeated --deliverable key at emit argument parsing * no-mistakes(document): Clarify public-followup validation and rejection-wake documentation
* Add verified Devin CLI worker adapter * no-mistakes(review): Drop Devin resolver refusal and launch marker * no-mistakes(review): Verify devin in bootstrap, fold kind rule, update docs * no-mistakes(document): Document Devin sidecar, resume, and worker-only facts * no-mistakes(document): Document Devin interrupt, liveness anchor, composer signals * fix(control): never pair Devin interrupt presses on an idle agent A fast double Escape on an idle Devin opens its /revert picker, where Enter reverts file changes. fm-control now sends the second press only after the first renders Devin's 'esc again to interrupt' armed hint, never sooner than 0.5 s, closes a revert picker a mistimed press opened with one Escape, and refuses to type the exit command while that picker is open. An unarmed interrupt reports cancel=not-running and leaves the busy record untouched. * fix(devin): disable Claude hook import and commit attribution for workers The per-task Devin config now forces read_config_from.claude=false, so a worker no longer runs the user's or project's Claude Code hooks (including Herdr's Claude agent-state hook), and attribution=false, so Devin adds no Co-Authored-By trailer or Generated-with line to commits and PRs. * test(devin): extend live guard and record Herdr and revert-picker evidence The credentialed live guard now fails if an imported Claude Code hook runs, if the worker's commit carries Devin attribution, if an idle interrupt sends more than one press or opens the revert picker, or if an open picker lets exit through or is closed with a revert. The Devin reference, agent-control doc, and verification records carry the 2026-09-22 tmux and Herdr lab results, including the Herdr exit refusal. * no-mistakes(document): Correct Devin documentation links and lifecycle guidance --------- Co-authored-by: Denis Beliaev <battler73@yandex.ru>
…id#5322) fm-crew-state classifies the no-mistakes outcome 'passed-with-skips' as unknown, so a finished worker awaiting merge is re-alerted as stale. The same blind spot lets fm-teardown's pre-teardown terminal-run check refuse a legitimate abort race that lands on this outcome. Map passed-with-skips to done in crew-state resolution, keeping the skipped publication/CI verification visible in the detail rather than reporting a clean pass, and recognize it as terminal during teardown.
…nguid#5382) * fix: refuse missing backend adapter before source * no-mistakes(review): Gate backend precheck under stock Bash * no-mistakes(document): Clarify adapter precheck docs * no-mistakes(lint): Suppress intentional child Bash ShellCheck warning
…kunchenguid#5338) * fix(test): repair tmux liveness and calm follow-up loaded_off regressions Both self-tests fail on untouched main on a host whose coreutils are a multicall binary and whose Chrome has no pre-warmed profile, and each failure masks the other's file. tests/fm-tmux-agent-liveness.test.sh - the stand-in harness processes were symlinks to the host's `sleep`. A single-purpose `sleep` runs happily under another name, but a multicall coreutils binary (uutils or busybox) resolves its applet from argv[0]: `claude-link -> sleep` invoked under the harness name runs the wrong applet and exits immediately, so no foreground process exists and every positive case reads not-alive ("last verdict for liveness:agent was missing (expected alive); title=sh comms=[sh ]"). Build a dedicated spinner as the stand-in target, exactly the way the version-string case already builds its executable, and require the fallback target to demonstrably survive the rename before using it. Every assertion is untouched; the stand-in identity signal is unchanged (the kernel still records the symlink name as the executable identity). tests/fm-calm-pi-extension.test.sh - render_export_dom pinned a brand-new `--user-data-dir` per attempt. On Google Chrome for Testing 151.0.7922.34 that pristine profile makes Chrome's first-run initialization never complete: the browser and its renderers start, but --dump-dom never returns, so all three bounded attempts end exit=0 timed_out=yes bytes=0 and the DOM assertions never run ("could not render calm-mode HTML export DOM"). Chrome's own profile creation under a fresh HOME renders the same document in about a second, so the helper now gives Chrome a private per-attempt HOME instead of the explicit profile flag. Each attempt still gets an isolated profile, and every DOM assertion is unchanged. Root-cause evidence: a pristine --user-data-dir with `--headless=new --dump-dom` had not returned after 150s, while the same command with an empty HOME and no --user-data-dir returned the full DOM in ~1s, and reusing an already-populated profile also returned it in ~1s. The render failure masked the rest of the file: with it repaired, the Pi follow-up loaded_off case passes unmodified against an installed @earendil-works/pi-coding-agent package. These two failures block downstream validation of every lane on hosts with multicall coreutils or a fresh Chrome profile. Verification: - timeout 300 bash tests/fm-tmux-agent-liveness.test.sh -> exit 0, 16 assertions ok - timeout 700 bash tests/fm-calm-pi-extension.test.sh -> exit 0, 13 assertions ok, including the Pi operational follow-up loaded_off case - bash -n and shellcheck clean on both touched files - rest of tests/: bin/fm-test-run.sh --all bounded by timeout 900 completed 17 files with 0 failures (fm-afk-contract.test.sh through fm-backend-herdr-launcher-workspace-e2e.test.sh), then the bound cut off the 18th (fm-backend-herdr-presentation-e2e.test.sh, a real-herdr-gated lab test) with no failure recorded * fix(test): give wake-queue observation checkpoints the alerting ceiling tests/fm-wake-queue.test.sh's secondmate stall case runs bounded foreground watcher checkpoints whose job is to record an observation, with the alerting checkpoint that follows asserting the stall. A checkpoint's exit publishes a downtime marker, and the next checkpoint consumes it only by reaching the end of the watcher's poll loop, where the recovery surfacing runs after the stall tick; the observation itself is recorded by that same stall tick. On a loaded host a 1s ceiling sits under the cost of that iteration (which includes a pane capture in the active-turn gate), so the observation was never recorded, the downtime marker stayed pending, and the alerting checkpoint surfaced `check: rearm-resurface` instead of the stall it asserts: not ok - a foreign queue with no progress did not alert: check: rearm-resurface not ok - a frozen reprovisioned queue generation was hidden: check: rearm-resurface Give the observation checkpoints that feed a later alert the same 4s ceiling the file already documents for alerting checkpoints. The ceiling is only a bound - a checkpoint still returns on its first actionable wake - so no assertion is weakened, and the quiet windows get longer, not shorter. * no-mistakes(document): docs: correct export-DOM Chrome render root cause * no-mistakes(review): Isolate Chrome profile on macOS, dedupe tmux CC_BIN lookup * chore: re-trigger fork workflow approval for triage --------- Co-authored-by: Captain <blackxwhite88@users.noreply.github.com> Co-authored-by: kunchenguid <kunchenguid@users.noreply.github.com>
…chenguid#5383) * fix(bin): classify a status span without re-folding the whole log A watcher poll could take minutes, so its liveness beacon aged past the guard's 300s grace and the Stop auto-arm reported the watcher down. On the main home, cycles ended with beacon_age 91-235s while healthy and 534-706s while the laptop was CPU-starved. Cause: whenever a newly appended status span held a keyed needs-decision or blocked line, status_span_first_actionable_record re-read and re-folded the ENTIRE log to decide whether that opening was still live, forking several subshells per line. On a remote second mate's mirrored parent channel (1.2MB, ~2300 lines) that is 13-20k subshells, about 17s per log per classification when idle, paid by every signal and heartbeat scan. Nothing regressed recently: subshell counts per classification were 20,272 from kunchenguid#3268 (2026-08-29, which introduced the whole-log fold) and 13,188 from kunchenguid#3753 onward through HEAD. The cost grew with log size, since parent-channel logs only grow. Fix: fold only the captured span. An accepted opening does not depend on earlier lines and only later lines close or supersede it, and every later line lies inside the span, so the span fold names the same live openings at a cost bounded by the span. Old and new classification outputs are byte-identical across 51 span offsets of real-shaped secondmate and ship logs. A real-watcher regression test records every read the classification makes through the span-reader seam and asserts none reaches before the classified offset; it fails on the old code (5,157 bytes read from offset 0 to classify an 84-byte span). * no-mistakes(document): Clarify span classification and watcher regression coverage
kunchenguid#5362 and kunchenguid#4878) (kunchenguid#5381) * test: fix watcher timing flakes in fm-pr-check-security The bounded watcher's hang guard now counts only the watcher's own time: a case marks the intervals where it holds the watcher on injected work or makes it wait on concurrent work, and those no longer count against its budget. The budget itself stays at main's sixty seconds. The helper also stops forcing a one-second per-check timeout, which killed a correct merged poll whenever that poll took longer than a second, so the watcher only retried it or exited on a later check's wake without the merge. The concurrent-publication case pauses the guard while its arming is in flight, and its task now sorts before the contributions observer the arming also registers, so the watcher stops on the poll under test before running that unrelated fleet snapshot. The case also prints the watcher's stderr when it fails. The replacement case pauses the guard while the re-arm runs inside the watcher, runs that injected arming with the fixture root every other arming here uses, and waits on the replacement merge's process instead of a two-second cap. Merged-poll runs retire the contributions observer before the watcher starts, since no case here exercises it. The returned-descendant case no longer races a four-second sleep or a TERM landing at an arbitrary point in the watcher's idle loop: its descendant holds until killed, and a second check in the same cycle witnesses that it was drained and stops the watcher. * no-mistakes(ci): Reproduced the intermittent board-render failure. Its Lavish stub listed an open session but omitted the session-state record required by the listener, so the build could race the listener’s exit. Added matching fixture state; the affected suite passed three consecutive runs, and shell syntax and diff checks passed * Revert "no-mistakes(ci): Reproduced the intermittent board-render failure. Its Lavish stub listed an open session but omitted the session-state record required by the listener, so the build could race the listener’s exit. Added matching fixture state; the affected suite passed three consecutive runs, and shell syntax and diff checks passed" This reverts commit 6a59859.
…enguid#5385) * feat: record task.pr_ready in the fleet ledger when a task PR is registered * feat: record worker status lines in the fleet ledger as they are written * no-mistakes(review): Keep worker status append failures and pass the resolved config to the ledger * no-mistakes(review): Resolve relative config override before embedding in worker command * no-mistakes(document): Clarify fleet ledger status capture timing
…unchenguid#5386) * test: synchronize foreign secondmate stall legs on the watcher's recorded observation Each leg of test_secondmate_foreign_queue_stall_tracks_progress_and_alerts_once ran the watcher under a 1s or 4s wall-clock checkpoint, but every later leg depends on the progress observation the previous leg's watcher recorded. Under load the watcher was killed before its first stall tick, the observation was never written, and the next leg treated its own sighting as the first one, so the stall alert never fired. Run the watcher directly and end each leg on its observable outcome: the progress marker recording the expected observation, or the watcher's own first wake. Also move a comment orphaned above this test back to the drain liveness test it describes. * no-mistakes(review): Wait for full stall reset before stopping watcher leg
kunchenguid#5391) The listener resolves its server from that store before it polls. Without a session for this board, it exits in the gap after the build has already sampled a live claim.
…#5390) * fix(bin): prune a torn-down task's wake rows at teardown Prune pending durable wake rows (.wake-queue) for a task when it is torn down, clearing stale wakes for its target window, signal wakes for its status or turn-ended files, and task-specific check wakes. Fixes kunchenguid#3419. Adjacent to kunchenguid#5252. - bin/fm-wake-lib.sh: add fm_wake_queue_prune_task - bin/fm-teardown.sh: call fm_wake_queue_prune_task in cleanup_firstmate_home_children and main teardown - tests/fm-wake-queue.test.sh: add test_wake_queue_prune_task * no-mistakes(document): docs: note teardown prunes a task's wake rows --------- Co-authored-by: Captain <blackxwhite88@users.noreply.github.com>
…ixture readiness (kunchenguid#5392) * Make portable tests match resolved host paths Summary: - Match macOS full Node command paths by basename in the Gemini behavior test. - Mirror symlink-resolved Nix PATH behavior and give the loaded-host race bounded headroom. Testing: - bin/fm-lint.sh - bin/fm-test-run.sh tests/fm-on.test.sh tests/fm-gemini-harness.test.sh tests/fm-procevent.test.sh Related: - None * no-mistakes(review): Mirror production PATH helper rules per directory group in tests * no-mistakes(test): Wait for orphan runner start marker instead of fixed sleep * no-mistakes(document): Clarify gemini ancestry test comment for versioned node comm --------- Co-authored-by: Sandeep Salwan <salwansa@amazon.com>
…ns (kunchenguid#5389) The sibling secondmate stall cases in tests/fm-wake-queue.test.sh now wait for the watcher's recorded observation instead of a one-second wall-clock checkpoint, so they can neither fail nor pass vacuously under load. Deterministic proof with a 5s watcher launch delay: before the fix 4 cases passed vacuously and 6 failed; after it all 10 pass on the recorded observation. Also includes a CI flake fix from validation: fm_control_harness_supported in bin/fm-control-lib.sh finishes reading the harness allowlist before returning, removing intermittent broken-pipe diagnostics. Behavior is unchanged.
… tail (kunchenguid#5336) * fix(bin): refuse a Herdr submit that would send only a message tail A long typed payload can sit in the composer as a suffix, or as a paste placeholder plus a remainder, and the following Enter was still reported as delivered. Prove the selected composer holds the payload before Enter, and report failure when it does not. * no-mistakes(review): Scope Herdr payload proof to Claude, clear composer on refusal * no-mistakes(test): Clear refused Herdr composer drafts one wrapped row per press * no-mistakes(test): Accept Claude's multi-line paste placeholder in Herdr submit proof * no-mistakes(review): Accept Claude read-back that drops U+2063 in Herdr proof * no-mistakes(document): Document Herdr proof ignoring U+2063 operational mark * no-mistakes(ci): I made a one-line test change. The failing check comes from a timing race in an existing test that this PR doesn't touch. **What failed:** `tests/fm-procevent.test.sh` failed at "the superseded paced runner invoked its stale command" (line ~3313). The PR only changes the Herdr files and their tests, and the same shard passed on main at the base commit. **Why it can fail:** the fixture starts a second runner with a 3-second launch floor (the minimum wait since the source's last launch). That runner sleeps for the rest of the floor and only then checks whether its registration was replaced (`fm_procevent_launch_floor_wait` in `bin/fm-procevent-lib.sh`). The test then waits for the claim and re-registers the source. If that takes longer than about 3 seconds after the first launch, the old runner wakes up, finds its registration still current, and runs the stale command. That produces the second log line the test reports. The CI shard was slow (this one test took 160 s). **Fix:** in `tests/fm-procevent.test.sh` I raised the superseded runner's floor from 3 to 15 seconds and added a comment explaining why. The floor now outlasts the fixture setup even on a loaded runner. Nothing else changed: the first launch and the later fresh-registration start still use a 3-second floor, and no product code changed. **Verification:** - The full test file can't give a reliable result on this machine (load average about 64 on 8 cores). It failed earlier, at the reconcile assertion around line 1680, before it reached this section. - I ran the changed section by itself (file setup plus the pacing-race block) five times with the fix: all passed, in about 9-13 s each. - The original code also passed five out of five, so the race didn't reproduce locally. The diagnosis rests on the code path and the CI log. - I haven't seen the full file or the CI shard pass with the fix yet * no-mistakes(test): Accept Claude folder-trust prompt via down+enter in live e2e * no-mistakes(document): Note unreadable Claude composer refusal in Herdr docs
…unchenguid#5427) Speaking as Kun's firstmate: squash-merging — opt-in (forge=gerrit registry-gated; default project-mode stdout restored to two words), attestation MATCH, CI+NM green, safe review, MERGEABLE.
…uid#5358) * feat(bin): add an opt-in per-home worker account pin A home that mixes work and personal accounts for one runner had no way to say which account its workers launch on: Claude workers inherited whatever CLAUDE_CONFIG_DIR the supervising process had, Pi workers the pane's ambient root, and an ambient API key outranked both, with no signal at launch. config/claude-account and config/pi-account now pin that choice per home. With neither file every launch is unchanged. With one, every launch of that runner from the home (ship, scout, local secondmate, raw Claude command, and relaunch) runs under the declared root, and the spawn refuses before any endpoint exists when the file is malformed or the runner's own check (claude auth status, pi auth check with a model-listing fallback) says the pinned account is not signed in. The check runs in a cleared environment so an ambient credential cannot answer for an empty root. A pinned Claude launch sheds the environment credentials Claude ranks above a stored login; a pinned Pi launch needs an explicit <provider>/<id> model for a declared provider and also carries --provider. The chosen account is printed on the spawned line and recorded in the task record, and relaunch checks the pin before stopping the running agent. * test(secondmate): give the concurrent config-push wait room for a slow host test_config_reread_serializes_concurrent_pushes waited about two seconds for the first fm-config-push.sh to reach its first send-keys. On a slower host that push takes four to five seconds, so the test failed on main before the push ever got there. The loop still leaves as soon as the marker appears, so the larger bound costs nothing where the push is fast. * no-mistakes(review): Refuse raw Claude account overrides under a pin
…ts (kunchenguid#5470) * fix(bin): keep the Herdr lab session option before a -- delimiter fm-herdr-lab.sh run appended --session <lab> after every argument, so a command with a passthrough delimiter such as agent start ... -- <agent args> handed the session flag to the agent and Herdr routed the call by the caller's ambient socket instead of the lab. The helper now inserts --session <lab> immediately before the first -- delimiter and keeps the trailing form otherwise. * no-mistakes(document): Clarify Herdr lab session option placement
* feat(bin): guard the partition, harness pin, and bounded exec for a non-Pi supervision host Lease liveness is now the pure record test in every calling context, so an unmarked main honors a live branch lease held by a separate process, and a lease file engages the guard's claim serialization for any caller; a home with no lease files still takes no lock. bin/fm-harness.sh honors FM_SUPERVISION_PRIMARY_HARNESS while FM_SUPERVISION_ACTOR=branch, so a supervision branch running under another harness resolves own, crew, and secondmate to the primary's harness. fm_tasks_axi's watchdog moves into bin/fm-timeout-lib.sh as fm_exec_timed with a separate grace: the perl watchdog is preferred, runs the command in its own process group against wall-clock deadlines, forwards TERM/INT/HUP, and reaps the group, so a descendant holding captured output can no longer keep the caller waiting past the bound on a host without timeout. The Claude Stop auto-arm header records that Claude drops the exit 2 of a hook it terminated at the configured timeout, re-measured on Claude Code 2.1.281. * fix(bin): state that fm_exec_timed cannot reach a descendant in its own process group Live runs of real Claude and Pi engine turns under the bound showed both CLIs start every tool command in a process group of its own, so those processes end through the engine's own TERM handling rather than the group signal or reap. Also clears the new timeout test's ShellCheck findings. * no-mistakes(document): Clarify cross-harness lease documentation
…henguid#2648) * feat(bin): make the ship-branch prefix configurable per project fm-brief.sh hardcoded every generated ship branch to fm/<task-id>, which leaks that firstmate produced the branch/PR - unwanted for a third-party public repo that does not use this tooling. Add an optional --branch-prefix flag to fm-brief.sh (default "fm/", so existing installs are unaffected) and teach fm-project-mode.sh - the registry's single-owner parser - to resolve a project's optional "branch=<prefix>" data/projects.md annotation via a new --branch-prefix query, order-independent with the existing mode/+yolo tokens. Firstmate resolves the override at task intake and passes it explicitly, mirroring how --mode already works; fm-brief.sh itself never reads the registry. An empty override resolves to a bare "<task-id>" branch rather than a leading slash. All five previously hardcoded fm/$ID sites (branch creation, never-push rule text, definition-of-done text, and the status message) now render the resolved prefix consistently. * no-mistakes(review): Wire branch-prefix intake in AGENTS.md; fix fm-merge-local.sh hardcoded fm/ prefix * no-mistakes(document): docs: document configurable ship-branch prefix in architecture.md * no-mistakes(review): Persist immutable branch contracts * no-mistakes(document): Document configurable ship branch prefixes * no-mistakes(lint): Captain: fix ShellCheck test warnings * fix(bin): map bearings PR rows to their recorded ship branch (kunchenguid#1887) fm-bearings-snapshot.sh keyed a PR back to its task by string-matching the headRefName against the fm/ prefix, so any project whose branch prefix was overridden (e.g. via kunchenguid#2648's branch=<prefix> registry annotation) had its PRs silently drop to task "-" in the bearings view, exactly the third fm/-assumption issue kunchenguid#1887 named alongside fm-merge-local.sh and fm-bearings-snapshot.sh itself. fm-fleet-snapshot.sh now surfaces each task's recorded branch= metadata field in its JSON task rows, and fm-bearings-snapshot.sh cross-references a PR's headRefName against those recorded branches before falling back to the legacy fm/ prefix heuristic, so a custom branch prefix maps a PR back to its real task. Adds a regression test proving a PR opened against a fix/<task-id> branch resolves to that task instead of "-"; confirmed it fails on the prior startswith("fm/") logic and passes with this change. ShellCheck clean; full fm-bearings-snapshot.test.sh and fm-fleet-snapshot-view.test.sh suites pass. * fix(ci): align lint arithmetic-looking assignment and stale Bearings snapshot count - Quote the --branch-prefix want_value assignment in fm-brief.sh, fm-promote.sh, and fm-spawn.sh so ShellCheck SC2100 no longer misreads the plain string 'branch-prefix' as arithmetic shorthand. - Bump the Stock macOS Bash snapshot job's hardcoded Bearings test-count assertion from 59 to 60: this PR added a Bearings test, so the count was stale, not the feature. * no-mistakes(review): fix(bin): honor recorded ship branch in relaunch and review-diff * no-mistakes(document): docs: complete branch-prefix flag in brief and promote headers * fix(lint): quote branch-prefix parser token; drop unused BRANCH_Q after rebase * no-mistakes(review): Restore %q branch escaping in promotion instructions with regression test * no-mistakes(document): document recorded ship branch and prefix flag fm-review-diff.sh's header is the owner of its branch-resolution contract; it still described only the legacy local-branch behavior after the change made review-diff honor state/<id>.meta's recorded ship branch. README's feature bullet enumerates the registry's optional flags and was missing the new branch=<prefix> override. * no-mistakes(lint): Silence SC2016 on intentional single-quoted sed expression * no-mistakes(review): address branch-prefix review findings in DoD and project-mode * no-mistakes(test): branch-prefix suites pass under tasks-axi 0.2.6; environment-only failure * no-mistakes(document): purge stale fm/ branch naming from docs and headers * fix(test): assert the merged epoch status wording in the branch-prefix override test The rebase resolution of tests/fm-brief.test.sh kept the branch's pre-merge \`done: ready in branch ...\` assertion while the merged fm-dod-lib.sh (carrying main's epoch-stamped status line) renders \`done [at=<epoch>]: ready in branch ...\`. Align the assertion so the override-consistency test matches the behavior it verifies. * no-mistakes(review): Address remaining branch-prefix findings in four bin scripts * no-mistakes(test): skip real-tasks-axi tests below the repo's 0.2.6 floor * no-mistakes(document): document spawn's branch-prefix registry deviation notice
…d per-rule confidence floors (kunchenguid#5478) * feat(bin): send dispatch resolver only the brief's task sections * Sent Jev only the scaffolded Captain's intent and Firstmate spec sections, falling back to the whole brief when neither heading is present, so the identical setup, rules, and definition-of-done boilerplate no longer reads as a signal about the task * Added an optional per-rule min_confidence that replaces the global 0.6 floor for that rule; a picked rule below its own floor falls to the most probable other option that clears its floor, or returns ambiguous * Kept files with no declared floor on the exact previous behavior and kept the model blind to the new field * Recorded the live old-versus-new comparison over scaffolded fixtures * no-mistakes(review): share brief heading parser, add kind line, fix floors * no-mistakes(test): stop sending ship delivery mode to jev, keep scout tag * no-mistakes(document): docs: list shared brief heading lib in scripts inventory
* feat(bin): supervision host core behind config/supervision-host Add the supervision host (bin/fm-supervision-host.sh): beside a Claude primary it owns the watcher cycle for the Stop auto-arm and, while the away-posture record exists, hands each wake to a bounded headless Claude engine session that runs the supervision branch's contract - the same generated prompt, row eligibility, wake grant, per-actor drain, outcome store, leases, and away relocation the Pi branch uses. Attended wakes pass straight to main. Every path that cannot finish a wake hands it to main with a supervision-host line; the park ends itself before the Stop hook timeout with a cycle-boundary wake. - bin/fm-supervision-engine-lib.sh: opt-in parse, verified engines (claude, default sonnet), one bounded engine turn, and a reap of engine tool processes that sit in their own process groups. - bin/fm-branch-report.sh: the command twin of fm_branch_report, scoped to the tasks the current host turn claimed. - bin/fm-branch-dispatch.mjs: command entry to the Pi dispatch module, so eligibility and the wake prompt have one owner. - bin/fm-claude-stop-autoarm.sh runs the host in the arm's place when config/supervision-host exists; nothing changes without the file. - bin/fm-watch-arm.sh --stop: home-scoped stop without a re-arm. - bin/fm-lease-lib.sh: an opted-in home takes the lease-command lock for unmarked main too, closing the first-claim race; the refusal tells the caller to leave the lease alone and retry. - /afk launches no away daemon on an opted-in Claude home; /quiet still does. Session start renders the host's main-side protocol there. * fix(bin): relay a host turn's outcomes when the captain returns mid-turn, and log per-turn engine cost Live validation found two supervision host gaps. A captain who returns while an engine turn is running gets a return brief rendered before that turn's outcomes exist, so the host now hands the close to main with those outcomes. Claude reports a resumed conversation's running cost, so the engine lib now derives each turn's cost from the total the host records, and the host log records every close's destination. * docs(verification): record the supervision host's live evidence The dated live results behind docs/supervision-host.md: the Claude engine's live guard, the away-wake cases against real workers, the engine's cost reporting, and the flag-off before-and-after regression. * docs: describe the supervision host ledger as covering every close * no-mistakes(review): Harden supervision host ownership, boundary, ack, and late outcomes * no-mistakes(review): Recheck park boundary just before starting an engine turn * no-mistakes(review): Cap park boundary, deliver all host lines, reject incomplete results * no-mistakes(document): Correct supervision host documentation and stale pointers
…t-in, and delivery (kunchenguid#5506) Attestation MATCH; contract-class restore; CI/NM green. Squash-merged by Kun's firstmate.
…kunchenguid#5528) * fix(bin): bound the startup-network worker's lock waits by its budget Fixes kunchenguid#5377 The deferred startup network worker bounded its sweeps with a stage budget but took the publish lock and the fleet-lock lease with an unbounded wait, so a live holder of that lock kept the detached worker alive for hours past its timeout with its output discarded at the end. Every wait now goes through the bounded acquire and shares the remaining stage or delivery budget; a lock a live process still holds at the deadline ends the worker with a failed record naming the holder and the rerun command, and a wake so the result surfaces. * no-mistakes(review): propagate publish exit code from cmd_run terminal paths
…dth (kunchenguid#5517) * fix(bin): keep the ps fallback identity independent of terminal width fm_pid_identity's portable fallback read the command column at the ambient COLUMNS width, so an identity recorded from a wide shell never matched the one recomputed inside a narrow hook and the continuity guard denied every fleet command. Pass -ww so the column is never cut. Fixes kunchenguid#799 * no-mistakes(ci): Fixed CI failure in Behavior portable serial 4. Root cause: the -ww flag added in commit ac7ab5d to fm_pid_identity (bin/fm-wake-lib.sh) shifted the ps argv so $1 became -ww instead of -p, breaking the positional fake-ps fixtures in tests/fm-procevent.test.sh (lines 2736, 3571) which then fell through to real ps and failed the fm-procevent test. Fix (already applied in the worktree, matching the authoritative user instruction exactly): replaced -ww with a COLUMNS=10000 environment pin so the call is COLUMNS=10000 LC_ALL=C ps -p "$pid" -o lstart= -o command=, mirroring fm_pending_reply_pid_identity in bin/fm-pending-reply-lib.sh:982. argv is back to -p PID -o lstart= -o command=, so the fixtures match again with no fixture edits. Comments above the call in bin/fm-wake-lib.sh and in test_pid_identity_is_terminal_width_invariant (tests/fm-watcher-lock.test.sh) now describe the COLUMNS pin instead of -ww; the regression test still asserts narrow-vs-wide byte equality and the full command. Verified: the terminal-width-invariant regression test passes. The only local not-ok results were flaky, run-varying timing tests (procevent launch/claim confirmation, listener reparenting) that differ each run and are unrelated to the ps argv change
…thorized intent (kunchenguid#5526) Fixes kunchenguid#3608 When a scout is promoted to a ship, the captain's authorized intent is extracted from a legacy `# Task` body by matching `Captain:` and `[captain]` lines anywhere in the body, including inside fenced code blocks and indented examples, while the heading reader already tracks fences. A fenced `Captain:` example therefore passed the provenance gate and became the ship contract's intent while the real ask was dropped. Make the captain-words extractor fence-aware like the heading reader: a line inside a ``` or ~~~ fenced block, or indented four spaces or a tab, is never a marked line. The promotion and spawn callers need no change. The regression test covers both the extractor and the promotion provenance gate refusing a brief whose only Captain lines are fenced or indented examples.
…riefs (kunchenguid#2868) * fix(bin): forbid administering the shared worktree pool in crewmate briefs A crewmate ran a `git worktree remove` loop over the treehouse pool its own worktree came from, destroying five worktrees - four belonging to tasks that were running mid-pipeline. The generated brief's rule 2, "stay inside this worktree; modify nothing outside it", is a rule about files: removing a worktree is administration of shared state, not an edit outside a directory, so the sentence never reached the act. The worker satisfied its brief completely. Rule 7 already named one piece of shared infrastructure - the no-mistakes daemon, one instance serving every lane - with the reason stated plainly. The worktree pool is the same class of thing and was unnamed. Fold the pool into that existing rule rather than adding a second warning: state the constraint around the act (create, remove, return, prune, move, reassign a worktree or pool slot; write into a sibling slot), keep concrete commands as examples rather than as the definition so no single provider is pinned, and give the prohibition a real exit through `blocked:`. The rule is emitted from one shared string interpolated into both crewmate scaffolds, so the ship and scout copies cannot drift apart. The secondmate charter deliberately omits it: that home runs its own fleet and legitimately allocates and returns slots for its own crewmates. Contract text only; no runtime enforcement layer. * no-mistakes(document): Distill pool-safety comment rationale * no-mistakes(review): align pool-rule test grep patterns with emitted [at=<epoch>] text
… a dispatch record (kunchenguid#5524) * fix(bin): refuse tasks-axi add --start so In flight always has a dispatch record Fixes kunchenguid#4753 Dispatch (bin/fm-spawn.sh) is the only path that moves a backlog row to In flight, because it creates the task record, status file, and inbox that go with the row. A row hand-placed there through the wrapper's `add --start` had none of those, and nothing later noticed, so the live-task count included work nobody was doing. The wrapper now refuses `add --start` (exit 2) and names the dispatch path; plain `add` and `start <id>` pass through unchanged, and the lifecycle transitions address tasks-axi directly so dispatch is unaffected. The issue's other half, a reconcile sweep in bin/fm-inactive-reconcile.sh that notices an In flight row with no task record, is left as is; this change closes the only path that creates such a row. * no-mistakes(review): refuse create --start alias, not just add --start * no-mistakes(review): reword add --start guard docs to drop only-path overclaim * no-mistakes(review): scope add/create --start guard docs, drop universal claim
…#5503) * feat(bin): run the supervision host beside the other non-Pi primaries while away Cursor's stop-hook park, the OpenCode plugin, the omp watch extension, Grok's model-owned background arm, and Codex's foreground checkpoint now run bin/fm-supervision-host.sh in the watcher arm's place when the home opted in with config/supervision-host, so the host's Claude engine takes away-posture wakes beside those primaries exactly as it does beside Claude. Without the file nothing changes. - The host streams its first cycle's status line, accepts --restart and the owner's predecessor arm for its first cycle, and prints each exit in one write, so owners that wait for arm readiness and restart their own successor (OpenCode, omp) keep their handling handoff. - Codex's checkpoint passes its bound to the host as the park boundary, raises it to FM_CODEX_WATCH_CHECKPOINT_AWAY (3600 s) while the away record exists, and lets an engine turn that starts before the bound finish after it (FM_SUPERVISION_HOST_PARK_LIMIT). - /afk launches no away daemon on an opted-in home of those harnesses and says so at entry when the file selects no engine for that primary. - Session start renders the host protocol for each arm owner, and Grok's arm command becomes the host. * fix(bin): keep the watcher-down banner away from the supervision branch actor A supervision host's engine turn runs guarded commands after its successor watcher cycle may already have closed on a newer wake, so the guard showed it the watcher-down banner with the primary's repair line. Under a Codex primary pin that line is the checkpoint, and a live Codex lab run showed the away session running it mid-turn (the nested host stood down on its ownership check). The branch actor never owns watcher continuity, so the banner, its reminder, and the episode state now leave that actor out, as the queued-wake warning already does. The lint telemetry fixture counts bin/fm-afk-launch.sh's source directives, which the host engine note raised from four to five. * fix(bin): queue away-session outcomes recorded after the return for main A Cursor park superseded by the captain's return stops its host as the engine turn ends, so the host's own handoff of that turn's outcomes was never printed and the outcomes never reached main. The report surface now queues every outcome it records after the away record is gone as a durable check wake; the return owner archives the record before it reads the store, so each outcome is in the return brief, queued, or both. A host stopped mid-turn also removes its turn's result and error files. The stream test now acknowledges its first close and accepts a restarted cycle that closes on its resurface before the arm confirms it. * fix(bin): clear a hard-killed host's turn at the next activation A Cursor park superseded mid-turn can kill its host outright, which runs no cleanup, so the turn's result, error, and descendant files stayed behind and any tool process the engine started was left running. The next host's activation now reaps the descendants that turn recorded and removes its files. The host suite also registers its homes in a file, because make_home runs in a command substitution, so its cleanup now stops every host a case leaves running. * fix(bin): leave rows that arrive after main's drain unclaimed at its acknowledgement Main's acknowledgement re-claimed every unreserved queued row, including one that arrived after the drain above the acknowledged cutoff. That row stayed main's without ever being shown to it, so while away the supervision host refused every later wake that included it and handed each back to main until main drained again. The acknowledgement now claims only unreserved rows at or below its cutoff. * docs: name the killed turn's engine and files in the host's failure direction * docs: record live supervision host runs on the non-Pi primaries * no-mistakes(review): Replay host-only supervision boundaries across omp session replacement * no-mistakes(review): Deliver omp supervision-host wakes only at the host's close * no-mistakes(document): Correct supervision host documentation for non-Pi primaries * no-mistakes(ci): Fixed the CI failure by naming FM_CODEX_WATCH_CHECKPOINT_AWAY in the rendered Codex host instructions. The focused instruction and checkpoint suites pass
) * feat(bin): auto-relaunch dead persistent secondmates during ordinary supervision A persistent secondmate whose primary agent exits mid-session previously stayed down until the next session-start liveness sweep. Extract the sweep's probe/classify/relaunch mechanics into a shared library and drive the same contract from a cadence-gated watcher tick, so a positively dead or missing endpoint is relaunched through the guarded spawn path within a poll cycle instead of an hour later. Only the recovery-grade `dead` and `missing` verdicts authorize relaunch; ambiguous, unreadable, unverified, and unreachable-remote reads stay fail-closed and a remote route is never replaced by a local endpoint. Each relaunch emits exactly one `check` wake and appends to a durable per-mate ledger; a mate exceeding the bounded attempt budget is parked behind a marker until a live probe rearms it. A per-mate liveness lock serializes the tick against a concurrent session-start sweep. * no-mistakes(review): Fail closed on relaunch ledger errors; clear state on remote teardown * no-mistakes(review): Share ledger read guard; retire relaunch state under liveness lock * no-mistakes(review): Lazy-load wake lib; live rearm restores full relaunch budget * no-mistakes(review): Finish liveness tick for every mate before waking once * no-mistakes(review): Keep liveness tick scanning past per-mate errors, then wake * no-mistakes(review): Wake only on queued rows; teardown holds liveness lock * no-mistakes(review): Queue liveness outcome wake before releasing mate lock * no-mistakes(document): Update secondmate liveness documentation for mid-session recovery * no-mistakes(lint): Fix empty assignments flagged by ShellCheck * no-mistakes(ci): Added ShellCheck analysis boundaries for the shared liveness library in both callers and marked its result globals as intentional library outputs. Changed-file lint passed; full CI partitions were not run locally * no-mistakes(ci): Fixed Lint 2 by removing an unused test variable in tests/fm-wake-queue.test.sh. ShellCheck, bash syntax, and the full wake-queue test script pass * no-mistakes(ci): Fixed the CI wake-queue fixture: stall-only watcher legs now seed the liveness cadence marker, preventing the new endpoint probe from interfering with their assertions. The full wake-queue test, ShellCheck, and diff checks pass locally
…cycle ends (kunchenguid#5550) * fix(bin): start a successor when the Claude Stop-hook arm's attached cycle ends Fixes kunchenguid#2381 When the Claude Stop hook's foreground arm attached to a peer watcher cycle and that cycle ended, the arm reported the delivered wake and the hook exited 2 without starting a successor, so the handling turn ran with no watcher. Pi, omp, and OpenCode start the next arm before delivering the wake and pass the closed arm's pid as FM_WATCH_PREDECESSOR_ARM_PID; the Claude hook never passed that predecessor identity. The hook now runs its arm as a tracked child it waits on, so it holds that arm's pid, and after any actionable close starts one handling-successor bin/fm-watch-arm.sh with the closed arm's pid as FM_WATCH_PREDECESSOR_ARM_PID. The successor is launched the one way a process outlives a Claude hook's exit-2 rewake (nohup, detached stdio, own process group, the shape bin/fm-startup-network.sh already uses); the hook waits for its status line and adds one banner line when no live watcher was confirmed, never withholding the wake. The supervision-host path is unchanged, as is the arm wrapper. The regression test drives the real hook against an arm fixture whose attached peer cycle ends: it fails on the previous tip because no successor starts, and now asserts the successor names the closed arm as its predecessor and outlives the rewake. A second case pins the unconfirmed-successor banner line. docs/watcher-continuity.md no longer records the Claude asymmetry. * no-mistakes(ci): Serial-4 failure was a real regression: tests/fm-session-lock-ancestry.test.sh asserts exact cumulative arm-invocation counts while driving the real fm-claude-stop-autoarm.sh hook against a stubbed fm-watch-arm.sh. This PR makes the hook start a handling successor after an actionable close, so every owned actionable phase now records TWO arm invocations (foreground arm + successor) instead of one, breaking "healthy chain: expected 1 arm(s), got 2". Fixed by updating the cumulative expectations to match the new behavior: owned phases 1/2/6 -> 2/4/6, foreign carry phases 3/4/5 -> 4, plus a comment explaining the +2-per-owned-phase model. Verified: phase-1 (the CI failure point) now passes on every run, syntax checks clean, and sibling arm-count tests (fm-claude-stop-autoarm.test.sh, fm-cursor-primary, fm-turnend-guard) pass unchanged. The only remaining local not-ok is a WSL-only environmental artifact (orphan reparents to a subreaper, not PID 1) that passes on the CI runner. Parallel-1 failure is an unrelated flake: its 11 tests (fm-lint, fm-pr-merge, fm-test-run, fm-cd-pretool-check, fm-pi-primary-types, fm-grok-harness, fm-composer-lib, fm-review-diff, fm-tmux-submit-busy, fm-composer-ghost, fm-brief) do not include fm-session-lock-ancestry and none reads any file this PR touches; all pass locally. It should clear on CI re-run. Made the smallest root-cause fix (one test file, 6 count updates + a clarifying comment). Validation of the branch continues through the no-mistakes pipeline, which owns re-running CI
…guid#6380) * fix(cursor): verify cursor-agent by running it, not by name Cursor's installer writes its `cursor` IDE shim through the ~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned cursor-agent with a script that only prints "No Cursor IDE installation found" and exits non-zero. That file keeps Cursor's own name and install-tree path, so the name shortcut (and the structural check alone) accepted it and every Cursor spawn launched the broken file instead of the working agent alias. A launch candidate now has to print Cursor's CLI identity under the bounded probe, or carry the structural evidence and run --help successfully. Hosts without a bounded runner keep the structural verdict, as before. * no-mistakes(document): Align cursor launch-verify docs with runtime * no-mistakes: apply CI fixes * test: restore fm-watch-triage ack_stopped_cycle assertion The CI fix round loosened ack_stopped_cycle so a drain that prints no acknowledgement command and exits zero counts as success. That test is unrelated to the Cursor executable verification this branch changes, so restore its original assertion rather than mask a watcher failure here. * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * fix(bin): restore fm-afk-contract clock sampling A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch. That away-mode behavior is unrelated to the Cursor executable verification this branch changes, so restore it here and leave any fix to its own change. * fix(cursor): load the timeout library only when a probe runs Sourcing bin/fm-timeout-lib.sh at load time made every consumer of fm-cursor-lib.sh, including the session-lock and turn-end hook paths that never probe, depend on that file being next to it. Load it lazily from the probe instead. * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * test: restore herdr focus-flash e2e test A CI fix round edited this Herdr end-to-end test, which is unrelated to the Cursor executable verification this branch changes. Restore it here and leave any fix to its own change. --------- Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>
…#7422) * fix(dod): require a PR reference in CI-ready notes * no-mistakes(review): Recognize Forgejo plural pull request URLs
…ts view (kunchenguid#7434) * feat(herdr): opt-in project groups with status tags and a sorted agents view Add config/herdr-project-groups (absent or off: unchanged behavior). When on, Firstmate tags each Herdr task pane, and its own projected workspace, with display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents view sorted by group then status (needs-captain, problem, running, done), and places a new projected task at the end of its own group inside the parent block with the same single verified move as before. The watcher reconciles tags once per poll and a spawn tags its task at once; bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends suggested sidebar rows with a backup. The agents view helper needs python3. The only test-runner change is the serial weight hint for the new suite. * docs(herdr): record the live lab check of project groups The four hand checks for tags, the sorted agents view, placement at the end of the group, and clear passed against a real Herdr 0.9.5 server (protocol 22) in a guarded lab session. * docs(herdr): align project group verification notes with the live check
…guid#7410) ps -o lstart= renders in the caller's locale, so a lock or claim owner recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity verification under another, was declared dead, and a second worker split the queue: two serve loops reclaimed and reaped each other's live jobs, which vanished mid-claim and failed staged jobs with exit 125 and no output. Pin LC_ALL=C in fm_remote_job_process_start and pin the cross-locale invariant with a regression test. Co-authored-by: researchworldwide2026 <researchworldwide2026@gmail.com>
* Guard fm-crew-state overrides by task-name basename bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name. An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory. A snapshot's own override, which names the task it was captured for, is still honoured. This is complementary to kunchenguid#5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task. Regression tests cover a mismatched override being ignored and a matching one being honoured. * no-mistakes(review): Make metadata override tests behaviorally distinct
…kunchenguid#7415) * fix(bin): re-anchor a Claude session's lock so /clear keeps ownership A same-session confirmation over a live lock line 1 outside the current harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor under the claim lock, so a later /clear re-key in the same process is still proven by ancestry instead of being refused as a foreign owner. Fixes kunchenguid#6820 * fix(bin): move task leases with a session-lock re-anchor A same-session re-anchor rewrote lock line 1 off a live pid while task leases still named that pid, so a lease held by main or the supervision branch read as stale and the other actor could claim the task. The re-anchor now takes the lease-command lock after the claim lock and, in the same critical section as the line-1 write, rewrites leases recorded against the old pid to the new anchor (fm_lease_rekey_holder). If the lease-command lock stays busy past a short bound, the confirmation keeps line 1 as before and a later acquisition re-anchors. The foreign-owner reproduction now asserts the re-anchor contract: the same trusted id from a live process outside the owner's ancestry moves line 1 onto that process's CLAUDE_PID, and a different id is refused against it afterwards. The ancestry membership loop is shared through one session-lock lib helper. The earlier commit dropped the ancestry suite's dead-front-end reclaim phase; that coverage lives in the existing reclaim tests (test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's test_reclaims_stale_session_lock_before_arming). * fix(bin): record the lock holder for a lease pinned before a re-anchor The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the start of each engine turn. A same-session re-anchor inside that turn moved line 1 to a new pid while the pinned holder stayed alive, so a later claim or same-actor refresh in the turn recorded the old pid and the lease read stale, letting main claim the branch's task. A claim now records the live line 1 when the pinned holder is alive but is no longer line 1. Another session takes the lock only from a dead owner, so that state comes from a re-anchor; a dead pin is still recorded as before and its lease stays stale. * no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor * no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment * no-mistakes(review): Correct lock takeover and re-anchor signal-window comments * no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence * no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder
* feat(bin): watch a tool's published version through version_url A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry. * no-mistakes(review): Compare published versions against newest installed tool copy * no-mistakes(document): Clarify watched-tool version URL documentation
…mand loads them (kunchenguid#7287) * fix(pi): keep a live session's extension markers when a nested Pi command loads them A short-lived Pi command started from inside a live session, such as the `pi --help` capability probe, auto-loads the two primary extensions. Both treated the session lock as owned because an ancestor holds it, so the child rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with its own pid and exited. Session start then rejected the markers and printed a false `PI_WATCH_EXTENSION: not loaded` alarm. Before writing, each extension now reads the marker's pid and leaves the marker untouched when that pid is a live strict ancestor of the current process. A missing marker, a dead pid, the current pid, or a live pid outside the ancestry still writes as before, so a fresh start and a relaunch over a dead session bind unchanged. Lock ownership and the reader are untouched. Fixes kunchenguid#5202. * fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them
* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart
An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.
* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims
* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid
* no-mistakes(review): exercise real lock recovery in orphan supersession tests
* no-mistakes(review): record lock-holder pid-identity instead of bare pid
* no-mistakes(document): complete autoarm claim-open coverage list
* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix
* no-mistakes(document): Clarify auto-arm claim documentation
) * wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration) * feat: verify the polytoken worker adapter (crewmate + scout) Add polytoken 0.8.19 as a verified crewmate/scout adapter on the captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection and backend parity while the control verbs ride the session daemon's typed REST API. Detection is ancestry alone on the anchored polytoken comm (a tool subprocess's parent is the session daemon, verified live), with the launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed harness-identity set. The launch generates the per-task worker config dir (mirrored operator config with the unattended permission posture enforced, because a project config.yaml fully replaces the global config), the worker role-contract facet (no model pin, delegation and facet switching denied at the tool registry), and the worktree hook layer binding the verified busy pair - pre_user_prompt and pre_model_turn open, stop closes - to a no-argv generated writer. The readiness gate binds the session id, port, and credential into task metadata through sessions --format json and fails loudly on any first-start dialog, because the license terms are a blocker by captain decision and --accept-license-terms is never passed. Interrupt is POST /turn/cancel with its typed settle (the TUI has no interrupt chord, so no key is ever improvised), exit is /quit, and a cancelled turn's busy close is written by the control plane because no stop hook fires. The composer is the verified separated shape with polytoken as its second owner, and Enter mid-turn queues, so the busy-queued conversion applies. Crewmate and scout only: a secondmate launch is refused, and a project's own .polytoken/hooks.json is refused rather than clobbered. * no-mistakes(review): Fix polytoken launch flag order, token argv, live guard * no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant * no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim * no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing * no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files * no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring * no-mistakes(document): Note teardown as consumer of harness wiring-path table * no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring * no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms * no-mistakes(document): Note relaunch also skips git-tracked wiring paths * test: stub polytoken in the refused-relaunch fixture The refused relaunch onto polytoken resolves the polytoken binary before its hook-layer refusal, so the case failed on CI hosts without the real CLI installed. A no-op stub on the fixture PATH stands in; it is never launched. * no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths * no-mistakes(review): Snapshot busy record after cancel settles before idle close * no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck * no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary * no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal * test: preserve Polytoken hook refusal coverage with explicit pins * no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker * no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker * fix: scope worker wiring cleanup to Polytoken * fix(bin): point Polytoken workers away from tool_flow for the task directory Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read refuses the Firstmate task directory while the direct file tools reach it under the generated bypass matcher. The worker facet now says so, and the verification record carries the live evidence. * fix(bin): leave the pool as found when a fresh spawn fails A fresh spawn that fails and leaves no task record now closes the endpoint it opened before its launch was delivered, so the shell whose treehouse get leases the slot ends and the pool gets the slot back. It also removes the harness wiring, task temp root, and staged launch file it wrote, and drops its slot claim under a retaken project lock after metadata publication. * no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes * fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken The failed-spawn pool cleanup and the Running-for busy row now apply only to Polytoken, so every other harness keeps main's abort behavior, header text, operator messages, and harness-less busy union. Tests prove the Polytoken path cleans up and a non-Polytoken refused launch behaves as on main. * no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity * no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window * test: track the spawned window in the Polytoken harness tmux stand-in Main now requires exact tmux window membership before sending keys (aa9ab04), and the Polytoken harness stand-in listed no windows, so the merged spawn could never deliver Enter. Record the created window, list it, and forget it on kill, as tests/fixtures.sh does. * no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns * no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change * no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions * no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ne (kunchenguid#7450) Port the reported-check fallback and regressions from df60538. Preserve required-only reporting when required checks exist and refuse failed fallback reads.
* fix(tests): clean read-only relaunch fixtures Use the shared fixture cleanup so generated read-only Git hook directories do not leave permission errors and temporary trees behind. * fix(accounts): support durable per-secondmate account pins Resolve optional primary-home secondmate account files through the worker pin parser and checks. Preserve existing defaults when no override exists and re-read the selected pin on spawn, relaunch, and recovery. * no-mistakes(review): Name the rejected pin file in account refusals * no-mistakes(document): Document per-secondmate account pins in relaunch and layout docs
…unchenguid#6958) * feat(watch): consult opt-in operator guards before a wedge escalation Add config/wedge-evidence-guards, an opt-in list of operator-owned guard executables that the watcher's at-threshold wedge branch consults after the wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX consecutive deferrals recorded beside the other wedge-window records, and the escalation that ends a capped run names the guard and its reason. Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an untrusted config or guard is never run. With the config absent the ladder is unchanged. Refs kunchenguid#6919 * no-mistakes(document): Document wedge-evidence-guards in home layout index * no-mistakes(document): Align jev-guards CRITICAL verdict with bounded deferral
…guid#7460) * fix(bin): make the brief's inbox listing succeed on an empty inbox The worker brief told crewmates to list the inbox with a bare *.msg glob. On an empty inbox that glob fails: bash ls exits 2 and zsh aborts with 'no matches found'. Use find piped to sort -V so the listing is silent on an empty or absent inbox and keeps numeric order past 999. Refs kunchenguid#7244 * no-mistakes(review): Make relaunch note inbox listing safe when empty
…unchenguid#7394) * fix(bin): fit remote second-mate convergence inside the startup network bound The deferred startup network stage (120s) timed out once four second mates were remote: the mates already converge concurrently, but each mate's inheritance push sent its fifteen allowlisted items one SSH round trip after another, so a single mate's convergence took 64-76s after a ~16s liveness pass. - fm-remote-inherit-push.sh validates and snapshots every item locally first, so a local refusal now sends nothing, then sends the items up to FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in allowlist order. A failed item still fails the push with its own error, and no further item is started after it. The receiver is unchanged: each item is its own file and generation record, and the host's job worker still runs one home's commands one at a time. - fm-bootstrap.sh gives each remote mate's convergence its own budget, FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry marker, instead of holding the whole stage past its bound. * fix(bin): nudge a remote second mate to re-read only when something changed Each remote convergence attempt records its retry marker before it starts, so a sweep cut off by the startup network bound or failing before any change left a marker that made the next session start nudge every remote mate even though its instructions and inherited files were unchanged. The marker now records whether a re-read is owed, set only once an attempt actually changed the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/, or .agents/skills/ no longer counts as a change. * fix(bin): keep a remote mate's re-read owed when its convergence is cut short A convergence step stopped by the per-mate budget loses its output, so a push that had already applied an item reported nothing and left the retry marker with no re-read owed; the next start then saw every item unchanged and never told the mate to re-read. A step cut off by the budget now marks the re-read owed, and so does a failed push whose output shows items it had already pushed or removed. The lifecycle e2e suite runs every remote leg through the real entrypoint and job worker on the test machine, so it now gives convergence ample time; the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose budget and failure cases are also made independent of machine load. * no-mistakes(review): Keep re-read owed on partial or unknown completion * no-mistakes(review): Persist owed re-read when killed mid-mutation * no-mistakes(document): Fix stale remote re-read owed docs * test: send inherited items one at a time in the remote lifecycle e2e fixture Behavior portable serial 5 failed on the watcher auto-relaunch leg of tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push started overlapping its sends. Across 14 recent main CI runs that suite's remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range, while legs that push nothing were only 5-10% slower. The watcher relaunch is a remote spawn, and the only changed code on that path is the inheritance push. This fixture's transport has no network latency and its job worker runs one home's commands one at a time, so overlapping sends cannot hide any round trip there and only add submission overhead to every remote spawn. The suite now sends one item at a time, as it did before; the overlapped scheduler stays covered by tests/fm-bootstrap-network-parallel.test.sh, and the production default of four is unchanged. The watcher leg's failure now also prints the watcher's output. * no-mistakes(document): Clarify remote re-read obligations and consolidate documentation * fix(bin): record a remote mate's re-read as owed before convergence can change its home A live run against a real remote second-mate home showed the owed re-read still lost when the startup network bound stopped the stage. That bound stops it the way `timeout -k 1` does: TERM to the stage's process group, then KILL one second later. Bash defers a TERM trap while the convergence worker waits in a command substitution, and the remote call runs in its own timed process group, so the KILL landed before the trap could record the re-read. The remote home had already applied the change, the next start saw every item unchanged, sent nothing, and deleted the marker, so the mate was never told to re-read. Bootstrap convergence and config-push now write the record owed before any remote step can change the home, and write it back only after the attempt has reported: removed after confirmed unchanged convergence or a successful send, and back to owed=0 when a failed attempt's outcome proves nothing changed. A kill at any point therefore leaves the re-read owed. The TERM/INT traps are gone. The kill regression now sends TERM and then KILL one second later, as the startup bound does; it fails on the previous head and passes here. * no-mistakes(document): Clarify convergence timeout scope and consolidate reread documentation
…d#6987) * fix(bin): refuse spawn into a project with an unborn HEAD Spawn into a repository with no commit waited 60s for treehouse and then reported that the worktree was the spawning project itself, never naming the cause. Refuse before the wait and name the unborn HEAD and the remedy. The project-management skill now states that a new local repository needs a first commit. * docs(skills): tell the captain a new project needs a first commit The Create a project step no longer reads as firstmate committing into the project. It states that spawn refuses an unborn HEAD and that the captain is told the project needs a first commit. * test: give spawn fixtures a first commit for the unborn-HEAD refusal * no-mistakes(review): Commit foreign consent fixture so spawn guard passes
…log items for GitLab MRs (kunchenguid#7462) * feat(bin): add an attended GitLab --allow-no-pipeline merge waiver A GitLab repository that deliberately runs no merge request pipeline could never be merged through fm-pr-merge.sh: the guard requires a successful head pipeline at the current head, and GitLab has no per-check waiver. --allow-no-pipeline waives only the pipeline condition, and only when GitLab reports head_pipeline as present and null. A failed, running, canceled, or stale pipeline still refuses, every other condition (open, mergeable detailed_merge_status, no conflicts, discussions resolved) still holds, and the verified head is still passed to glab as --sha. The flag is attended-only (refused while the away-posture record exists), GitLab-only, and takes no value; without it the default refusal is unchanged. * fix(bin): close a GitLab merge request task's backlog item with a note tasks-axi accepts a --pr link only as a GitHub or Forgejo pull request, so after a GitLab merge request landed, teardown could never complete the backlog Done transition and left the close pending forever. Extend the existing Gerrit carve-out in fm_backlog_done and fm_backlog_retain, and the captain-hold answer replay that shares it, to record a GitLab merge request URL as a "GitLab merge request <url>" note, until tasks-axi accepts GitLab merge request URLs. GitHub and Forgejo pull requests are still recorded as pr links. * no-mistakes(document): Note GitLab --allow-no-pipeline waiver in merge-watch record
Import changes since 87fa81b using that content base. Preserve fork board, Pi continuation, composer and replay behavior. Require FM_LINT_MEMORY_FALLBACK=1 for the narrower ShellCheck retry.
…cap from 12 to 16 GiB without reducing diagnostic coverage. Both previously failing roots and both modified files pass locally. The broader regression suite passed 26 checks before stopping because /usr/bin/time is missing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
can you check our upstream firstmate? what is new and if it's a good idea to update our firstmate
q910 y
Context: the original project (kunchenguid/firstmate) has 95 commits on main after 87fa81b, the point the last sync #26 brought in (285 files, about +32.9k/-2.0k lines). The useful ones for this fork include: a Claude session's lock is re-anchored so /clear keeps ownership (eeeeb91); orphaned Claude auto-arm claims are reclaimed (f05b628); the supervision host's successor watcher survives the Stop hook's group teardown (3c58ec8); a read cue at the head of a context re-emit, because Claude shows only the first 2,000 characters of a long hook output (0aa7fac); a retried Enter no longer confirms "Exit and stop tasks" on Claude's background-task exit picker (2d7daa9) and a worker parked on that picker reads as blocked on a prompt (138cf11); away mode sets its spend cap from the live worker count (9cd4a3b); plus crew-state, inbox, treehouse scratch-copy and quota-read fixes. About a third are for tools this fork does not use (Pi, OpenCode, Cursor, GitLab, Forgejo, Polytoken, Command Code). Two overlap this fork's own changes: away-mode relaunch admission (fork #27 vs upstream 11990a2) and large contribution snapshots (fork #23 vs upstream 1a86871). The upstream ShellCheck memory fallback (d719ef3) drops --external-sources, so lint findings may differ; the captain's parked lint job says not to ship a memory cut that changes findings, so that fallback stays off unless the captain says otherwise. The recommendation accepted with Q910 Y: a sync job in an isolated copy (Codex merges upstream keeping this fork's changes, then a Claude Opus check); its review pipeline only after two running PurpleVoice jobs finish their review steps; the result is a pull request that is not merged without explicit approval; Firstmate restarts at a quiet moment after the merge.
What Changed
Risk Assessment
Testing
Inspected the target diff, confirmed CLI/login availability, and completed eight focused behavioral suites successfully. Live CLI and Herdr checks passed with transcripts, JSON responses, and persisted-message evidence. The visual artifact documents the Claude trust blocker; native UI and lifecycle proofs remain untested. Labs were removed, the worktree is unchanged, and lint and delivery remain with the outer executor.
Evidence: Large context re-emission
Source: Large context re-emission
Evidence: Away-cap and publication-guard CLI transcript
Source: Away-cap and publication-guard CLI transcript
Evidence: Real Herdr metadata sync, refresh, clear, and guarded teardown
Source: Real Herdr metadata sync, refresh, clear, and guarded teardown
Evidence: Exact persisted multiline steer
Source: Exact persisted multiline steer
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ No issues found.
git diff --stat f1f1a6bf4451fc81412f29f088937a9fc2205dbd ff88e0d1cf6924e1926adbae0307261a3566c101; CLI availability checks;claude --version;claude auth statusbash tests/fm-session-lock-ancestry.test.shbash tests/fm-afk-contract.test.shbash tests/fm-contributions.test.shbash tests/fm-claude-stop-autoarm.test.shbash tests/fm-control-relaunch.test.shbash tests/fm-tmux-submit-busy.test.shbash tests/fm-task-inbox.test.shbash tests/fm-supervision-host.test.shpython3 ~/.no-mistakes/evidence/01M5B7X8B9PHV0M9J8T3GFVBJR/drive-public-cli.pypython3 ~/.no-mistakes/evidence/01M5B7X8B9PHV0M9J8T3GFVBJR/drive-herdr-groups.pybin/fm-session-start.sh --reemitin a disposable marked home containing 500 context lines; checked emitted preview and complete contextbin/fm-send.sh inbox1 <multiline-message>against a stopped worker record on a private tmux socket; checked exact persisted bytes and absence of terminal typingclaude --model haiku --setting-sources projecton a private tmux socket sized 120×40; captured workspace-trust blocker and closed the labRendered the exact Claude terminal capture to HTML and PNG with headless Chromium; inspected the imageConfirmed unchanged worktree and removal of transient live labs and Herdr ownership records✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.