Repository navigation
Sync the fork with upstream and land the ten reviewed changes - #17
Merged
Merged
Conversation
* fix: escalate ask-user contract expansion * no-mistakes(document): Point project management to authority owner
* fix(pi): hide Calm operational user rows * no-mistakes(review): Narrow Calm operational input suppression * no-mistakes(review): Avoid Calm replay classifier subprocesses * no-mistakes(document): docs: point Pi verification to Calm owner
* fix(session-start): relaunch missing second mates * fix(test): detect completed parallel workers * no-mistakes(review): Isolate session-start recovery test cleanup * no-mistakes(review): Complete backend-safe secondmate session recovery * no-mistakes(review): Resolve Zellij task ownership before recovery * no-mistakes(review): Recover relocated Zellij ghost tabs safely * no-mistakes(review): Restore conservative Zellij recovery boundary * no-mistakes(review): Reject malformed tmux recovery targets * no-mistakes(document): Align secondmate recovery documentation * no-mistakes: apply CI fixes
…id#967) * fix(herdr): reclaim resumed task projections safely * no-mistakes(review): Enforce safe Herdr reclaim close boundaries * no-mistakes(document): docs: clarify Herdr restart projection contract
…id#994) * docs: separate current guides from verification * no-mistakes(review): Restore Herdr 0.7.5 restart-reclaim verification evidence
…d#997) * feat(claude): Stop-owned tokenless watcher continuity via asyncRewake auto-arm Claude primaries (main home and marked secondmate homes) no longer depend on the model remembering to re-arm the watcher after each wake. A tracked Stop asyncRewake hook (bin/fm-claude-stop-autoarm.sh, timeout 28800s) fires on every turn end, claims one home-scoped single-flight owner, foregrounds bin/fm-watch-arm.sh inside the hook-owned process tree, and translates an actionable close or typed watcher failure into exactly one exit-2 rewake. The hook scopes to genuine primary checkouts, requires the session lock to be held by its own harness ancestor, stays inert while AFK owns triage or the home is idle, and hands AFK transitions mid-cycle to the daemon without rewaking. The synchronous turn-end guard gains a --claude cooperative mode: it ignores stop_hook_active (true on every post-continuation stop, which is what re-opened the 2026-07-21 blind window), waits briefly for a watcher health proof, a live auto-arm owner claim, or a fresh rewake epoch, and re-blocks only when the auto-arm genuinely failed to establish - bounded to 3 consecutive blocks per session, safely below Claude Code's 8-block override, then a degraded allow with a visible systemMessage. Codex keeps the previous one-block loop guard byte-identically, and Pi, OpenCode, and Grok adapters are untouched. Continuity PreToolUse gate and durable wake queue are preserved; the gate's recovery guidance now names the Stop-owned re-arm and reserves manual background arms for auto-arm failure. Claude supervision protocol, harness-adapters facts, architecture, configuration, and continuity docs updated; docs/turnend-guard.md records the 2026-07-24 Claude 2.1.218 contract revalidation (tokenless multi-cycle rewake, no-dedup, timeout process-group kill, 8-block cap, interactive non-stall) and the 2.1.219 product live E2Es. Regression matrix: hermetic tests cover scope, identity, AFK, need, single-flight, translation, guard cooperation, budget, and registration; the new live E2E proves two full tokenless auto-arm rewake cycles with zero model arm commands; Pi and OpenCode Option B live E2Es pass unchanged. * no-mistakes(review): Fix Claude X-mode auto-arm continuity backstop * no-mistakes(review): Remove unsupported Claude contract-lab verification claims * no-mistakes(document): Update Claude auto-arm continuity documentation
* Clean stale Herdr projections at session start * no-mistakes(document): Document stale Herdr session-start projection cleanup * no-mistakes(review): Enforce locked exact Herdr projection cleanup * no-mistakes(review): Fail closed on unverified session lock ownership * no-mistakes(review): Serialize session lock acquisition atomically * no-mistakes(document): Align session-start and Herdr cleanup documentation * no-mistakes(document): Generalize lock-refusal diagnostics * no-mistakes(lint): Avoid reserved keyword in concurrency test * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes
…uid#1001) * fix: recover Claude supervision at session start * fix: remove Claude watcher-status command gate * no-mistakes(document): docs: remove stale continuity gate references
* Replace quota dispatch selector instructions * no-mistakes(review): Align bootstrap docs with agent-owned dispatch selection
* remove vestigial dispatch selector * no-mistakes(review): Synchronize isolation proof and portable shard evidence * no-mistakes(review): Correct shard history and proof archive date * no-mistakes(review): Remove reintroduced selector documentation reference * no-mistakes(document): Remove stale dispatch strategy documentation
…1039) quota-axi 0.1.13 emits schemaVersion 2 with a quotaSemantics object per provider, so the successor named in the interim rule has landed and the rule's own removal condition is satisfied. Keep the ownership clause so quota-axi remains the single owner of how model or product windows relate to bounding account windows, and drop the interim weakest-headroom instruction. The unknown-semantics case is already covered by the existing requirement to stop and report a candidate whose applicable quota data or interpretation cannot be established. Drop the matching assertion phrase from tests/fm-instruction-owners.test.sh; the retained ownership phrase still asserts.
…unchenguid#1049) * fix(tmux): scope Claude busy detection by harness * no-mistakes(review): Separate verified and fallback busy signatures * no-mistakes(test): Scope busy signatures to supplied harnesses * no-mistakes(document): Document harness-scoped busy detection
* Add verified Kimi crewmate harness adapter * no-mistakes(review): Scope Kimi moon detection to spinner lines * no-mistakes(review): Match only complete Kimi spinner rows * no-mistakes(review): Resolve Kimi binary portably before pane creation * no-mistakes(document): Align Kimi adapter documentation * no-mistakes(lint): Suppress false-positive ShellCheck warning for sourced watcher override * Fix Kimi busy spinner detection * no-mistakes(review): Recognize Kimi session-lock ancestry and holders * no-mistakes(review): Scope pending-reply Kimi busy detection by harness * no-mistakes(document): Correct Kimi spinner capture documentation * no-mistakes(document): Clarify optional Kimi spinner whitespace * no-mistakes(lint): Silence intentional pending-reply test stub warnings * test: align rebased Kimi busy fixtures * no-mistakes: apply CI fixes * Reconcile Kimi busy detection after per-harness scoping * no-mistakes(review): Clarify observed Kimi spinner whitespace contract * no-mistakes(document): Clarify Kimi harness documentation
* fix kimi pointer submission and spinner conformance * no-mistakes(review): Preserve Kimi submit target ownership guard
* Add guarded Kimi turn-end hook * no-mistakes(review): Require jq before installing Kimi turn-end hook * no-mistakes(review): Expose jq inside isolated Kimi test fixtures * no-mistakes(review): Preserve Kimi config boundaries during hook removal * no-mistakes(review): Document Kimi removal newline safeguard * no-mistakes(document): Document Kimi shared-home preservation
) * Fix structural tmux composer reading * Verify Calm compatibility with Pi 0.82 * no-mistakes(review): Harden structural composer classification boundaries * no-mistakes(review): Refresh composer and Kimi regression fixtures * no-mistakes(review): Fail closed on unbounded composer edges * no-mistakes(review): Enforce aligned composer geometry safely * no-mistakes(review): Make composer ambiguity locale-safe * no-mistakes(review): Preserve ambiguity through composer submission * no-mistakes(review): Carry composer proof through retries * no-mistakes(document): Document structural tmux composer delivery guarantees * no-mistakes: apply CI fixes
* feat: add verified pi-signed adapter * no-mistakes(review): Correct pi-signed maintainer verification date * no-mistakes(review): Correct remaining pi-signed verification dates * no-mistakes(review): Preserve authoritative pi-signed runtime identity * no-mistakes(document): Document pi-signed shared adapter semantics * no-mistakes: apply CI fixes
* fix(pi): rearm watcher across same-process session transitions Pi emits session_shutdown for ordinary /new, /resume, and /fork replacement as well as terminal quit. The primary watcher extension latched a module-level stopping flag on every shutdown, so a replacement session in the same process could not arm monitoring until Pi restarted. Own arm authority per session generation so only the active live generation may start, stop, or rearm the child. Replacement sessions can arm again without restarting Pi, stale prior-generation callbacks cannot mutate the active cycle, and real quit still blocks late rearm. * no-mistakes(review): Preserve Pi generation isolation and exit cleanup * no-mistakes(document): Correct Pi watcher transition documentation
* Consume quota-axi pace signals in dispatch profile array selection. Add quota-array-dispatch as the single owner of the pace-aware candidate choice, keep AGENTS.md to the intake boundary and load trigger, and cover the acceptance cases with sanitized schemaVersion 3 fixtures. * no-mistakes(review): Stop and report genuine quota dispatch ties * no-mistakes(document): Document quota pace freshness and uncertainty
…nguid#1171) * fix(grok): adapt Stop continuation to runtime capability * no-mistakes(review): Reject ambiguous Grok Stop payloads * no-mistakes(review): Reject duplicate Grok fields and accept spaced tmux sessions * no-mistakes(review): Enforce exact tmux cleanup selectors * no-mistakes(test): Fix historical tmux fixture and validate Grok Stop * no-mistakes: apply CI fixes
* fix(brief): make DOD scaffolding parse-safe on stock macOS Bash 3.2 fm-brief.sh built each Definition-of-done block and the not-enabled Herdr declaration with `VAR=$(cat <<EOF ... EOF)`. On Bash 3.2 (macOS /bin/bash) the lexer scans for the command substitution's closing `)` textually and tracks quote state through the heredoc body, so a single apostrophe, unbalanced quote, or unbalanced paren in that prose breaks parsing of the whole script. Every ship-brief scaffold (no-mistakes, direct-PR, local-only) failed with `unexpected EOF while looking for matching )`. Bash 4+ parses it fine, so the breakage stayed invisible everywhere except stock macOS. Replace all four command-substitution heredocs with `IFS= read -r -d '' VAR <<EOF || true`. That removes the `$(...)` wrapper and the entire defect class regardless of future prose, and preserves the variable expansion the direct-PR and local-only bodies need. `read` keeps the heredoc's trailing newline that `$(...)` used to strip, so trim one newline to keep every generated brief byte-identical to prior output. Guard the structure, not one historical phrase: a new test rejects any heredoc nested in a command substitution anywhere in fm-brief.sh, where the old assertion pinned a single apostrophe phrase and so missed the reintroduction. Extend the stock-macOS Bash CI job from parsing one script to the whole maintained shell surface (bin/*.sh, bin/backends/*.sh, tests/*.sh), matching bin/fm-lint.sh's canonical file set so parse scope and lint scope cannot drift apart. * no-mistakes(review): Captain: harden Bash structure and inventory guards * no-mistakes(document): Align stock macOS Bash contributor checks * no-mistakes(lint): Suppress deliberate SC2016 literal fixture warnings
* fix(test): pin teardown tmux baseline to historical kill selectors merge-base HEAD main collapses to HEAD after the exact-selector change lands on the default branch, so the old teardown fixture was accidentally exercising current exact targets. Resolve a content-historical permissive tmux adapter from first-parent history and force that post-squash topology inside the conformance case so main and feature branches keep the same old-vs-new contract. * no-mistakes(lint): Suppress intentional literal-pattern ShellCheck warnings
…id#1197) Cut the runtime skill to the compact pace-aware selection procedure plus minimum owner pointers. Keep every distinct decision rule and move expanded acceptance scenarios to deterministic fixture ownership assertions. Size: 170/1374/10187 -> 63/544/4068 (about 63%/60%/60% reduction).
…1219) * Inherit config/backend into secondmate homes with deliberate-override preservation Add backend to the shared inheritable config allowlist so launch, locked bootstrap, and config-push converge a primary pin into secondmate homes as each home local future-spawn default. Track last-inherited bytes in a private state provenance marker so deliberate per-home overrides survive present and absent primary convergence, keep --backend and FM_BACKEND stronger, and extend the existing inheritance tests plus docs and skill claims. * no-mistakes(review): Preserve equal unprovenanced backend overrides * no-mistakes(review): Preserve symlink overrides and verify spawn precedence * no-mistakes(review): Snapshot backend inheritance for consistent provenance * no-mistakes(review): Simplify backend inheritance to primary-authoritative convergence * no-mistakes(document): Document inherited backend override preservation * fix: restore primary-authoritative backend inheritance after document regression The document step reintroduced provenance and deliberate per-home override semantics after review had simplified config/backend to plain primary-authoritative allowlist membership. Restore the primary-always-wins path: present overwrites, absent removes, no provenance marker, and docs/tests match that contract. * no-mistakes(review): Add divergent backend precedence regression fixtures * no-mistakes(document): Document backend inheritance contract
* fix(pi): remove Calm's exclusive Pi upper-version ceiling
tests/fm-calm-pi-extension.test.sh gated on a closed PI_COMPAT_VERSIONS
allowlist ("0.81.1 0.82.0") that refused any other installed Pi, and docs
described that range as "supported" rather than verified evidence. The
Calm CHANGELOG shows no API introduced at either version, so there is no
evidence for a real minimum; the presentation adapters already probe the
exact method they patch rather than checking a version.
Replace the allowlist with dated version evidence that never rejects a
newer Pi, and make each presentation adapter degrade independently with
a diagnostic if a future Pi removes its API, instead of the whole Calm
extension failing to load. Rewrite the feasibility doc's "Pi 0.81.1
through 0.82.0" phrasing to state it as verified evidence, not a
ceiling.
* no-mistakes(review): Probe missing Calm adapter exports safely
* no-mistakes(document): Document Calm's unbounded Pi compatibility
…enguid#1204) * fix(guard): allow session-local todo tools in the primary The delegation-shape guard denied TaskCreate and TaskUpdate because their normalized names contain the `task` stem. Those tools write only the harness's session-local todo list, which has no executor: it spawns no agent, allocates no worktree, registers no schedule, and starts nothing that outlives the session. That is not the unaccounted work the guard exists to stop, so the stem match was a false positive, and the deny text told the primary to run bin/fm-brief.sh and bin/fm-spawn.sh to create a todo entry. Add a separately-reasoned PLAN_ONLY_TOOLS exact-name exclusion rather than widening OBSERVE_ONLY_TOOLS, whose documented contract is tools that only observe or stop existing work. Both lists stay exact-name so neither can widen by substring. Tests cover the two allowed names and six near-miss names that a substring or shortened-stem widening would release; both mutations were watched red. * no-mistakes(review): drop session-local todo tools from recommended deny list * no-mistakes: apply CI fixes
…claude pid (kunchenguid#1206) * fix(session-lock): resolve Claude bg-spare ancestry to the outermost claude pid fm_harness_ancestry_pid() previously returned the first ancestor process whose command matched a verified harness name. Claude Code's Stop hook fires as a bg-spare worker several levels below the session's actual lock-owning claude process (hook shell -> claude bg-spare -> claude bg-pty-host -> claude -> claude(lock)), so the first match was the bg-spare worker, not the lock owner. fm_session_lock_owned_by_self() then never matched state/.lock, and the Claude Stop auto-arm silently treated its own primary session as an unrelated live owner and never armed the watcher. The walk now keeps going past a claude-named match, looking for a still more ancestral claude-named match, and stops the instant a non-match follows an already-found match (bounding it to a contiguous run rather than the literal ancestry top, so an unrelated claude-named process further up the real process tree is never mistaken for part of this session's own nested chain). Every other harness keeps the original first-match-wins behavior, since e.g. Pi's shared signed-wrapper ancestry actually holds the session at the inner engine pid, not an outer wrapper pid. Hop limit raised from 8 to 16 to cover the deeper bg-spare chain. * no-mistakes(review): Add nested-claude-ancestry regression test; fix nudge doc depth claim * no-mistakes: apply CI fixes
* feat(spawn): propagate a native W3C traceparent to spawned agents Add a default-off capability that resolves one W3C traceparent for a task, injects it into the agent's pane shell as the TRACEPARENT environment variable immediately before launch, and records the identical value as traceparent= in state/<id>.meta, so an external observer that explicitly reads that env value or meta field can correlate a worker, a Secondmate, and their nested children into one trace with no collector, storage, UI, or vendor coupling. TRACEPARENT as an environment variable is a firstmate convention carrying a W3C-formatted value: W3C Trace Context standardizes the header, not an env var, and OpenTelemetry SDKs do not read it automatically, so a downstream must consume it deliberately; this feature parents no SDK span by itself. Identity is per task, not per spawn: the carrier is minted with random ids on the first spawn, adopted as a child (fresh span, same trace) for a nested spawn whose parent already holds one, and reused verbatim from the meta on relaunch, so a task keeps one stable logical identity across restarts. A malformed or all-zero inherited value is treated as absent and roots a fresh trace. A new root is sampled (01) - a sampling decision a downstream parent-based sampler honors, not a guarantee that any collector stores a span, and firstmate emits no spans; a child preserves the inherited flag. Trust boundary: a firstmate-minted root is random and reads no prompt, path, task prose, credential, or arbitrary environment key. An inherited TRACEPARENT is opaque caller-controlled data - up to 24 bytes of id passed through after syntax validation - so whoever set it controls those bytes, a bounded fixed-width channel rather than a general content or secret channel. The feature adds no OTEL_* variable, no tracestate, and no arbitrary environment injection; it runs no configurable or arbitrary command, only the fixed local od and tr (resolved from PATH) to read a few bytes of entropy - a small local pipeline with no network or watchdog and no hard latency guarantee. Any entropy or validation failure that returns omits the carrier without aborting the spawn. A default-off spawn leaves the generated meta and launch environment unchanged. Enablement is default-off (config/trace-context, or FM_TRACE_CONTEXT where a non-empty value overrides and unset or empty defers to the file) and is propagated into secondmate homes, taking effect at each agent's next launch: a Secondmate launched or relaunched after enablement carries the primary trace into its nested workers, while an already-running Secondmate roots new traces for its own workers until relaunched. Injection reuses the existing GOTMPDIR channel, so all spawn backends and harnesses and the ship, scout, and secondmate paths are covered. Covered by a pure-library suite and a spawn-path integration test (fake tmux plus a real worktree, hermetic against ambient FM_TRACE_CONTEXT) proving the recorded and injected carriers are identical and sent before launch, that default-off writes and injects neither, that a relaunch reuses the recorded carrier, and that an explicit FM_TRACE_CONTEXT overrides the file both ways; plus a source-owner inheritance test proving trace-context propagates and absence-mirrors through propagate_inheritable_config. Documentation follows the repository documentation-audiences contract: docs/trace-context.md is maintainer-architecture rationale, the configuration schema lives in docs/configuration.md, and the repeatable test evidence is separated into docs/verification/trace-context.md (maintainer-verification), registered in docs/documentation-audiences.json. * fix(spawn): propagate the effective trace-context decision to secondmates FM_TRACE_CONTEXT overrode trace context only in the process that read it. A newly launched secondmate decided enablement from the inherited config/trace-context file alone, so the override did not cross the primary-to-secondmate boundary: FM_TRACE_CONTEXT=off with the file present left the secondmate's nested workers traced (a broken kill switch), and FM_TRACE_CONTEXT=on with the file absent left them untraced despite the inherited carrier. Deliver the primary's effective decision to a newly launched secondmate as a normalized on/off FM_TRACE_CONTEXT in the launch prefix, so a FM_TRACE_CONTEXT override governs the nested primary -> secondmate -> worker chain both ways, not just the copied file. The value is bounded to the literal on/off and does not broaden environment injection; the already-running secondmate boundary is unchanged. Add a genuine two-level spawn regression that drives fm-spawn twice with the exact environment the primary injects into the secondmate and proves both divergent directions end to end. Correct the documentation that implied secondmate coverage on every backend, since orca and cmux reject secondmate spawns, and refresh the verification evidence for the new assertion count. * no-mistakes(review): Clarify Secondmate trace-context launch snapshots * no-mistakes(document): Correct trace-context documentation ownership and relaunch semantics * fix(spawn): resolve the trace-context decision once for carrier and snapshot The effective trace-context decision was read twice per spawn: once inside fm_trace_context_resolve for the recorded carrier, and again for the secondmate FM_TRACE_CONTEXT launch snapshot. A config-file change between the two reads could pair a carrier with the opposite enable state - an injected carrier with an off snapshot, or no carrier with an on snapshot. Freeze the effective on/off decision once, drive the carrier resolution under that frozen FM_TRACE_CONTEXT so it cannot independently re-read the file, and reuse the same frozen decision for the secondmate launch snapshot. Add a spawn-path regression that drives the file-decided path and proves the recorded carrier and the delivered snapshot always agree, and refresh the verification evidence for the new assertion count. * no-mistakes(review): Preserve legacy Secondmate trace boundary * no-mistakes(document): Correct trace-context verification comparison base * no-mistakes(review): Captain, prevent failed trace delivery metadata claims * no-mistakes(review): Captain, align trace-context tests and verification evidence * no-mistakes(document): Correct trace-context verification evidence * no-mistakes(lint): Suppress intentional ShellCheck literal-dollar warnings * no-mistakes(review): Captain: freeze trace context at session start * no-mistakes(test): Captain: stabilize scheduler test and document Kimi trace coverage * no-mistakes(document): Document trace-context safety boundaries * fix(trace): fail off on stale session snapshots Publish each home session decision atomically through a same-directory temporary file and bind it to the current session lock. A replacement failure can no longer leave an earlier on decision active in a later session; missing, stale, malformed, or unpublishable state defaults safely to off. Add regressions for read-only replacement and failed publication, update spawn and session-start fixtures for the lock-bound format, and refresh the architecture and verification records. * no-mistakes(review): Fix trace spawn failure independence and duplicate safety * no-mistakes(document): Refresh trace-context documentation and verification * no-mistakes(review): Clear partial backend input after failed trace submission * no-mistakes(review): Stop unsafe trace delivery before launch append * no-mistakes(document): Document unsafe trace delivery handling * fix(trace): bound each trace to one routed task, never the routing agent A persistent Secondmate holds its launch-time TRACEPARENT in the process environment for its whole life, and routed requests never replace it, so resolving new-task carriers from the ambient environment chained every routed task into one ever-growing trace per Secondmate with distinct parent ids. Resolve now reuses the task's recorded carrier or mints a fresh sampled root, never reading ambient TRACEPARENT, so each routed task is its own trace boundary while relaunch, recovery, and scout-to-ship promotion keep one stable per-task identity. The spawn regression models the reviewed scenario exactly: two unrelated tasks spawned sequentially through one persistent Secondmate environment record and inject distinct trace ids, adopt nothing from the Secondmate's carrier, and a relaunch of the first task reuses its original carrier verbatim. * docs(trace): define the per-task trace boundary The design contract is one task per trace: a persistent Secondmate is routing infrastructure with its own agent identity, never a shared trace root for the unrelated tasks routed through it. Root/recovery semantics replace the removed child-inheritance path, the sampling and safety sections drop inherited-carrier language because ambient TRACEPARENT is never read, and the verification page records the refreshed suite inventories including the two-task Secondmate boundary regression. * test(trace): adopt the explicit per-task delivery contract in spawn fixtures Rebasing onto current main brings the explicit per-task delivery contract: ship spawns now require --mode and --yolo instead of resolving them from the project registry. The trace spawn fixtures pass the same explicit contract canonical spawn tests use, preserving the per-task trace boundary coverage unchanged, and the verification page records the refreshed comparison base.
* fix(bin): classify tmux agent liveness independent of process titles
`fm_backend_tmux_agent_state` attributed a pane solely from
`#{pane_current_command}`, which is a process TITLE a harness can rewrite,
not a structural fact. Claude Code 2.1.220 reports its version string there,
so a live Claude endpoint classified `ambiguous`: the session-start secondmate
liveness sweep could no longer see it, and any consumer that gates on a
positive classification refuses outright.
Read a second, independent name source: the kernel `comm` of every process in
the pane tty's foreground process group. Either source naming a verified
harness yields `alive`, because a false `dead` is the one verdict that can
start a duplicate agent on a live worktree. Scoping to the foreground process
group rather than the pane's descendants keeps a harness-named background
process from faking an agent, and covers multi-process launchers (the Pi
Launcher path) without a special case.
Verified on 2026-08-03 against all seven adapters running for real on tmux
3.6a / macOS 26.5.2 arm64: claude 2.1.220, codex-cli 0.146.0, opencode
1.18.11, pi 0.82.0, pi-signed 0.82.0, grok 0.2.118, kimi 0.31.1 all classify
`alive`, each attributed by a source independent of its title.
Two tests, because they fail for different reasons:
- tests/fm-tmux-agent-liveness.test.sh pins the logic with real processes and
no harness, so it runs everywhere CI runs tmux. It drives the two name
sources apart on purpose and asserts the divergence, so no case can go
quietly vacuous.
- tests/fm-harness-liveness-drift-live-e2e.test.sh relaunches every installed
harness and fails naming the harness and version when one stops being
attributed by a title-independent source.
AGENTS.md section 4 carries the resulting standing rule, and
firstmate-coding-guidelines owns how to satisfy it.
* no-mistakes: apply CI fixes
* docs: move the harness-dependent-check policy out of AGENTS.md
The standing rule was stated in AGENTS.md section 4 with the mechanics in
firstmate-coding-guidelines, which split one contract across two owners and
charged every session for a rule that only fires when firstmate's own
harness-dependent code is being changed.
firstmate-coding-guidelines is now the single owner of both the rule and how
to satisfy it: real-harness proof required, that proof authorized to spend
tokens, structural signals preferred over vendor-rendered surfaces, and a
guard that fails loudly naming the harness and version where a surface signal
is unavoidable. No inline stub is left behind, because AGENTS.md already
carries the load trigger for that skill in sections 7 and 13, so it is read
before any change to firstmate's shared tracked material.
Also records the cross-platform lesson the pipeline caught in the portable
regression, and corrects that file's header: the divergence assertion lives
on the version-string case, which diverges on both supported platforms,
rather than on every case.
* no-mistakes(review): Harden tmux liveness identity and drift validation
* no-mistakes(document): Clarify cross-platform tmux liveness documentation
…able fm_backend_validate_task_endpoint requires an endpoint_task_id= binding before any non-tmux endpoint may be cleaned up, because herdr, zellij, orca and cmux endpoint ids are opaque and do not encode the task they belong to. fm-spawn.sh writes it for new tasks, but nothing migrated records already on disk, so every task spawned on those backends before that change refuses cleanup permanently. Add bin/fm-endpoint-binding-migrate.sh, a one-shot, idempotent sweep run from the locked bootstrap MUTATING section. It writes the binding only for a record whose recorded endpoint still resolves, live, to a runtime object carrying that task's own label - the same class of self-identifying evidence the legacy tmux path validates by window name. The candidate is committed only after the exact bytes that would land pass fm_backend_validate_task_endpoint itself, so the check is neither relaxed nor reimplemented. Every other outcome refuses and leaves the record byte-unchanged. A confirmed-gone endpoint is reported, never bound: absence is not proof of ownership, and a runtime may later reuse a freed opaque id. A binding written without proof would recreate the exact hazard the validation was added to prevent while looking like a fix. Also force C collation on the test runner's comm calls, whose inputs are already LC_ALL=C sorted; without it the coverage guard failed in a UTF-8 locale.
The coverage guard's comm calls run under the ambient locale on LC_ALL=C sorted input, so --check-coverage fails in a UTF-8 locale. That bug sits on the default branch and is owned by a dedicated task with a more complete fix, so carrying a second copy here would only guarantee a conflict. Only the backend-dispatch family registration for the new migration test remains in bin/fm-test-run.sh.
`tests/fm-test-run.test.sh` exited 1 with every assertion passing, and a stray `comm: not in sorted order` on stderr. The comparison was at fault, not the input. `run_coverage_guard` builds every lane list with `LC_ALL=C sort -u`, but called `comm` under the ambient locale. Evidence that settled it: the portable-serial list passes `LC_ALL=C sort -c` cleanly, and the identical file fails `sort -c` under en_US.UTF-8 at `tests/fm-backend.test.sh`. glibc's en_US.UTF-8 collation ignores `-` at the primary weight, so it orders `fm-backend.test.sh` before `fm-backend-tmux-smoke.test.sh`, while C compares bytes where `-` (0x2D) sorts before `.` (0x2E). The lists were correctly sorted for the ordering the runner chose; `comm` was applying a different one. The unguarded `comm -12` in the lane-overlap loop therefore exited 1 under the script's `set -eu`, killing the guard before it printed its verdict. The `|| true`-guarded `comm` calls were worse in kind: on mis-collated input they silently return a wrong set difference, so a real coverage hole could have passed the guard. Fix: prefix every `comm` in the coverage guard, and the three in this test, with `LC_ALL=C` so the set operations use the same collation as the sorts that produced their inputs. No warning is suppressed. Also fix why the failure was invisible. Each `set +e ... rc=$?; set -e` pair in the test enabled errexit rather than restoring it - the file's baseline is `set -u` only - so from the first pair onward any unguarded non-zero exited the suite silently, with no `not ok`. Replaced all ten with `rc=0; <cmd> || rc=$?`, which captures the status correctly whether or not errexit is on and leaks nothing. New `test_coverage_guard_is_collation_independent` asserts the guard exits 0 with empty stderr under C, the ambient locale, and the first installed locale whose collation actually disagrees with byte order, discovered by probe rather than hardcoded. It fails against the pre-fix runner.
…#1609) * feat(bin): trace remote secondmate routes and unify the inherit allowlist Per-task W3C trace context (kunchenguid#995) resolved and injected its carrier only at the local spawn path. A remote secondmate is routed through spawn_remote_secondmate, which returns long before that site and wrote its own metadata block, so a remote secondmate stayed silently untraced even with the capability enabled. The parent home still owns that task's identity, because it holds the metadata an observer reads. It now resolves the carrier against the task's own meta under its own frozen decision - reused verbatim on relaunch, freshly rooted otherwise, never adopting the parent process's ambient TRACEPARENT - and hands it to the configured host through a new fm-spawn --traceparent argument, accepted only for a secondmate launch and only as a strict W3C value. The remote host exports it at the same unconditional pre-launch site and reports back the carrier its endpoint actually holds, which the parent records, so an already-alive endpoint reports the identity its agent really received rather than one the parent merely intended. Disabled remains byte-identical and off. The remote inherit path also carried its own hardcoded copy of the inheritable config set, already drifted from FM_INHERITABLE_CONFIG by trace-context. Both remote ends now derive from that one declaration, so a future item cannot be sent by one side and refused by the other, and session-scoped enablement items are skipped on live convergence exactly as the local path skips them. Also fixes a latent stderr leak: an absent session lock printed a raw redirect failure, which the new remote resolve site made visible. Adds tests/fm-remote-secondmate-trace-context.test.sh, driving the real parent -> fm-on -> remote entrypoint -> control -> remote fm-spawn chain over the deterministic SSH boundary and reading the carrier back from the remote pane's own log. * no-mistakes(document): Clarify remote trace and allowlist contracts
Reconciles 68 upstream commits with the fork's 17 landed cursor/agy commits. 19 files conflicted; every conflict was resolved by keeping both sides' intent where compatible and by deferring to the newer owner where one side had moved a contract. Notable resolutions: - bin/fm-dispatch-select.sh and its test: accept upstream's removal of the vestigial selector; the fork had only annotated it. - tests/fm-captain-translation-contract.test.sh and the two source-asserting functions in tests/fm-pi-watch-extension.test.sh: accept upstream's removal of implementation-source assertions, which the coding guidelines now forbid. - bin/fm-launch-lib.sh stays the single owner of launch-command construction, and upstream's pi-signed and kimi templates plus their model/effort vocabularies are ported into it. fm-spawn keeps kimi's spawn-time binary resolution so the library's unresolved-placeholder guard still applies. - bin/fm-test-run.sh: the fork's live-harness-optin exclusion moves into list_portable_serial, upstream's single owner of serial membership, so the derived CI serial shards stay consistent and the coverage guard proves five disjoint partitions. - bin/fm-teardown.sh: upstream's exact-code error propagation replaces the fork's flattened variant, and the agy workspace-trust removal runs after the Herdr presentation preflight takes the lock guarding destructive steps.
Adds opt-in GitHub issue traceability. Reconciled against upstream's newer contract that a ship brief takes its delivery mode as an explicit --mode argument rather than reading the project registry: - fm-brief.sh keeps upstream's required, closed-set --mode and gains --issue. The branch's registry lookup is dropped; its issue/local-only guard now tests the explicit mode. - --issue argument-shape validation moved ahead of the --mode requirement so a malformed issue number reports itself instead of being masked. - The branch's three tests were ported to name a mode on every ship invocation. - tests/fixtures/fm-brief-no-issue.sha256 was regenerated against the merged tree's own pre-branch output, and the no-issue briefs were verified byte- identical before and after this branch, which is what that fixture exists to prove.
Both sides had hardened the same MISSING-tool fixture against host PATH leakage: the fork removes no-mistakes (never present in a system PATH), this branch adds hide_node. Both statements are kept, because the surrounding assertions require the no-mistakes MISSING line while the auto-merged run_session_start calls require the mask this branch produces.
Both sides had reached the same LC_ALL=C comm calls; the branch's fix also covers the serial-shard comparisons upstream added. Kept the fork's comment explaining why the collation must match.
The bootstrap-diagnostics trigger list took an addition from each side: the fork's widened CREW_DISPATCH (invalid or backend mismatch) and this branch's ENDPOINT_BINDING_MIGRATION. Both are real emitted lines, so both are listed.
Both sides added a window_harness helper to bin/fm-watch.sh, so the merge kept both and the later one silently shadowed the earlier. That changed what fm_busy_classify receives for a window with no metadata, from an empty string to the literal "unknown", with no conflict to review it. Upstream's definition is retained because its caller was written against the empty-string form. maybe_native_turnend matches only the exact cursor and agy tokens, so the crew-only native turn-end path behaves identically either way. Found by bin/fm-lint.sh (SC2329 on the shadowed definition).
While resolving bin/fm-teardown.sh in the upstream sync, I spliced the per-child cleanup branch using a context anchor that appears three times in the file. The edit landed on the first occurrence instead of the intended one and deleted everything between them, removing six upstream function definitions plus cleanup_firstmate_home_children: cleanup_firstmate_home_children, preflight_firstmate_home_herdr_children, teardown_herdr_preflight_target, teardown_herdr_require_prerequisites, teardown_herdr_session_lock_held, teardown_release_herdr_locks Surfaced by tests/fm-backend-autodetect-smoke.test.sh, where teardown died with "teardown_herdr_preflight_target: command not found". The file is rebuilt from a fresh three-way merge of the same inputs, with every conflict resolved as before but with anchors asserted unique first. The result is verified to define every function either side defines, with no duplicates and nothing extra; the single exception is registry_home_for_line, which upstream deleted outright and which has no remaining caller.
tests/fm-backend.test.sh: the legacy fake root that build_old_bin assembles did not carry fm-agy-trust-lib.sh, which the merged fm-teardown.sh sources for the cursor/agy workspace-trust cleanup, so the legacy teardown case died sourcing a file that was never copied. The fork made the same fixture completion in fm-gotmp.test.sh; this builder was missed because its dependency list grew on the upstream side. Both fake-root builders now carry the sibling. tests/fixtures/fm-brief-no-issue.sha256: regenerated against the final tree. These hashes were pinned when fm/fm-issue-lifecycle-wiring merged, and fm/fm-brief-status-protocol-gaps subsequently changed the crewmate scaffold's status protocol, which legitimately changes ship and scout brief bytes. Only those six entries moved; the two secondmate charters are unchanged, which matches a crewmate-scaffold-only change. The property this fixture exists to protect - that a no-issue brief is unaffected by the issue feature - was verified byte-for- byte when that branch merged and is still asserted by test_issue_traceability_is_strictly_opt_in.
The fork's cursor/agy test predates three upstream changes and could no longer reach the refusals it asserts: - Ship spawns now require explicit --mode and --yolo, and both checks run before the crew-only and herdr-only gates. The ship cases now name both; the --secondmate rows in the raw-bypass table deliberately pass neither, because a secondmate records its own fixed posture and refuses those flags. - fm/fm-endpoint-binding-migration refuses an endpoint record with no exact task binding, so the forced-child fixture now records endpoint_task_id. - That same fixture recorded its child on herdr, which now additionally has to clear teardown_herdr_preflight_target's structured pane inspection. The case is about cleanup_firstmate_home_children refusing when a child's firstmate-owned agy trust cannot be removed, which runs before any backend-specific work and is backend-independent, so the child is recorded on tmux instead. Faking herdr's pane protocol here would prove nothing about trust cleanup; real herdr endpoint behaviour stays covered by the real-herdr-gated lane. The gates themselves are unchanged; only the fixtures were conformed.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This was referenced Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings the fork up to date with
upstream/mainand lands the ten reviewed changes on top, preserving the fork's own cursor/agy harness work.origin/mainwas 17 commits ahead ofupstream/mainand 68 behind. The 17 ahead are the cursor and agy adapters landed through the fork's PR #1; they are intact here (d50dccais an ancestor of this branch).Structure
One merge of
upstream/mainintoorigin/main, then the ten branches merged in the required order:upstream/mainfm/fm-issue-lifecycle-wiringfm/fm-bearings-snapshot-arg-too-longfm/fm-session-start-e2e-failurefm/fm-pi-afk-dual-supervisionfm/fm-brief-status-protocol-gapsfm/firstmate-watcher-lock-flakefm/fm-watcher-term-hup-latencyfm/fm-test-run-comm-sort-exitfm/fm-pi-auth-surface-unresolvedfm/fm-endpoint-binding-migrationfm/firstmate-watcher-lock-flakelanded beforefm/fm-watcher-term-hup-latencyas required; the latter's cherry-pick of3db0341merged without duplicating the test.None of the five parked branches was merged, rebased onto, or cherry-picked from.
Test results
Baseline established on
upstream/mainbefore any merging, so pre-existing failures are distinguishable from introduced ones.upstream/main)Baseline failures on
upstream/main:tests/fm-calm-pi-extension.test.sh- pre-existing, trackedtests/fm-session-start.test.sh- fixed by branch 3 in this PRtests/fm-test-run.test.sh- fixed by branch 8 in this PRFailures on this branch: none. All three baseline failures pass here:
fm-session-start- fixed by branch 3, as expected.fm-test-run- fixed by branch 8, as expected.fm-calm-pi-extension- the one I expected to stay red. Branch 1 carries8a97167 Stabilize locale and Calm regression checks, which fixes it, so the fork's last tracked pre-existing failure is gone too.The count rises from 116 to 122 because the merged branches add six test scripts.
bin/fm-test-run.sh --check-coveragepasses:total=122 parallel=24 serial=76 serial_shards=4 herdr=11 optin=11.bin/fm-lint.shexits 0 (ShellCheck 0.11.0, the pinned version).Per-change survival check
For each branch I diffed
merge-base(upstream/main, branch)..branch, extracted every substantive added line, and checked it against the final tree. Eight branches came through byte-for-byte:fm-issue-lifecycle-wiringfm-bearings-snapshot-arg-too-longfm-session-start-e2e-failurefm-pi-afk-dual-supervisionfm-brief-status-protocol-gapsfirstmate-watcher-lock-flakefm-watcher-term-hup-latencyfm-test-run-comm-sort-exitfm-pi-auth-surface-unresolvedfm-endpoint-binding-migrationThe two branches with absences were adapted rather than reverted, and their functional deliverables are present:
fm-issue-lifecycle-wiringcollided with upstream's newer contract that a ship brief takes its delivery mode as an explicit--modeargument instead of reading the project registry. The branch was written against the registry lookup.read -r MODE _ <<< fm-project-mode.shblock is gone; upstream's explicit validated--modeis used instead.--issueitself is unchanged.--issueargument-shape validation was moved ahead of the--moderequirement, so a malformed issue number still reports itself rather than being masked by the missing-mode error.tests/fixtures/fm-brief-no-issue.sha256was regenerated. That fixture exists to prove no-issue briefs are byte-identical across the change, and the branch's recorded hashes were taken against pre-upstream brief text. I regenerated it from the merged tree's own pre-branch output and verified all eight fingerprints are identical before and after this branch, which is the guarantee the fixture encodes.issue=in the meta contract and infm-spawn.sh's writer,firstmate-task-issue=generation infm-brief.sh, and issue reconciliation infm-pr-merge.sh.fm-endpoint-binding-migration: the two absent lines are both thebootstrap-diagnosticstrigger list, which took an addition from each side. The merged line carries bothENDPOINT_BINDING_MIGRATION:and the fork's widenedCREW_DISPATCH:(invalid or backend mismatch).bin/fm-endpoint-binding-migrate.shand its bootstrap wiring are present.Conflicts resolved in AGENTS.md and .agents/skills/
Resolved on meaning, keeping both intents where compatible. Nothing here required a captain decision - no two sides made claims that actually contradict.
AGENTS.md (3 conflicts, upstream sync) + 2 more from branches
.nativeturnend-*(the cursor/agy turn-end debounce key, written byfm-watch.shand removed by teardown). Both files genuinely exist, so both entries are listed.pi-signedandkimiand narrowed the unverified-adapter sentence to the two static config files; the fork added the crew-only/herdr-only cursor and agy sentence and moved launch construction intobin/fm-launch-lib.sh. Kept upstream's list and sentence plus the fork's cursor/agy line. The ownership sentence dropsbin/fm-dispatch-select.sh(upstream deleted that script) and keepsbin/fm-launch-lib.sh.bootstrap-diagnosticstrigger list. Upstream addedSTARTUP_MEMORY_BUDGET:andSECONDMATE_HANDOFF:; the fork widenedCREW_DISPATCH:past "invalid" so its backend-mismatch line also loads the skill. Both kept. Branch 10 later addedENDPOINT_BINDING_MIGRATION:to the same line, also kept.endpoint_task_id=,traceparent=, the remote-secondmate fields) is the base; the branch'sand optional explicit issue=is threaded into it..agents/skills/harness-adapters/SKILL.md (4 conflicts)
bin/fm-launch-lib.sh; upstream's sentence names the autonomy flag and crewmate turn-end hook, which really do stay infm-spawn.sh. Kept the split and upstream's full list of what remains on thefm-spawnside.bin/fm-launch-lib.shactually renders:--modelfor both,--effort <low|medium|high>for agy, and no standalone effort axis for cursor (its effort rides the parameterized model string). Deliberately not done: no cursor or agy row was added to the model-support discovery table. No discovery surface has been verified for either CLI, and inventing one would assert a fact this fork has not established.kimisection and the fork appended acursor and agysection, both aftergrok. Both sections kept. The one shared line above them (grok's watcher protocol) took upstream's newer wording, since the fork had left the base text untouched..agents/skills/bootstrap-diagnostics/SKILL.md (2 conflicts)
CREW_DISPATCH: invalidhandling. This is the one place the two sides gave genuinely different instructions for the same diagnostic line: the base (which the fork carried unchanged) said to continue with the normal fallback chain, while upstream had since changed the remedy to stop profile-based dispatch and require correction. That is upstream revising its own policy, not a fork/upstream disagreement, so upstream's newer text wins. The fork's separateCREW_DISPATCH: backend mismatchbullet describes a different line and is kept alongside it.Other resolutions worth review
bin/fm-dispatch-select.sh,tests/fm-dispatch-select.test.sh- accepted upstream's deletion (fix(bin): remove vestigial dispatch selector kunchenguid/firstmate#1026 removed the vestigial selector). The fork had only annotated the file. Nothing upstream references it.tests/fm-captain-translation-contract.test.shand two functions intests/fm-pi-watch-extension.test.sh- accepted upstream's deletion (test: replace source assertions with behavioral coverage kunchenguid/firstmate#1282 replaced implementation-source assertions with behavioural coverage; the coding guidelines now forbid asserting source bytes). The fork had only adapted them to the launch-lib split, so the adaptation is moot.bin/fm-launch-lib.shremains the single owner of launch-command construction; upstream'spi-signedandkimitemplates and their model/effort vocabularies were ported into it. Kimi's binary resolution stays infm-spawn.shbecause it is spawn-time state, which also keeps the library's unresolved-placeholder guard meaningful.bin/fm-test-run.sh- the fork'slive-harness-optinexclusion moved intolist_portable_serial, which upstream had made the single owner of serial membership. The derived CI serial shards therefore stay consistent automatically, and the coverage guard proves five disjoint partitions.--check-coveragepasses.bin/fm-teardown.sh- upstream's|| return $?/|| exit $?replaces the fork's flattened|| return 1, because the flattened form would lose the treehouse lock-refused code. The agy workspace-trust removal now runs after upstream's Herdr presentation preflight has taken the lock guarding destructive steps.tests/fm-session-start.test.sh- both sides had hardened the same fixture against host PATH leakage, in complementary ways. Both statements kept: the surrounding assertions need theno-mistakesMISSING line the fork forces, and the auto-merged calls need the mask branch 3 produces.Defects the merge produced, and how they were caught
A clean
git mergeproved very little here. Five problems survived it, none flagged by a conflict marker. Recording them because they are the substance of this review.1. Duplicate
window_harness()inbin/fm-watch.sh(code defect). Both sides added a helper of that name, in a region git auto-merged silently. The later definition shadowed the earlier and changed whatfm_busy_classifyreceives for a window with no metadata, from an empty string to the literalunknown. Caught bybin/fm-lint.sh(SC2329). Fixed in20b879fby keeping upstream's definition, which its own caller was written against;maybe_native_turnendmatches only the exactcursor/agytokens and is unaffected. I then swept every merged shell file for other duplicated definitions and found none.2. Eight function definitions deleted from
bin/fm-teardown.sh(my error). Resolving that file, I spliced the per-child cleanup branch using a context anchor that occurs three times. The edit landed on the wrong occurrence and deleted everything between them, removingcleanup_firstmate_home_children,teardown_herdr_preflight_target,preflight_firstmate_home_herdr_children,teardown_herdr_require_prerequisites,teardown_herdr_session_lock_held, andteardown_release_herdr_locks. The file was still valid shell, sobash -nand lint both passed; it surfaced only whenfm-backend-autodetect-smokeran teardown for real. Fixed ine4a3787by rebuilding the file from a fresh three-way merge of the same inputs, resolving each conflict identically but asserting every anchor unique first. The result is verified to define every function either side defines, with no duplicates and nothing extra; the sole exception isregistry_home_for_line, which upstream deleted outright and which has no remaining caller. After this I ran the same function- and heading-inventory comparison over every file I resolved by region splice; everything else was sound.3.
tests/fm-backend.test.shlegacy fake root missing a sibling.build_old_binassembles abin/from a fixed list that did not includefm-agy-trust-lib.sh, which the mergedfm-teardown.shsources. The fork made this same fixture completion infm-gotmp.test.sh; this builder was missed because its dependency list grew on the upstream side. Those two are the only fake-root teardown fixtures in the suite, and both now carry it.4.
tests/fixtures/fm-brief-no-issue.sha256stale. Regenerated when branch 1 merged, then invalidated by branch 5 changing the crewmate scaffold's status protocol. Regenerated against the final tree. The signature is right: only the six ship and scout entries moved, while both secondmate charters stayed byte-identical, which is what a crewmate-scaffold-only change should look like.5.
tests/fm-cursor-agy-adapter.test.shcould not reach its own assertions. The fork's test predates three upstream changes: ship spawns now require explicit--modeand--yolo, both checked before the crew-only and herdr-only gates; endpoint records now need an exact task binding; and a herdr child must additionally clearteardown_herdr_preflight_target's structured pane inspection. The ship cases now name both flags, the--secondmaterows in the raw-bypass table deliberately pass neither, and the forced-child fixture recordsendpoint_task_idand sits on tmux. That last one is worth a reviewer's eye: the case is aboutcleanup_firstmate_home_childrenrefusing when a child's firstmate-owned agy trust cannot be removed, which runs before any backend-specific work and is backend-independent. Faking herdr's pane protocol in a unit fixture would prove nothing about trust cleanup, and real herdr endpoint behaviour stays covered by the real-herdr-gated lane. The gates themselves are unchanged; only fixtures were conformed.Items 1 and 2 are real code defects. Items 3 to 5 are fixtures that the merge invalidated; in each case I changed the fixture, never the behaviour under test.
Not resolved
Nothing was left unresolved, and no conflict required a captain decision.