Repository navigation
feat(bin): rebuild the fork on upstream firstmate main and re-apply the fork's seat and fleet changes - #29
Merged
Merged
Conversation
…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
…ning (kunchenguid#5566) * fix(bin): report a Lavish source armed only after its listener is running Registration alone was treated as ready, so arm could succeed before anything was collecting from the board. * no-mistakes(review): Guard Lavish arm launches, keep retire refusals, report live prior listener * no-mistakes(review): Keep polling through window before reporting a still-live prior listener * test: wait for a capture's claim to drop before the next arm The result is stored before the runner exits, so a re-arm in that gap was meeting a live claim. * no-mistakes(document): Record Lavish arm readiness evidence in verification doc * no-mistakes(ci): Both failures were caused by this PR, and both are fixed with test-only edits. Lint 2 (ShellCheck SC2034): this branch removed the only use of `reply_id` (a `start "$reply_id"` call) from tests/fm-procevent.test.sh, which left the assignment at line 1450 unused. I deleted that assignment. It was the only `reply_id` in the file. ShellCheck is now clean on both test files. Behavior portable serial 4: the failing test was tests/fm-bearings-board.test.sh, in the check "registration consumed its answer before the any-origin binding existed". I reproduced it locally: the hold was still `state: queued` when the test checked it. - What must hold: the test's check that the hold is closed must run after the listener has captured the answer. - Why it broke: the test used a stand-in adapter that ran `fm-procevent.sh start` in the foreground after `arm`, so capture finished before build returned. On this branch, `arm` starts the listener itself in the background, so the real listener captures the answer and closes the hold a moment after build returns. - Fix: removed the now-redundant stand-in adapter, the copied runtime directory, and its extra environment variables. The test now runs the real build through the existing `run_board` helper and waits up to about 10s for the hold to reach `state: done`. The checks that follow are unchanged: `Resolution mode: answered` and the any-origin binding. - Other tests: this was the only test in the file that stood in for the adapter this way. The shard's other pure-contract-unit test (tests/fm-trace-context-lib.test.sh) passed unchanged. Verification: - tests/fm-bearings-board.test.sh passed 3 times in a row via bin/fm-test-run.sh, all 18 checks, about 53s per run. - tests/fm-procevent.test.sh was not rerun, because the lint fix only removed an unused assignment
…elivered (kunchenguid#5599) * fix(bin): acknowledge a delivered unknown-wake escalation The same unrecognized wake was escalated again after it had already been handled, because delivery never recorded that identity. * no-mistakes(review): Scope unknown-wake acknowledgements to one away session * no-mistakes(review): Clear delivered digest when unknown-wake ack write fails * no-mistakes(review): Limit unknown-wake suppression to acknowledged lines * no-mistakes(document): List unknown-wake ack file among away-session artifacts
…ess wait (kunchenguid#5587) * fix(bin): keep a stated default retraction from cancelling a keyless wait A resolved line that names the shared default decision bucket was closing the keyless live wait that only prints as that same key. Keyless self-retraction still closes the keyless wait. * no-mistakes(review): Keep declared waits standing past foreign-key resolved lines * no-mistakes(review): Bound declared-wait read and share one decision-key parser * no-mistakes(document): Document supervisors' key-aware declared-wait read
…unchenguid#5544) * fix(bin): terminate a remote job worker that lost ownership when it receives TERM A serving worker whose lock directory is gone can no longer quarantine shutdown, and resuming service publishes a false ready heartbeat. Exit after stopping only that worker's own command tree, without removing a replacement owner's lock. * no-mistakes(review): Check worker lock ownership before publishing shutdown quarantine * no-mistakes(document): Correct worker shutdown comment on replacement-owned lock * fix(bin): keep an ousted remote job worker off the replacement quarantine Shutdown can lose the lock after the first ownership check and before it writes or clears quarantine. Bind both operations to the directory object this process still owns so a replacement's quarantine stays untouched. * no-mistakes(review): Make ousted-worker shutdown test reliably reach quarantine clear * no-mistakes(document): Reattach worker_shutdown doc comment to its function * no-mistakes(ci): Fixed the failing check (Behavior portable serial 7) with a test-only change to the stall test in tests/fm-remote-job.test.sh. Product code is unchanged; no other test changed. Cause: after the decoy dies, both workers run the same check-exists, read, delete sequence on the job records. On the CI runner the replacement deleted a record between the ousted worker's check and its read. The ousted worker exited 125, and because the file runs under set -e the unguarded `wait` ended the test with 125. The exit trap then killed the replacement, which produced the "Killed" line. Reproduction: a temporary 0.3 s delay between the check and the read, applied to the ousted worker only, made the committed test fail exactly as in CI (exit 125 and the "Killed" line). The new test passed with the same delay. The delay is reverted, along with a similar debug hook that the timed-out attempt had left in bin/fm-remote-job-worker.sh. Test changes: - The replacement is frozen (and confirmed stopped) before the decoy is killed and resumed only after the ousted worker exits, so only one worker touches the job records at a time. - The ousted worker is stopped only once its quarantine exists and its lane is reaped, which places it inside its stop loop. - Every fixed poll loop is now a wait on a named condition with a 30 s deadline and an explicit failure message. Exit detection also handles zombies. - The exit trap kills and waits for the decoy and both workers on every path. - A non-zero exit from the ousted worker now fails with its exit code and stderr instead of silently ending the file. The test still proves that the resumed ousted worker exits 0 and leaves the replacement's lock, quarantine contents and quarantine inode unchanged. Verification: the full test file passed four times on its own and three times under nice -n 10 with four busy-loop CPU hogs; bin/fm-lint.sh passes. Changes are not committed * no-mistakes(ci): I fixed the failing check (Behavior portable serial 7) by changing only the stall test in tests/fm-remote-job.test.sh. Product code is unchanged. **What failed:** "an ousted worker in shutdown leaves the replacement quarantine untouched" failed on CI with the ousted worker exiting 125 ("could not stop the active command tree"). **Why:** during shutdown, the worker retries the still-running decoy command group a fixed 100 times, 0.01 s apart, then gives up and exits 125. The test tried to freeze the worker partway through those retries by sending SIGSTOP from outside. On a slow runner the retries ran out before the stop arrived, so the worker had already given up. The invariant is that the test must hold the ousted worker inside that retry loop until the replacement owns the lock. That was the only place the test depended on timing. The other waits already watch for a named state change with a 30 s deadline. **Fix:** - The ousted worker now starts with a small `sleep` wrapper at the front of its PATH, and the SIGSTOP race is gone. - The wrapper only holds a `sleep` called directly by that worker's own process (it checks its parent pid against a hold file) while its quarantine file exists. - The only such `sleep` is the first retry in the shutdown stop loop, so the worker waits there as long as needed. - The wrapper writes a marker when it starts holding. The test waits for that marker, then hands the lock to the replacement, freezes the replacement, and kills the decoy. - The test releases the worker by deleting the hold file. Deleting the whole temp directory also releases it, so a failed run cannot leave the wrapper looping. - A process leak: the test overwrites the job's command-group record with the decoy, so no worker ever stopped the job's real command. `fm-hold-job.sh` and its `sleep 30` stayed running for up to 30 s after the test. The test now records that group before overwriting it and kills it at the end of the test and in the exit cleanup. - The test still asserts the same things: the ousted worker exits 0, and the replacement's lock, quarantine contents and quarantine inode are unchanged. **Verification:** - The full file passed twice on its own, twice under `nice -n 10` with six busy-loop CPU hogs, and twice more after the leak fix. - `pgrep` found no leftover processes afterwards. - With the worker from just before the fix commit (cf45cb6^), the test still fails with "the ousted worker wrote or cleared the replacement quarantine during shutdown", so it still proves the fix. - `bin/fm-lint.sh` passes. - I did not reproduce the CI failure locally. The cause comes from the fixed retry limit and the CI error message. The changes are not committed * no-mistakes(ci): I changed only the stall test ("an ousted worker in shutdown leaves the replacement quarantine untouched") in tests/fm-remote-job.test.sh. Product code is unchanged, and so is every other test. **Invariant:** the pid written to the job's group record must be a process-group leader whose group dies when that one process is killed. Otherwise the worker's bounded stop loop never sees the group die, gives up, and exits 125 ("could not stop the active command tree") before it reaches the lost-ownership exit. The decoy is the only place in this test that depends on this. **Fix:** - The decoy used to be `set -m; sleep 30 &`. It now starts as `perl -MPOSIX=setsid -e 'setsid() >= 0 or exit 1; exec @argv' sleep 30 &`, which gets its own session and group without shell job control. tests/fm-procevent.test.sh already uses the same idiom. - The test now waits, with the file's usual 30 s deadline and a named failure, until `ps -o pgid=` of the decoy equals its pid before writing it into the group record. This way the worker can never read the record before `setsid` has run. - The existing steps are unchanged: the test kills the decoy, reaps it with `wait` before releasing the hold file, and the exit trap still kills and reaps the decoy and both workers. - The assertions are unchanged: the ousted worker exits 0, and the replacement's lock pid, quarantine text and quarantine inode stay the same. **Cleanup:** I reverted a debug `printf` hook that the timed-out previous attempt had left in bin/fm-remote-job-worker.sh, and deleted its untracked `.tmp-repro/` directory. Neither was committed. **Verification:** - The full tests/fm-remote-job.test.sh passed twice normally and once under `setsid -w` with stdin from /dev/null (no controlling terminal). - `bin/fm-lint.sh` passes. - No leftover `sleep 30` processes afterwards. **Not reproduced:** I could not reproduce the CI failure locally. On this host `set -m` made the decoy its own group leader even without a controlling terminal, so the cause on the runner is not confirmed. The change removes the test's reliance on shell job control, as the user asked. Changes are not committed * no-mistakes(ci): I changed only the stall test ("an ousted worker in shutdown leaves the replacement quarantine untouched") in tests/fm-remote-job.test.sh. Product code is unchanged, and so is every other test. **Invariant:** the group record the ousted worker checks in its stop loop must stay the job's own command group, and the test must stop that group before it releases the hold. Otherwise the bounded retry keeps seeing a live group, gives up, and exits 125 ("could not stop the active command tree") before it reaches the lost-ownership exit. The test overwrote this record in one place (the decoy) and stopped the group in one place (killing the decoy); both are changed. **Fix:** - I removed the setsid decoy and the overwrite of `.claim/group`. The record keeps the job's real command group, which the test still saves as `STALL_JOB_GROUP`. - The two-line `group_start` stays. It is still needed: without it the worker kills the real group on its first pass, before the replacement takes over, so the hold would never matter. - The `sleep` wrapper that holds the worker at its first stop-loop retry is unchanged. - After the replacement owns the lock, its quarantine is planted and it is frozen, the test runs `kill -KILL -- -$STALL_JOB_GROUP`. It then waits, with the file's usual 30 s deadline and a named failure, until `kill -0` on the group fails. Only then does it remove the hold file. The worker therefore always sees its own command already stopped and never races its retry budget. - The exit trap still kills the saved command group if the test fails. It can't `wait` on that group because the group is not a child of the test shell. The decoy variable and its cleanup entry are gone. - The assertions are unchanged: the ousted worker exits 0, and the replacement's lock pid, quarantine text and quarantine inode stay the same. **Verification:** - The full tests/fm-remote-job.test.sh passed twice normally. - It passed once under `setsid -w` with stdin from /dev/null (no controlling terminal). - It passed once under `nice -n 10` with six busy-loop CPU hogs. - With the worker from before the fix (cf45cb6^), the test still fails with "the ousted worker wrote or cleared the replacement quarantine during shutdown", so it still proves the fix. - No `fm-hold-job` or `sleep 30` processes were left afterwards. - `bin/fm-lint.sh` passes. **Not reproduced:** I couldn't reproduce the CI failure locally; the decoy version also passed on this host. So I can't confirm why the decoy group stayed alive on the runner. The new wait turns any leftover live group into a clear named failure instead of an exit 125. The changes are not committed * fix(bin): keep a dead command group dead on bash 5.2 A bare return inside the liveness check drops the failing kill status when the check runs in a conditional, so shutdown keeps treating a stopped group as alive and exits 125. * no-mistakes(review): Use bash 3.2 fd syntax and fix trap return comments
…henguid#5589) * docs: make configuration settings easier to find and understand * no-mistakes(review): Restore dropped qualifiers and fix misplaced config doc labels * no-mistakes(review): Restore three dropped qualifiers in configuration reference
) * fix: bound worker edits of project AGENTS.md/CLAUDE.md to factual corrections These files are loaded into every agent session of a project, so additions should be a deliberate human choice rather than automated task output. The ship brief's project-memory section and AGENTS.md section 6 previously invited workers to record durable knowledge, which let project AGENTS.md files accrete detail the codebase or README already carries. Workers now edit only to fix factually wrong content - including content their own change made wrong - and fm-ensure-agents-md.sh runs only alongside such a correction. Stow no longer routes project-memory additions through ship tasks, and the generated skeleton no longer invites discovery-driven additions. * no-mistakes(review): Stop running fm-ensure-agents-md.sh on memory-file corrections * no-mistakes(document): Clarify manual project-memory initialization and remove duplicate guidance
…enguid#5635) * fix(bin): let gate agents drive lifecycle against marked lab homes Part 2 of the kunchenguid#5615 split. A no-mistakes gate agent runs inside a checkout carrying the fleet-captain identity, so fm-gate-refuse-lib refuses fleet mutation on the gate signal. That refusal was absolute, which kept gate validation from ever exercising the real lifecycle. Stamp a disposable lab FM_HOME with a .fm-lab-home marker file that only bin/fm-lab-home.sh writes, and only onto a fresh empty dir, so no call path can mark a populated real home. fm_refuse_if_gate_agent then permits lifecycle only when FM_HOME carries the marker and is driven through its stock layout - any FM_*_OVERRIDE relocation stays refused so part of the "lab" cannot be split back onto the real fleet. The threat model is a confused agent touching the real fleet, not deliberate forgery, so the marker is a plain token file rather than a bound record. FM_GATE_REFUSE_BYPASS is unchanged: it still serves the test harness, which cannot mark hundreds of temp homes. Teardown's slot-ownership scan compared state-dir paths textually while fm_firstmate_root_home canonicalizes, so a lab home under a symlinked TMPDIR scanned its own record twice and self-collided; compare file identity (-ef) instead. * no-mistakes(review): Refuse unlistable lab homes and hardlinked slot records * no-mistakes(review): Mint lab markers only on verified-empty fresh dirs * no-mistakes(document): Clarify lab-home gate documentation and comment contracts * no-mistakes(document): Clarify lab-home gate documentation and remove stale claims * no-mistakes(document): Clarify gate lab-home documentation and boundary wording
…ad of refusing every re-arm (kunchenguid#5594) * fix(bin): replace a watcher whose beacon stalls past a hard bound instead of refusing every re-arm A fleet watcher that is alive but whose liveness beacon has gone stale could never be replaced: every re-arm was refused because the lock holder was a live pid, and the holder was never evicted because it was not dead. Add FM_WATCHER_STALL_BOUND (default 3x the stale grace): below it the refusal is unchanged; at or past it the arm re-verifies the holder against the lock's recorded identity, sends TERM, waits boundedly, and takes the lock the normal way, ledgering a stalled-holder-replaced row. A holder that survives TERM keeps the old refusal. Fixes kunchenguid#4400 * no-mistakes(test): poll for replacement message to fix watcher-lock test flake * no-mistakes(document): document FM_WATCHER_STALL_BOUND in config inventory
…n can keep them (kunchenguid#5563) * fix(pi): hide queued Firstmate notifications under Calm only when the session can keep them Calm now keeps authenticated Firstmate operational inputs out of Pi's queued-message listing, but only after proving the live session exposes every member needed to keep them across Escape. A session missing any of them keeps stock rows and Escape and shows one generic warning. Escape and the dequeue key return only captain-authored messages to the editor and re-queue hidden notifications in order; after an abort that kept any in Pi's agent queue, the adapter starts the delivery turn itself because Pi 0.87.1 does not continue an aborted run. Compaction-held notifications stay with Pi's compaction flush and never start or announce a turn. Fixes kunchenguid#1588 * docs(calm): record Pi 0.87.1 queued-row retention verification * no-mistakes(review): Deliver kept Calm notifications after tree-navigation aborts too * no-mistakes(review): Defer Calm notification turn until tree navigation finishes * no-mistakes(lint): Silence SC2016 for literal JavaScript in queue-retention e2e test
…uid#5548) * fix(bin): refuse teardown when a required source disappears A missing sibling was sourced after cleanup had started, so Bash 3.2 exited 0 from the EXIT trap and Bash 5 continued and reported success. * no-mistakes(review): Remove unused FM_TEST_ONLY hook from teardown tests * no-mistakes(review): Check task backend sources before any teardown cleanup * test(gotmp): give teardown fixtures every tmux adapter sibling Teardown now refuses when a sibling the recorded backend's adapter sources is missing, so the fake bin must carry fm-session-lock-lib.sh, fm-agent-process-lib.sh and fm-gemini-lib.sh.
Restructure the supervision host doc's prose into shorter sections, lists, and tables without changing documented behavior. Every original heading, anchor, identifier, number, quoted string, and link target is preserved.
* docs: make herdr-backend easier to read Restructure the Herdr backend doc's prose into shorter sections, lists, numbered procedures, and tables without changing documented behavior. Every original heading, anchor, fenced code block, link target, and documented fact is kept. * no-mistakes(document): Restore composer-proof reason and complete Herdr topic table
Restructure the prose into sections, lists, and tables without changing documented behavior. Every original heading and anchor, inline-code span, link target, number, and quoted string is kept, and each sentence sits on its own line. Adds a topic navigation table and short subsections under the existing headings.
* docs: make watcher-continuity easier to read Restructure the prose into sections, lists, and tables without changing documented behavior. Every original heading, anchor, identifier, link target, and number is kept. * no-mistakes(review): Fix actor and supervision-host scope in watcher-continuity doc * no-mistakes(review): Make readiness TERM and retry conditional on unready successor
* docs: make sessionstart-nudge easier to read Restructure the prose into sections, lists, and tables without changing documented behavior. Every original heading, inline-code span, link target, number, and fact is preserved, and a harness-to-tier table now sits near the top. * no-mistakes(review): Drop helm glossary line and dedupe exit-code lead-in
* docs: make captain-hold-lifecycle easier to read Restructure the captain-hold lifecycle prose into sections, lists, and tables without changing documented behavior. Every original heading, anchor, identifier, number, quoted string, and link target is kept. * no-mistakes(review): Fix verification record subjects and grouping headings * no-mistakes(review): Clarify task-body read-back cases belong to the suite
* docs: make remote-secondmates easier to read Restructure the remote second mates prose into sections, lists, numbered procedures, and tables without changing documented behavior. Every original heading, anchor, fenced code block, identifier, link target, and qualifier is preserved. * no-mistakes(review): Merge remote-home table cell into one sentence * no-mistakes(review): Tighten readiness lead-in, restore causal link, fix dangling reference
…nguid#5554) * fix(bin): bound the away digest and log why a delivery failed The away daemon joined every buffered escalation into one unbounded digest. A start-up catch-all span can exceed what one transport argument carries (tmux rejects the send-keys command; Linux refuses to exec any argument above 131,071 bytes, which is how herdr receives it), so the initial send failed on every housekeeping pass and was logged as an unconfirmed Enter with text possibly in the composer. escalate_flush now builds the injected digest under a fixed byte budget: each event is cut at a UTF-8 boundary with an omitted-bytes marker, the joined events stop with a "+K more event(s)" tail, and a bounded digest names a state/.subsuper-digests/ file that keeps every buffered event verbatim. The buffer itself is untouched, so the return catch-up stays complete. The tmux submit core and the herdr literal send now replay the transport's stderr on failure, and inject_msg logs the failing stage (initial send versus Enter confirmation) with the byte count and that stderr. The wedge alarm line and marker carry the last failure reason. Fixes kunchenguid#4382 * no-mistakes(review): Drop digest pruning; label send-failed as send-or-Enter stage * no-mistakes(review): Keep digest full text once submit ran; reuse on retry * no-mistakes(lint): Count digest files with find instead of ls --------- Co-authored-by: firstmate-oss <[email protected]>
…ul rule Carried from fork commit 02a1e91 (#5). Path forcing and upstream's newer resolver work are orthogonal features, so the conflicts are merged rather than decided between. bin/fm-dispatch-resolve.sh now carries both. Upstream's per-rule `min_confidence` floors and its runner-up fallback still govern a model-decided answer, and a path-forced choice bypasses them because no model answered: there is no confidence or probability to hold to a floor and no runner-up to fall to, which the fold states explicitly rather than leaving to a reader to infer from a null. The request body keeps upstream's task-sections-only brief rather than this commit's whole-brief send, so forcing does not widen what leaves the machine. The evidence block and the rendered output carry upstream's `fallback:` line on a model-decided result and this commit's `decided_by: path-forced` shape on a forced one. docs/configuration.md keeps upstream's restructured field tables and labelled subsections, with `path_force` folded into the resolver-only field list, the bootstrap validation list, and the diagnostics list, and the pre-model path check added as its own subsection ahead of what the model receives, because the check runs before the model call. This commit's older sentence saying the resolver sends the whole brief is dropped in favour of upstream's task-sections-only statement, which is what the code now does. tests/fm-dispatch-resolve.test.sh keeps both sets of malformed-rule cases; the `min_confidence` and `path_force` validations are independent.
… ones Carried from fork commit bd1c981 (#4). Conflict resolutions: AGENTS.md takes upstream's restructure, which replaced the inline operational-home layout tree with a one-line pointer to the `operational-home-layout` skill. The seat entry this commit added to that tree is re-homed into the skill beside the worker account pin, so the layout keeps exactly one owner and the always-loaded file does not regain the lines upstream moved out. bin/fm-config-inherit-lib.sh unions the inheritable set: upstream's newer `dispatch-never-send`, `keep-ai-trailers`, and `supervision-host-off` items stay alongside the three seat items. The machine-local list is kept as its own fork divergence, because a seat is a per-machine profile the owner logged in here and a remote home handed its name would resolve a profile nobody logged in there. bin/fm-spawn.sh keeps upstream's worktree re-assert and then resolves the seat, which must stay ahead of trust pre-registration so the trust entry lands in the profile the worker will actually read. The relaunch-preserved metadata key list unions both sides: upstream's `branch`, `base_branch`, and `control_relaunch_tx` with this commit's `claude_seat`. docs/scripts.md unions the two row descriptions, which gained independent detail: upstream's ship-branch prefix on `fm-project-mode.sh` and this commit's `--local-only` on `fm-config-push.sh`.
Carried from fork commit 73ae45e (#8). AGENTS.md conflict resolved the same way as the seat-switching commit: upstream's restructure moved the operational-home layout tree into the `operational-home-layout` skill, so the seat entry this commit edited is edited in the skill instead and the always-loaded file keeps only upstream's pointer.
… Herdr Carried from fork commit 234a667 (#10). bin/backends/herdr.sh takes upstream's composer read instead of this commit's. Upstream independently diagnosed and fixed the same bounded-tail defect, and its fix is the stronger one: the capture is the full visible viewport rather than a 200-row tail, which also survives an overlay rendered between the composer and the pane bottom. Upstream's `fm_backend_herdr_composer_content` takes only a target, so this commit's extra row-count argument would have been silently ignored. bin/fm-control.sh unions the locals in do_exit, because both sides' variables are used in the merged body: upstream's `dialog` for the blocking-prompt refusal and this commit's `insert_signal` and `entry_before` for the modal-composer restore. tests/fm-control.test.sh keeps both the fake pane's after-Enter handling and this commit's vim screen branch, and keeps both independent test groups. The conflict boundary fell inside upstream's resume-flag test, so its closing brace is restored at the junction.
…it atomically Carried from fork commit 5ec9515 (#9), reduced to the part upstream does not already have. Upstream independently fixed the same reservation flake: its `clock_bump` already publishes each new clock value by rename, so the atomic publish this commit added as `advance_clock` is redundant on the new base. Carrying both would have left two primitives doing one job in one fixture, which is the duplication that drifts the moment only one is edited. So the fixture keeps one clock primitive under upstream's name, which keeps later syncs on this file clean, and gains the one thing this commit had that upstream's version lacks: it validates that the clock reads as an epoch and fails the fixture loudly, rather than letting an emptied read collapse the clock to the bare offset through arithmetic on an empty string. Upstream's own `slow-wave` fault arms are kept untouched.
…n extra-usage policy Carried from fork commit c48332b (#11). bin/fm-config-inherit-lib.sh unions the inheritable set again, keeping upstream's newer items beside the two new seat settings. AGENTS.md keeps upstream's pointer and the seat entry is updated in the `operational-home-layout` skill, as for the earlier seat commits. Two resolutions follow from the approved decision to drop the relaunch-pin refusal series and wait for upstream's own PR: docs/configuration.md does not carry this commit's sentence documenting a refused relaunch when the pin does not select the task's recorded seat, because that refusal is not implemented here. Upstream's sentence is kept, with its stale "these three files" corrected to "these files" now that five drive the behaviour. tests/fm-seat.test.sh drops `test_account_pin_and_recorded_seat_refuse_the_relaunch`. The dropped review commits are ancestors of this one, so that test arrived with this pick's side of the conflict while the code it asserts did not, and it would have failed against a branch that deliberately has no such refusal. The two tests asserting a pin-only home and a pin pointing at the seat directory still relaunch are kept: both pass without the refusal and state the behaviour this branch does have.
Carried from fork commit de888f6 (#14). bin/backends/herdr.sh keeps this commit's type-prove-recover loop, which the conflict's shared tail already belongs to, but reads the composer through upstream's full visible viewport rather than this commit's 200-row tail. Upstream's read is the stronger one and its own regression covers the case this commit's width was chosen for, so the recovery loop now sits on top of it. bin/fm-send.sh keeps upstream's `$ring_retry`, which reports whether the retry ring was actually recorded instead of asserting that the watcher will re-ring, and keeps this commit's wording for the unconfirmed case, because an unconfirmed submission now counts as a failed ring too. docs/herdr-backend.md takes this commit's description, which is what the merged code does: a clear that cannot be verified reports `unaccounted`, and a cleared refusal gets exactly one modal recovery. docs/verification/runtime-backends.md keeps both records, which measure different findings. This commit's record claimed the 200-row proof read was not involved; since the read is now the full viewport, that clause states the proof width is not involved and points at the viewport section rather than naming a width this branch no longer uses.
Carried from fork commit 2a7f0d1 (#16). bin/fm-dod-lib.sh merges both sides rather than choosing. Upstream has since added a configurable ship-branch prefix and a named base branch, so the generated instructions keep upstream's `$branch` and `$pr_base` instead of this commit's hard-coded `fm/<id>` and default-branch assumption, and the resolution steps gain a line saying to use the named base when the delivery contract declares one. The draft read-back keeps upstream's `gh-axi pr view`, because this commit used raw `gh` for it and this repo's own rule is to reach the forge through `gh-axi`. Rule one keeps upstream's base-branch-aware target and gains this commit's origin-only bound. Both renderings were checked with and without a named base. AGENTS.md keeps upstream's pointer: upstream moved this section into the `ship-landing` skill, so the sentence this commit reworded is reworded there. tests/fm-brief.test.sh and tests/fm-dod-lib.test.sh keep both sides' test groups, which cover independent behaviour. In each file the conflict boundary fell inside an upstream test, so its closing brace is restored at the junction.
Carried from fork commit 0a554f8 (#17). This commit and upstream both hardened the same destructive path, in different directions, so the conflicts are merged and neither protection is dropped. bin/fm-teardown.sh keeps this commit's extraction: bin/fm-slot-record-lib.sh owns the cross-record exclusivity scan, shared with the launch path that refuses to hand a spawn a copy another record already names, and bin/fm-slot-release.sh is the supported way out of a pair that already exists. Upstream's slot-owner-claim exception is kept at the teardown call site, where its justification lives: a slot whose claim names another task was reassigned, so that teardown is records-only and refusing would strand the stale record and block the claimant's own cleanup. The launch-side caller of the same scan deliberately has no such exception, which the code now states. The inline landed-work cluster upstream still carried is removed, because bin/fm-unlanded-work-lib.sh owns that contract now and nothing outside the cluster called it; keeping both would have left two implementations of a proof that decides whether work is destroyed. Removing it would have dropped a real upstream fix, so that fix is carried into the library instead: upstream had taught `content_in_default` to compare against a task's recorded base branch rather than the project default. The library had no such parameter, so a task started from a named base would have had its landed work read as unlanded. `fm_unlanded_content_in_default` and `fm_unlanded_work_is_landed` now take an optional base branch, and both callers pass the task's recorded value. docs/architecture.md keeps this commit's spawn-scan and slot-release sentences and upstream's claim sentence, which is the one that states the contradictory-record case the retained exception covers. tests/fm-control-relaunch.test.sh keeps both test groups; the conflict boundary fell inside an upstream test, so its closing brace is restored.
…o four partitions Carried from fork commit 8105600 (#15). The plan's step 9 said to prefer upstream here if upstream's work covers this partitioning. It does not: upstream fixed the same memory problem from the other side, by bounding each root's deadline and address space and retrying a root that hits the ceiling without source following, but its `--partition` remains fixed at `1of2|2of2` and its CI matrix remains two partitions. This commit generalizes the partition count to `<n>of<total>` and runs one ShellCheck per partition, which upstream does not do, so both land: upstream's per-root envelope keeps a single root from running uncapped, and this commit's one-worker-per-partition rule keeps two workers on one runner from each sizing a heap to the whole machine and colliding with its OOM killer. The script header states both: upstream's bounded workers and one-root-per-process default, then this commit's generalized partition count and the reason a partition runs one ShellCheck at a time. docs/fm-test-portable-shards.md keeps upstream's per-root bounds sentence, its per-root lifecycle sidecar, and its newer statement that the watch-triage floor alone already exceeds the fifteen-minute objective, with this commit's partition-count wiring, its pointer to the new memory verification record, and the corrected sixteen-job layout. `bin/fm-doc-audience-check.sh` passes, and the new verification record is classified in the inventory.
* feat(bin): let firstmate move itself to another Claude seat A seat switch moves only what the next spawn reads, so it has never moved firstmate: the lead keeps the account its own process launched on while config/claude-seat drifts away from it. No running Claude Code process can change credential store, so the lead changes account only by being replaced. bin/fm-seat.sh lead-restart does that, through bin/fm-lead-restart.sh: another claude starts on the new seat in the same terminal, resuming the same session, and the current process ends. Verified rather than assumed, against the code: - Running workers need nothing. Steering is a durable inbox, status is a durable log, and each task keeps the seat recorded in its own record, so a crew notification step would change nothing and none is added. - The one real worker-facing effect is supervision, and it is handled by not touching it. The watcher is a separate process with its own singleton lock and is never in the kill, so it is orphaned rather than stopped and keeps its beacon; the successor's arm attaches to it instead of starting a second one. The cycle count goes one to one. The guarded pieces: - The persist gate is the one a second mate's restart already applies. The /stow open-record contract now has one owner, bin/fm-persist-request-lib.sh, which bin/fm-secondmate-restart-lib.sh composes its request from and the lead path states verbatim. The command refuses without --persisted. - The lock is handed over through a bounded reservation in bin/fm-lock.sh (state/.lock-handover). It is armed while the outgoing lead still holds the lock, so there is no instant with two holders and none with the home open to a third session while line 1 names a dead pid. The outgoing session is admitted by its session id and keeps confirming its own lock; the successor is admitted by the nonce it is launched with, and that proof is what clears the reservation. A lapsed reservation means nothing, so a failed handover cannot wedge a home. - The successor is relaunched in the same pane with every other flag preserved. The lead's own profile and pane are not derivable elsewhere, so the owning session records both in state/.lock-runtime bound to the lock's pid, and a record naming another pid is no evidence. The launch command is read from the running process and accepted only when it provably round-trips; a flattened argument vector where a multi-word argument is indistinguishable from two arguments refuses and names --launch-command. - The armed threshold watch asks the same question about the lead's own seat and reports that crossing with the exact command rather than acting on it: the poll is a separate process and cannot write the lead's conversation down. It reports nothing unless the whole move passes preflight, so a crossing with no signed-in destination or no established terminal names that blocker instead. - Claude primary only. Any other harness refuses by name. What a failure leaves. Every check runs before anything is touched, so a refusal leaves the previous session running and in charge. After the previous process has ended there is no going back to it: the stage records the outcome in state/.lead-restart.result, drops the reservation, and queues a wake. Recovery is one command in that same terminal, printed in that record and staged as a file to source, and nothing else is affected because only one process was ever replaced. Not proven, and not claimed: that a real signed-in `claude --resume <id>` comes back as that same session. Exercising it needs a credential this work deliberately never touches. The stand-in reproduces the documented contract instead - a resume keeps the session id, which is what --fork-session exists to opt out of - and every other step is proven against real processes. tests/fm-lead-restart.test.sh drives the real scripts: the establishment refusals and the reservation against real claude-named processes, and the whole swap in a real tmux on a private socket, where one lead before and one lead after must be in the same pane, on the new profile, resuming the same session, with a cycle started inside the outgoing lead's tree still alive afterwards. * refactor(bin): give profile-to-seat naming one owner in fm-seat-lib.sh The lead restart and the seat command both need the seat NAME a profile directory belongs to, which is the inverse of fm_seat_config_dir and belongs beside it rather than in two copies. * feat(agents): make the lead's own seat crossing a move firstmate carries out The watch reported the lead's seat crossing and left the move to be asked for. That is report-only: the captain set the threshold, so the threshold firing is the instruction, and firstmate acts on it like any other actionable check result. The watch still hands the move over rather than performing it, and that is about which process can do it, not about who decides: the poll runs in a separate process and cannot write the lead's conversation down, which the persist gate requires first. What changes is that the handover is now binding. - The wake line says so itself and stays self-sufficient with no skill loaded: it states that firstmate moves now, on this wake, without asking the captain, names the skill that owns the handling, and orders the persist step before the command. - .agents/skills/claude-seat-lead-restart owns that handling: the standing authority and its exact scope, the persist step, what to do with a refusal, that nothing follows once the command arms, and the recovery half for a `check: lead-restart` wake whose swap did not complete. It also states that the away and quiet postures do not change it, because a seat runs out of quota whether or not the captain is present. - AGENTS.md section 13 carries only the load trigger; docs/claude-seats.md and docs/configuration.md drop their report-only wording. Also fixed, found while testing this: bin/fm-lock.sh dropped the handover reservation before publishing the new owner's runtime record, so the stage read the swap as complete while that record was still missing. The reservation is now dropped last, which is what makes its disappearance mean the whole acquisition landed. The suite pins the wake as an instruction rather than an option, and bin/fm-test-run.sh maps the new paths so a change to the seat, lock, or lead restart selects this suite. * no-mistakes(review): Harden lead restart handover and notify crew before swap * no-mistakes(document): Clarify lead-restart skill: started outcome queues no wake * no-mistakes(lint): Make fm-lead-restart test shellcheck-clean
… ref holds it (#20) * fix(bin): confirm a ship done's named head on origin, not a local tracking ref A pooled worktree shares its clone's .git/config. When that clone's remote.origin.fetch is narrowed to the default branch, pushing a task branch never creates origin/fm/<id>, so the named-head gate read a correctly pushed head as existing only in the worker copy. Workers cleared the refusal with `git config --add remote.origin.fetch ...`, which outlives the task: once the branch is deleted after merge, every later worktree creation fails with `couldn't find remote ref`. The gate now asks the remote. fm_dod_named_head_on_origin makes one bounded `git ls-remote origin` and accepts when a ref is advertised at that commit, or when an advertised tip this copy already holds contains it. It writes no configuration, fetches no objects and creates no ref. A remote that cannot be read keeps the refusal rather than accepting, and local-only keeps its project-heads rule with no remote read. The refusal now names the shared-configuration hazard and the one-off `git fetch origin <branch>:refs/remotes/origin/<branch>` instead of leaving workers to find the refspec edit themselves. * no-mistakes(review): Drop origin containment walk and shorten origin read bound * no-mistakes(document): Document FM_DOD_ORIGIN_READ_SECONDS origin-read bound
…ts (#21) The worker role contract forbade "delegate the task" without distinguishing handing the whole task off from splitting parts of the worker's own work out to subagents. Workers read the blanket prohibition as covering both, so where they did subagent they reached for the harness's generic built-in rather than the role agents a project installs, and project-provided agents went unused. Draw the line in fm_brief_worker_role, the one owner of that scope: delegating the task itself stays forbidden, while subagenting parts of it is allowed with the worker still accountable, preferring a fitting role agent the project or its plugins provide over a generic built-in one. The wording stays project-neutral and reads sensibly on a harness with no subagent concept. docs/subagent-guard.md already scopes the primary's delegation guard away from worker copies, so it needs no change; the function header now cross-references it rather than restating that boundary.
A seat can now be usable on this machine without being a candidate an automatic switch may land on: the case is an account that belongs to a different payer, such as a personal account alongside the team ones, which should be reachable deliberately and never picked up by a switch nobody was present for. The existing destination-min setting cannot express that, because it asks whether a seat is nearly empty rather than whose account it is. `fm-seat.sh auto-exclude <name>` and `auto-include <name>` are the only writers of the new local, gitignored config/claude-seat-auto-exclude, one seat name per line. Both are idempotent; an exclusion is refused for a name with no seat directory, since an exclusion matching nothing would silently keep rotating onto the seat it was meant to withhold, and for the `default` login that is never an automatic target anyway. `auto-include` accepts any name so a stale entry can always be cleared. Every automatic path reads the exclusion through next_seat, which was already the one place a candidate set is built, so `switch --next`, the armed watch's switch, the watch's instruction to move the lead, the lead-restart destination, and the feasibility check `arm` makes all skip an excluded seat and none of them can be the one that forgets. An explicit `switch <name>` does not come through that function, which is what keeps the seat manually reachable. Excluding every candidate falls through to the existing no-destination refusal rather than any new behaviour, and excluding the active seat withholds it as a future destination without moving any worker off it. `status` names every excluded seat and `list` marks each one; a home that excludes nothing reads exactly as it did before. The file follows the same inheritance contract as the other five seat settings: into local secondmate homes, never to a remote route, declined by config/claude-seat-local.
…cision (#23) * feat(bin): require a checked: part on every captain call and needs-decision An escalation that names no read-only check reads exactly like a verified one. In this fleet's own status logs roughly a fifth of escalated questions either were answerable by a read-only check outright or hid a checkable fact inside a judgement, and the motivating case was a call recorded as "confirmed" by a read-only query with no query, output, or date filed anywhere while other records contradicted it. Every captain hold reason, worker needs-decision line, and questions-for-the-captain list in a scout report now carries a one-line `checked:` part naming the check that was run and its result, or `checked: none possible - <why>` so an absent check reads as absent. captain-hold-lifecycle states the convention once; ask-user-authority, fm-brief.sh's ship, scout, and secondmate scaffolds, and fm-captain-hold.sh's header carry pointers to it. No script refuses a reason or status line without the part. * no-mistakes(review): Narrow secondmate checked: rule to escalated decisions only
…flag (#24) * feat(calm): gate the Claude Code Calm mod on its own FM_CALM_ENABLED flag Claude Code 2.1.287 and later ignore CLAUDE_CODE_ENABLE_FUNCTION_HOOKS and their own docs ask for it to be removed, so the mod's only activation check was a dead platform flag: anyone tidying that flag away would have turned Calm into a complete no-op with no error anywhere. The mod now reads the firstmate-owned FM_CALM_ENABLED and keeps the old name as a deprecated alias consulted only when FM_CALM_ENABLED is unset or empty, so a session carrying only the old name keeps Calm while FM_CALM_ENABLED decides alone whenever the two disagree. config/calm stays the shared cross-harness on/off choice and no third switch is introduced: the gate must be decided with no file read at all, and config/calm is also Pi's preference, where Calm needs no gate. Platform-describing prose moves to the installed 2.1.291 behavior, with the 2.1.272 record and table row kept as dated history and a new dated record owning the current surface state. The live guard pins both names per launch through --settings so no phase depends on the host's settings, and asserts the hooks module loads while the mod stays inert, which is now the whole no-op guarantee. Its zero-height operational-row case is replaced by a tripwire: this Claude Code strips the envelope's invisible marker in the composer, so that row is unreachable from a terminal and its coverage stays in the mod's own suites and the classifier parity corpus. * no-mistakes(review): Pin FM_CALM_ENABLED in every live-e2e gate constant
…t's quota (#25) * feat(quota): add the firstmate-quota Claude Code mod for every seat The captain runs four Claude seats and could see none of their quota from inside a session. The two halves of that picture have completely different costs, and the mod is built so it can never confuse them. This session's own seat is free and exact: Claude Code's $.session.usage() carries the account's rate-limit windows and session.measure fires when one moves, so the band needs no process, no quota-axi and no cache. The engine reports percent USED while every firstmate seat setting counts percent LEFT, so the conversion happens once; an empty reading draws nothing at all, because the engine reports no window off a subscription or before the first response and a missing figure must never read as an exhausted account. Every other seat comes from the per-seat reports bin/fm-seat-board.sh already caches, because the Claude quota endpoint rate-limits frequent polling. That script gains a `json` action printing the same reading as its page, with every seat dated from its own cache file, plus `--cached-only` for a read that cannot reach the endpoint at all. The board stays the one owner of the cache contract and of seat resolution, so the mod re-derives neither. Nothing is presented as current when it is not: each row carries its own age, anything past the board's own cache window is labelled stale, a seat with no readable report says so instead of showing a zero, and a reading of another schema is refused rather than half-drawn. The ten-day-old cache files on this machine are why that is a requirement and not a nicety. Drawing never reads anything, so no redraw becomes a quota call. A session start takes one cached read; after that a refreshing read is allowed once every ten minutes behind an in-flight guard, held to a two-minute floor however FM_QUOTA_REFRESH_SECONDS is set. The interval is claimed when a refresh comes due whether or not a read follows, so a burst of timer ticks arriving together after the machine slept spends one interval once rather than reaching the endpoint repeatedly. Activation follows the Calm mod's own firstmate-owned gate: FM_QUOTA_ENABLED must equal 1, firstmate never writes it anywhere, and the mod is otherwise a complete no-op. It deliberately does not read the deprecated CLAUDE_CODE_ENABLE_FUNCTION_HOOKS alias that Calm keeps for its own migration, because this mod never shipped behind that flag and honouring it would turn an unrelated older opt-in into a new drawing. * fix(quota): draw no reset wait when the clock and the timestamp disagree Rendering the mod against this machine's own seat reading put `5h 63% (20732d 9h)` on the band: no rate-limit window resets a month out, so a wait that long is a disagreement between the clock and the reset timestamp rather than a long window. Such a wait now reads as unreadable and draws nothing, the same as an absent or unparseable one, so the band cannot put a figure like that in front of the captain. A seat row with no markers also drew an empty marker cell, which still took a column gap; it now draws no cell at all. * no-mistakes(review): Advance seat ages with clock; make Refresh read cache * no-mistakes(review): Keep cached Refresh reads from spending the live refresh
…NABLED (#27) * feat(firstmate-fleet): add the read-only Claude Code fleet pane, band, and notices A Claude Code mod that gives a supervision session a fleet view: /fleet lists every task with its state, the evidence that state came from, its age, and its last wake event; one line above the prompt names what waits on the captain and draws nothing at all when nothing does; and a transient notice fires the first time a task reaches done, blocked, or failed. The one data source is bin/fm-fleet-snapshot.sh --json, measured at 17.7-21.6s against a 10s budget for one hook, with two overlapping runs measured at 72s where one takes 18s. So it runs only from a 60s timer and one un-awaited reading at session start, both behind a single in-flight promise; a drawing hook never starts it and only ever draws the cache. A failed, timed-out, or wrong-schema reading is reported as unavailable or stale with its age, never as a healthy empty fleet, and every reading redraws so a drawing cannot go on claiming more than the mod still knows. Only current_state is printed as a state word and the status log's last line stays labeled as an event, because that line goes stale exactly when a resolved decision lets a worker resume; unreadable and unknown are kept apart. Whether the session can draw comes from session start's own isInteractive, since a pane reports itself placed even in a -p run where nothing can draw; those sessions get the same rows as text from /fleet instead. Other mods keep their band content. Activation follows Calm's firstmate-owned gate: FM_FLEET_ENABLED must equal 1 exactly, and anything else leaves the mod a complete no-op even once Claude Code has loaded the module. It is new, so it carries no deprecated alias. Nothing in it writes, and the capabilities the module reaches for are pinned by the strict-validation guard rather than left to review. Policy lives in plain libs testable under Node and the engine glue in one hooks module. tests/fm-fleet-mod.test.sh pins the plugin's shape, the activation rule, the reading policy, and the parser against the real producer's own bytes; tests/fm-fleet-mod-plugin.test.sh runs claude plugin validate --strict and the mod's engine suites against the installed Claude Code. Verified on 2.1.291. Also gitignores the tsconfig and type declarations claude --plugin-dir writes into a mod while hot-reloading, which is the documented way to develop one. * no-mistakes(review): Dedup fleet notices on announced word; load lazily across reloads * no-mistakes(test): Update fleet mod test for types dir and announced field * no-mistakes(review): Silence idle fleet band, keep /fleet text within hook budget * no-mistakes(review): Notify fleet outages once per two-failure episode, worded by kind * no-mistakes(review): Poll the joined fleet reading in bounded /fleet text loop * no-mistakes(test): Bound /fleet text wait by summed sleeps under hook budget
The origin-resolution steps carried from #16 were written when a fork task always based its PR on the project default, so they spell the create's placeholder `--base <default branch>`. Upstream has since added named base branches, and the same block now also tells the worker to use the base the Delivery contract names instead of the default, so the old placeholder contradicts the two instructions around it whenever a base is named. Spell the placeholder `<base branch>` in both the brief's create step and the refusal message that tells a worker how to reopen a PR on origin, and move the assertion that pins it with them.
…line The merge of #16 onto this base took the fork's phrasing of the direct-PR opening sentence, which names `origin` as the push target but drops upstream's mention of `gh-axi` as the tool that opens the PR. Upstream's named-base-branch test pins that phrase, so it failed, and the fork loses a fact the repository otherwise requires everywhere. Keep both: push to `origin`, open the PR with `gh-axi`. The base-branch clause that follows is unchanged, and the origin-resolution steps below it still carry the fork's reason for naming the repository on the create.
…ed -i The Herdr Pi relaunch case flips its task record to harness=pi with the GNU spelling of in-place sed. BSD sed takes -i's backup suffix as a separate argument, so on macOS it reads the substitution as the suffix and the meta path as its script, fails with "invalid command code", and leaves the record saying harness=claude. The fixture the case means to set up is silently never applied, and the error is buried in the suite's output. Reproduced on unmodified upstream/main: the same sed error appears there, so this is not a consequence of the fork sync. It is invisible on Linux CI because GNU sed accepts the spelling. Rewrite through a temp file, the shape tests/wake-helpers.sh already uses and the only portable one here; this was the single GNU-style `sed -i` left in the test tree. The substitution is unchanged. This removes the masking, not the case's own environment requirement: with the record now correctly set to harness=pi, the case needs the Pi runtime on PATH, which CI installs and a host without it does not have. On such a host the case still cannot pass, and it fails the same way on unmodified upstream/main.
…d cache and exit checks
…in leftovers Rebasing onto fork main re-applied fork content this sync deliberately replaces or drops (the Pi 0.87.1 pin, the relaunch-pin refusal series, and pre-sync seat code and tests). Restore the rebuilt branch's content.
max-metaplanet
force-pushed
the
fm/upstream-sync
branch
from
October 6, 2026 15:00
e170696 to
c7e440b
Compare
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
Yes all that .go ahead
That approval answers a fork-versus-upstream comparison report. What the report recommended, resolved into its substance:
The fork (max-metaplanet/firstmate) has diverged from upstream (kunchenguid/firstmate) by 32 commits while upstream moved 151, with 65 files changed on both sides, and the fork already carries two merge commits from a prior sync plus five duplicate originals of commits that were later re-landed. The report's plan: start a fresh branch from upstream/main and re-pick the fork's 25 distinct non-merge changes (30 minus those 5 superseded originals) on top, rather than merging upstream into fork main.
Roughly twenty upstream fixes the fork was exposed to arrive through that new base and are deliberately not cherry-picked separately. They include: refusing merges with unreported required checks and retrying a merge on an unknown mergeable state; accepting a task's next PR after its bound PR merges; the record-backed doorbell for Claude-bound operational input, needed because Claude Code strips the invisible marker from submitted prompts so injections never arrive; tolerating transient quota read failures; loading backend sibling libraries when sourced under zsh; no longer reporting cancelled validation runs as failures; reopening a pending-reply escalation after its resolve; surfacing unrecognized status prefixes instead of silence; preserving captain-hold reasons and rejecting invalid completion inventories; refusing a confirming Enter on the Claude background-task exit picker; recognizing titled Claude top rules and grey slash commands; bounding ShellCheck to one canonical root per process and retrying roots that hit the memory ceiling; refusing watchers from disposable checkouts; refusing teardown when a required source disappears; keeping persistent secondmates out of landed-work cleanup; forbidding shared worktree-pool administration in worker instructions; ignoring fenced and indented captain lines when extracting authorized intent; using gh-axi for the ship draft check; and stripping AI co-author trailers from fleet-launched commits.
On seat switching the report recommended keeping both the fork's propagation work and upstream's pin at this sync rather than rebuilding on the pin, because upstream's pin is explicitly not inherited and upstream closed the propagation question as not planned, and keeping the seat work as one contiguous series so a later rebuild stays a bounded rebase.
What was approved, question by question:
Ship as one PR through the full pipeline; the merge itself still needs the captain's word since it replaces most of the repo.
What Changed
kunchenguid/firstmatemain rather than merging upstream into the fork. This brings in about 150 upstream commits acrossbin/, the Pi/OMP/OpenCode extensions, the Claude Calm mod, skills, and docs. Among them: merge refusal on unreported required checks, the record-backed doorbell for Claude-bound input, tolerance for transient quota reads, zsh-safe backend library loading, preserved captain-hold reasons, ShellCheck memory-ceiling retries, AI co-author trailer stripping (fm-git-strip-ai-trailers.sh), and pipeline-spend recording (fm-pipeline-spend.sh). It also adds new files that come with that base, such asfm-supervision-host.sh,fm-host-mirror.sh,fm-live-lab.shandfm-jev-mem-guard.origin,checked:parts on captain calls, a CI lint split into four ShellCheck partitions, and the separateFM_CALM_ENABLED/ quota /FM_FLEET_ENABLEDClaude Code mods. The Pi 0.87.1 pin and the relaunch-pin refusal series are dropped; the spawn-time both-configured guard stays.AGENTS.mdrestructure and moves the fork's seat, restart andchecked:guidance into skills. Settles conflicts with leftovers on fork main in favour of this sync's versions, and updates the matching tests and docs.� Generated with Claude Code
Risk Assessment
� High: This round's fixes are sound: the secondmate dispatch gate now uses the same config as the launch, the restore of the fired value is correct, the lint refactor preserves behaviour, and the rebase resolution correctly drops the Pi pin and the relaunch-pin series while keeping this sync's seat code. Risk is still high because the branch replaces most of the repository (333 files, about 50k lines), and the intent itself says the merge needs the captain's explicit word.
Commit-by-commit map
Base:
upstream/mainat the time of branching. The 15 upstream fixes from the report'ssection 2 arrive through that base and are not cherry-picked.
Order note: the report groups picks thematically; several groups have internal
dependencies (the automatic seat mode needs seats to exist first). Picks therefore run in
fork-chronological order, which is the report's order with prerequisites ahead of
dependents.
Carried (27 commits)
operational-home-layout(Q7)<code-root>parameterSquashed
The three
no-mistakes(review)fixups on the relaunch-pin series are not squashed into aparent: that whole series is dropped under Q5. No other carried commit had a separate
review fixup on fork main, so no squashing was needed in the end.
Dropped
Every fork PR merged today is carried
cc3e50b0FM_CALM_ENABLEDgate906531bd67189ea2eccfd45f- partial by design; upstream's own doorbell is in the base, so only the fork-specific live guard and the 2.1.291 record are carried. The commit subject differs from #26's for that reason.64668fd0de211df6Plus two fixes of my own, both caused by a merge rather than carried:
9e9f5188(thedirect-PR base placeholder) and the cursor-key comment correction folded into
051350a4.Q6 comparison: our 6ad6d69 vs upstream PR 5482
Read both diffs in full. Result: took upstream 5482, re-picked as 051350a4.
Executable change is identical in both.
bin/fm-classify-lib.sh:done:ship|done:scout|failed:*arms removed from the keyed-decision fold_fm_status_kindhelper deleted (it existed only to feed those arms)FM_OPEN_DECISIONS_FOLD_VERSIONbump and the same drop of the<n>:<kind>cursor-key suffix
Differences, all non-executable:
bin/fm-crew-state.shcontract header, which oursdeliberately left describing the superseded "a terminal line closes the decision" rule
Chose 5482 because the change is the same, it carries that extra header correction, and
it is our own contribution upstream is already reviewing, so taking their wording keeps
the next sync conflict-free when 5482 merges.
One defect fixed on top, because the pick is what made it false: both versions leave the
cursor-key comment in
bin/fm-classify-lib.shdescribing a task-kind suffix that thechange removes. Corrected in the same commit.
Conflict resolutions in the hot-spot files
Where our change and an upstream change overlapped, the rule applied was: keep both
behaviours when they are orthogonal, and keep the stronger one when they solve the same
problem. Nine resolutions were more than mechanical.
1.
bin/fm-crew-state.sh- a cancelled run is not a failure (a4e563b5)Our commit read a cancelled validation run as
failed. That is exactly the bug upstream'sown fix corrected, and upstream now reads it as
unknownwith "no verdict" plus aheld-green reclassification guard. Took upstream's reading for the
cancelledarms andkept ours only for genuinely unrecognized status words, where the distinct
unreadablestate is the point of our change. Upstream's merged tests independently require this exact
split, which is what confirmed it.
Also in the same file: upstream has moved the state-database path out of the Python reader
into a shell helper. Kept that helper as the single owner and layered our three-candidate
repository lookup and named failure reasons on top, rather than reinstating our version's
in-reader path computation.
2.
bin/fm-teardown.sh- the landed-work proof lost its base branch (b134d8ab)The most consequential catch. Our commit moves the "has this work actually landed?" proof
into a shared library. Upstream had independently taught its own copy of that proof to
compare against a task's named base branch rather than always the project default.
Taking our extraction wholesale silently dropped that: a task started from a release
branch would have had landed work read as unlanded.
That fails in the safe direction - teardown refuses rather than destroys - but it would
have blocked cleanup on every based task. Carried the base-branch comparison into
bin/fm-unlanded-work-lib.shas an explicit optional parameter (libraries here takearguments rather than reading caller globals) and threaded it through both call sites.
Kept upstream's slot-owner-claim exception alongside our new launch-side refusal and
release tool: the exception stops a reassigned slot's stale record being stranded, the
refusal stops duplicate pairs forming, and they guard different failure modes. The
launch-side caller of the shared scan deliberately keeps no exception.
3.
bin/fm-backend-herdr.sh- upstream fixed the same bug better (82b1a612)Our commit bounded the composer proof read to 200 rows. Upstream had independently fixed
the same
fm-control exitbreakage by reading the full visible viewport, and itsone-argument signature means our
200would have been silently ignored. Took upstream'sread. For the later vim-mode commit (c7503466) our retry loop owns the shared tail, so
that loop is kept - on top of upstream's viewport read, not our weaker one - and upstream's
$ring_retryreporting is kept because it reports what actually happened instead ofasserting it.
4.
tests/fm-contributions.test.sh- one owner for the clock (dc81c61a)Upstream already had our atomic-publish fix under a different name. Rather than ship two
functions doing the same job in one fixture, kept a single owner: upstream's name, so
future syncs stay clean, with our epoch validation folded into it.
5.
tests/fm-seat.test.sh- a dropped commit's test rode along (ded48663)The three relaunch-refusal commits dropped under Q5 are ancestors of later carried
commits, so their test for the relaunch refusal arrived while its implementation correctly
did not. It would have failed. Removed that one test and kept its two neighbours, which
remain true without the refusal.
6.
bin/fm-lint.sh- checked before assuming supersession (17d72f7e)The report says to prefer upstream if it covers our partitioning. Upstream has since added
bounded workers with memory limits and retries, which addresses the root cause our
four-way split worked around - so the initial read was that this pick was superseded.
Checking upstream's actual CI showed it is still fixed at two partitions, so it does not
cover the generalized count. Carried, with our
<n>of<total>support layered on upstream'sbounded-worker machinery.
7. Calm mod gate (906531bd) - kept upstream's documentation and coverage
Our commit condensed several Calm doc sections into prose. Upstream has since added whole
sections there (supervision notes, the record-backed doorbell, support bounds). Taking
our side would have deleted them, so upstream's structure and content is kept and only the
gate semantics applied:
FM_CALM_ENABLEDas the activation gate with the old platform flagas a deprecated alias.
Two bugs the merge would otherwise have shipped:
fm, but ourwait_module_loadedhelper greps for theold
firstmate-calmspelling, so every phase of the live guard would have failed. Thehelper now uses upstream's
MODULE_LOADEDpattern.launchwith the old numeric argument,which the new gate-string signature would have turned into a nonsense settings key. Both
call sites now pass a gate value.
Same reasoning in
tests/fm-calm-claude-mod-live-e2e.test.sh: our commit removed the livehidden-operational-row assertions because this Claude Code strips the envelope marker.
Upstream's record-backed doorbell is the better answer to that same problem, and the fork
later adopted it in #26, so upstream's doorbell assertions are kept and our marker-strip
phase is kept as a tripwire beside them.
The
env readsassertion was settled from the real validator output, not by guessing theunion.
8.
#26doorbell - partial carry (eccfd45f)Upstream's own doorbell is already in the base, so the fork's port of it is not carried.
Beyond duplicating one owner, the port is the weaker of the two: it drops the task-channel
--add-dirgrant infm-spawn.shand the inject failure diagnostics infm-supervise-daemon.shthat upstream has since added. Carried only the fork-specific livemarker guard, its registration, and the Claude Code 2.1.291 verification record.
9. AGENTS.md re-homing (Q7)
Upstream's restructure replaces the inline home-layout tree and the agent-only trigger list
with one-line skill pointers. Every fork line that AGENTS.md used to carry is re-homed into
the skill that now owns the area, leaving no fork content in the always-loaded file:
operational-home-layoutclaude-seat-lead-restarttrigger ->agent-skill-trigger-indexship-landingTest results
Run on the sync branch, in an isolated copy, with
TYPESAFE_API_KEYunset so the resolveris off as it is in CI.
bin/fm-lint.sh --partition 1of4..4of4bin/fm-doc-audience-check.shclaude plugin validate --strict(Calm mod)claude plugin test(Calm mod)fm-fleet-snapshot-viewfm-bearings-snapshotfm-crew-statefm-classify-decision-key,fm-classify-corr-tokenfm-wake-drain-open-decisionsfm-captain-hold-lifecyclefm-bootstrap,fm-dispatch-resolvefm-seat,fm-seat-board,fm-worker-account,fm-usage-warnerfm-teardown,fm-teardown-endpoint-safety,fm-pr-merge,fm-pr-check-securityfm-control,fm-backend-herdr,fm-spawn-dispatch-profile,fm-contributionsfm-brief,fm-dod-lib,fm-send-resolve-key,fm-wake-drain-open-decisions-cursorfm-composer-lib,fm-secondmate-harness,fm-quota-choose,fm-shared-captain-inheritance,fm-trace-context-libfm-control-relaunchBoth CI count pins were checked against a real run rather than adjusted to taste; neither
needed changing.
The live guard on the installed Claude Code
FM_OPERATIONAL_MARKER_LIVE_E2E=1 tests/fm-operational-marker-live-e2e.test.sh, theprompt-submitting guard carried from #26, run against the installed Claude Code 2.1.291.
Both cases pass, and both submit a real turn:
doorbell carrier is required - the submitted-prompt hook and the session transcript agree,
and the rendered removal notice is present;
carried out the operational input the envelope holds.
The guard reports the harnesses it could not check rather than passing over them: codex,
opencode, pi and grok are not installed here, so their carrier selection is unverified by
this run. Claude is the harness this branch's carried changes touch.
The rehearsal's two open carry-overs are both settled
fm-bootstrapno-key diagnostic: the already-filedTYPESAFE_API_KEYenvironmentleak, confirmed rather than assumed. The suite fails whenever that key is exported and
passes with it unset, on this branch.
fm-dispatch-resolvefails and passes for the samereason. Neither is caused by the sync, and CI does not export the key.
fm-captain-hold-lifecycle: a flake, not a regression. One case that arms a visualreview deck failed once with the underlying tool reporting no listener; the suite then
passed on unmodified
upstream/mainand passed on this branch on re-run. Not blamedon the merge without that comparison.
Three failures found; two were mine, one was upstream's
1.
fm-brief- the direct-PR create placeholder (mine). The origin-resolution stepscarried from #16 pin the placeholder
--base <default branch>, which was right when a forktask always based its PR on the project default. Upstream has since added named base
branches and the merged block now also tells the worker to use the contract's named base, so
that placeholder contradicted the instructions around it. Fixed in
9e9f5188.2.
fm-brief- the direct-PR opening sentence (mine). Fixing (1) exposed a secondwording collision in the same block that I had resolved by picking a side. The fork's
sentence names
originas the push target; upstream's namesgh-axias the tool that opensthe PR, and upstream's named-base test pins that phrase. Each carried a fact the other
lacked, so
4085c97akeeps both. Verified against a rendered brief: all three competingassertions now match.
3.
fm-control-relaunch- the Herdr Pi relaunch case (not the sync's). Two separatethings, and it is worth separating them because the first was hiding the second.
A pre-existing upstream portability defect. The case flips its task record to
harness=piwith the GNU spelling of in-place
sed. BSD sed takes-i's suffix as a separate argument,so on macOS it reads the substitution as the suffix and the record's path as its script,
errors, and silently leaves the record unmodified - so the fixture the case means to set up
is never applied, with the error buried in the suite's output. The line is byte-identical on
upstream/mainand absent from fork main, and it was the only GNU-stylesed -ileft in thetest tree. Fixed in
db6c9348using the temp-file shapetests/wake-helpers.shalreadyuses; the substitution is unchanged.
The case's own environment requirement, which the fix then revealed. With the record
correctly set to
harness=pi, the spawn refuses withpi executable not found on PATH. Thecase needs the Pi runtime, which CI installs (
@earendil-works/pi-coding-agent) and themacOS host these runs used does not have. The suite's skip guard only checks for
jq, so thecase fails rather than skipping on such a host.
So this case is not verified on the host used here, and cannot be: it fails identically on
unmodified
upstream/main(same count of passing cases), before and after the portabilityfix. CI installs the Pi runtime and is where it gets exercised. The remaining 65 cases in that
suite pass,
fm-controlandfm-backend-herdrpass in full, and those three together arewhat cover the Herdr control changes this branch carries (
82b1a612,c7503466).I should be straight about one thing: I justified making the portability fix on the grounds
that it would make those Herdr picks verifiable on this host. That was wrong - the missing Pi
runtime bounds the case either way. The fix stands on its own merits, because a test whose
fixture is silently never applied is worse than one that fails loudly, but it did not buy the
local verification I claimed it would. I did not also add a Pi guard to the skip condition:
that only changes a local fail into a local skip, is upstream's design choice, and has no
bearing on this sync.
What to check before merging
This branch replaces most of the repository, so these are worth a look before the merge
rather than after.
0. How this lands
An ordinary merge.
origin/mainis an ancestor of this branch, so it merges through thenormal guarded path with no force-update of any default branch and no special strategy.
It did not start that way, and the history shows why. The branch was built from
upstream/mainand re-picked the fork's changes on top, which is the approved Q1 shape but makes it a rebuilt
history rather than a descendant of fork main. Measured at the time: from the common ancestor
ac2ed3b2, fork main carried 37 commits and this branch 180, and a test merge produced 85conflicting hunks. The pipeline's own rebase step was skipped for that reason - rebasing onto
origin/mainwould have merged fork main's superseded versions back into the branch built toreplace them.
After checks first went green, the pipeline's CI monitor performed that rebase itself, which is
its documented behaviour on a conflict.
c7e440bdthen restores the sync's content on top.The restore was verified, not assumed. The pre-rebase head that passed the test step is no
longer obtainable (the primary clone still points at the submitted head and no preserved ref
exists for this run), so the comparison was made against the stronger available baseline: the
submitted head
db6c9348, whose content was authored and independently validated before therun began.
git diff --stat db6c9348 c7e440bdis 21 files, +257/-64, and every file maps to an intendedpipeline fix: the 13 review findings, the 2 regressions its own fix review caught, the tests the
test step added, the docs the document step updated, and the lint root-cause fix. Nothing else.
The files that a decision or a deliberate resolution governs are byte-identical to that
validated head:
AGENTS.md(so the Q7 re-homing survived - the upstream pointer is present andthe fork's inline seat line is absent),
bin/fm-classify-lib.sh(the Q6 choice),bin/fm-supervision-engine-lib.sh(Q8's default untouched in code),bin/fm-nm-run-lib.sh(theheld-back finding never applied),
tests/fm-control-relaunch.test.sh, both Calm docs,.github/workflows/ci.yml,bin/fm-lint.sh,bin/fm-test-run.sh, and.agents/skills/operational-home-layout/SKILL.md.bin/fm-usage-warner.shis the one decision-governed file that changed, and it changed only bythe sanctioned re-notify fix; its percent-left threshold semantics are intact.
Against fork main the branch is 333 files, +50028/-4495 - the replacement the captain approved.
1. Decide the supervision host before updating, not after
Q8 asked to defer the supervision host to a separate evaluation. That chain is already
merged into upstream's main, including the commit that turns it on by default for a
Claude primary, so it arrives with the approved base rather than as a pick. The approved
course was to accept it with the base and switch it off locally at merge time.
Before running the fleet update, create the opt-out in the main home:
Doing it first matters: the update's convergence sweep is what carries the file to the
secondmate homes, so a file created afterwards does not reach them until the next
convergence.
One file is enough for the whole fleet.
supervision-host-offis in the declaredinheritable set and is not machine-local, so convergence propagates it to every
registered secondmate home - local and remote alike - and a live secondmate gets a re-read
nudge. Fleet records here mention the firstmate-repo secondmate, the typed-resolution lab,
and the product-development secondmate; the primary's own secondmate registry at merge time
is the authoritative list, and convergence covers all of it without naming any home.
Verified on this branch's merged code, through the gate's own entry point:
Worth knowing either way: upstream issue 6685 reports the host silently passing every wake
through to main when the host machine's Node lacks TypeScript support. That is a reason to
evaluate the host deliberately rather than inherit it unexamined, and it is the failure the
opt-out avoids for now. Removing the one file is the whole reversal when the evaluation runs.
2. Relaunch under a moved seat pin is unprotected for now
Q5 dropped our three relaunch-refusal commits while upstream PR 5498 is still open. The
spawn-time guard (
1b3a2dac) is kept, so a spawn that configures both a worker accountpin and a Claude seat is still refused. What is no longer refused is relaunching a task
that was recorded on a seat the current pin does not select. Until 5498 merges, that case
proceeds instead of stopping. Re-check when 5498 lands.
3. Seat propagation is unchanged, as Q2 asked
Seats remain machine-local by construction: the six seat files and the auto-exclude list are
in the machine-local subset, so they reach local secondmate homes and never cross to a
remote route, and a home can still decline them for itself. Nothing in this branch changes
that.
4. The seat quota board issue is fixed, not carried
I raised a DNS-rebinding issue on the board earlier in this task: it served through a stock
HTTP server that validates no
Hostheader, so a hostile page visited while the board wasrunning could read each seat's account email and quota figures. Fork PR #28 fixed it and is
carried here (
de211df6), so this branch ships the fix rather than the exposure.The fix answers only when the request's
Hostis exactly loopback with the board's ownport and refuses anything else with 403, adds a per-run unguessable path token so a correct
Hostalone is not enough, and stops the refusal surface reporting the host's Pythonversion. Its suite covers both the rebinding refusal and the path token.
5. Spot-checks worth making yourself
AGENTS.mdcarries no fork-specific layout or trigger content any more (Q7). The contentmoved into
operational-home-layout,agent-skill-trigger-indexandship-landing.wording is upstream's.
6. One review finding was left unfixed by omission, not by decision
nm-run-inventory-fallback(info) said the inventory reader should report an unrecorded repoas unreadable rather than fall back from the task worktree to the primary checkout. That
fallback is the titular feature of
a4e563b5, carried under Q1, so fixing it would have undonean approved pick.
It was excluded from the fix round and never ruled on. The hold was recorded as an ordinary
progress note rather than as a decision record, so no ruling was ever requested, and the finding
lapsed when the review step completed rather than being approved, skipped, or fixed by anyone.
That is a process gap on the worker's side, stated here rather than left to be inferred from a
clean review.
Nothing was silently applied. On the merged head
c7e440bd:git diff db6c9348..c7e440bd -- bin/fm-nm-run-lib.shis empty - byte-identical to theindependently validated head.
fm_nm_primary_checkoutis present (:152), it is passed to the reader (:276), and thethree-candidate list
(overview_repo, worktree, primary_checkout)is intact (:312).What this means for the merge. The behaviour is exactly what Q1 approved, so nothing is
broken by it. The open question the reviewer raised is still open and unanswered: whether
falling back to the primary checkout can attribute runs from the wrong repository row when a
spelling is re-registered. That is worth a follow-up on its own, not a blocker here.
Validation run: test step
Drove the live Herdr submit/doorbell/exit guard against real Claude Code in a throwaway fm-lab session. The test tore the session down itself. All six cases passed, with /exit now running last. Also ran the targeted CLI suites for every surface the review, lint and rebase-resolution rounds touched, and all of them passed. Those suites use stubbed backends and quota readers, because driving the seats live would touch the real FM_HOME and accounts, so their scenarios are marked untested live. The worktree is clean.
Evidence: Live Herdr/Claude submit-confirm guard transcript
Source: Live Herdr/Claude submit-confirm guard transcript
Evidence: fm-seat suite transcript
Source: fm-seat suite transcript