Repository navigation
fix: merge upstream firstmate main into fork (16 commits, through #4775) - #26
Merged
Merged
Conversation
…kunchenguid#4680) * fix(bin): clear parent pending-replies on local secondmate retirement Local secondmate teardown left resolved parent pending-reply records behind after home removal (seen after papa-hdds / pxmx retirement). Refuse non-forced retirement while any reply for that id is still unresolved, and delete every matching record plus its delivery confirmation after a successful local or remote retirement, matching the remote cleanup path. * no-mistakes(document): Align secondmate retirement docs with pending-reply cleanup * no-mistakes(review): Lokale Pending-replies-Sicherheitsprüfung vor Home-Entfernung * no-mistakes(review): Pending-replies-corr_id auf 16-Hex absichern * no-mistakes(review): Pending-replies Basename und corr_id abgleichen * no-mistakes(document): Clarify forced retirement pending-reply cleanup --------- Co-authored-by: ladwein <ladwein@firstmate.bost8.thelad.loc>
kunchenguid#4677) * fix(bin): accept Orca's composite worktree id at teardown Teardown refused every Orca-backed task because the endpoint validator checked orca_worktree_id with the simple-atom rule meant for tmux-style window names, which rejects any character outside [A-Za-z0-9._@%+-]. Orca returns that id as `<orca id>::<absolute worktree path>`, so the colon and slashes in every real value made validation fail and finished Orca tasks could never be cleaned up. Validate the field as the composite it is: both halves of the first `::` split present, the path half absolute, and no embedded newline, carriage return, or tab. The terminal field keeps the atom check, which is correct for it, and no other backend's validation changes. The existing Orca fixtures recorded ids like `wt-teardown`, a shape Orca never returns, which is why the suite passed a check the real value fails. They now carry the composite form, so the tests exercise the real value. * no-mistakes(document): name Orca's repo id in the composite worktree id * no-mistakes(document): list teardown endpoint safety suite in Orca regression entry points
* feat(bin): add opt-in typed dispatch resolution through typesafe.ai Add bin/fm-dispatch-resolve.sh, which resolves one concrete crewmate or scout profile from a written brief with typesafe.ai's System One model: one Choice question over the rules' `when` texts, then the confidence floor, the rule's `approval` and `floor`, each profile's `provider` and `floor`, one quota-axi snapshot, and the spendPriority argmax all in code. It is off unless TYPESAFE_API_KEY is in the environment or the home's gitignored .env; off means one stderr line, exit 0, and no network call, so firstmate dispatches exactly as before. The key reaches curl on a file descriptor, never argv. Extract fmx_env_get into bin/fm-env-lib.sh as the one .env accessor and the harness-to-provider table into bin/fm-quota-axi-lib.sh so the new tool and bin/fm-quota-choose.sh share one owner each. Bootstrap validates the four new optional dispatch fields. Document the schema, the operator contract, the AGENTS.md intake step, and the live and benchmark evidence. * no-mistakes(review): Harden typed dispatch resolution and quota bounds * no-mistakes(review): Validate dispatch floors and ranking evidence * no-mistakes(review): Tighten dispatch response and floor evidence * no-mistakes(review): Neutralize none matching and resolve defaults locally * no-mistakes(review): Preserve providerless profiles outside typed resolution * no-mistakes(review): Validate response usage and reject duplicate profiles * no-mistakes(review): Escalate unverifiable floors and validate probabilities * no-mistakes(review): Validate probability mass and unknown profile floors * no-mistakes(review): Simplify resolver interface and preserve fallback routing * no-mistakes(review): Fix constants and rank partial quota evidence * no-mistakes(review): Add authoritative provider mapping and enforce explicit providers * no-mistakes(review): Declare provider for documented Pi profile * no-mistakes(review): Validate provider identifiers and support Gemini dispatch * no-mistakes(review): Strictly anchor provider identifiers * no-mistakes(review): Validate selectors and preserve fallback candidate evidence * no-mistakes(review): Gate typed validation and harden resolver evidence * no-mistakes(review): Preserve opt-in routing and harden candidate evidence * no-mistakes(review): Prioritize known exhaustion over quota uncertainty * no-mistakes(review): Isolate API secrets and preserve no-key diagnostics * no-mistakes(review): Fallback safely when dispatch rules are absent * no-mistakes(review): Prioritize quota vetoes and isolate bootstrap secrets * no-mistakes(document): Document typed dispatch safety and fallback behavior
…n decisions aren't lost (kunchenguid#3753) * test: reproduce buried status declarations in shared readers * fix: share status event reads and preserve open blockers * fix: retain terminal scout and ship status declarations * no-mistakes(review): Fix status chronology, legacy completions, and reader performance * no-mistakes(review): Share terminal decision reconciliation across fleet snapshots * no-mistakes(review): Unify terminal supersession across cached folds and consumers * no-mistakes(review): Filter per-key status history while preserving terminal chronology * no-mistakes(test): Preserve parent lock ownership in Bash 3.2 subshells * no-mistakes(review): Anchor legacy status tokens so prose cannot hide pauses * no-mistakes(document): Document latest-event status read and kind-scoped fold cursor * no-mistakes(lint): Quote literal done in test for-lists for SC1010 * ci: expect 19 snapshot/fleet-view tests This branch adds a fleet-snapshot regression, so the stock macOS Bash lane's hardcoded guard of 18 'ok - ' lines fails on the new count. Bump the guard and its message to 19. * no-mistakes(review): Restore multiline child outcome reporting * no-mistakes(review): Select ledger terminal events through bounded shared reader * no-mistakes(review): Report newest open decision instead of preferring blocked * no-mistakes(review): Require colon before ship/scout terminal supersession in fold * no-mistakes(review): Gate socket-down override on latest event; drop lock matrix * no-mistakes(review): Fold only colon-bearing or keyed lines as decision transitions * no-mistakes(review): Pre-select candidate lines before per-key closing-verb fold * no-mistakes(test): Update fleet-view expectations to newest-open-decision rule * no-mistakes(document): Align status-read docs with fold-resolved crew state * no-mistakes(document): Correct status-reader contracts in classify-lib and crew-state headers * no-mistakes(ci): Greptile P1 (bin/fm-crew-state.sh:729, "Stale socket blocker survives") was a real defect introduced by commit b7c2183 on this branch, and is fixed. Root cause: the daemon-socket-down override took its verb check from `last_status_line "$LOG"` but its evidence and emitted detail from `$LOG_LINE` (status_current_line = the fold's newest still-open decision). Those are different lines whenever a later recognized `blocked:` event is one the decision fold declines. Reproduced by sourcing bin/fm-classify-lib.sh on `blocked: no-mistakes daemon socket is missing` followed by `blocked [key=pending-reply-t3]: still waiting on the answer` (reserved-namespace key whose note does not speak that vocabulary, so _fm_decision_key_transition_allowed rejects it): open set still holds the socket blocker, last_status_line returns the newer line, its verb is blocked, so the gate passed and the stale daemon-down evidence overrode a healthy attributed run. Fix (bin/fm-crew-state.sh): capture LOG_LATEST=$(last_status_line "$LOG") once and read verb, socket-down evidence, and the emitted note all off that same line, so the override fires only while the socket-down declaration is itself the log's latest recognized event — preserving the narrow override the prior round's user instruction asked for. Comment updated to state that contract. No new machinery; the two-line conflation was removed rather than papered over. Regression: extended tests/fm-crew-state.test.sh:test_socket_refusal_override_expires_when_the_crew_moves_on with the reproduced sequence, asserting the run-step reading (state: working, source: run-step) and absence of the override detail. It fails before the fix ("not ok - a later unfolded blocked event also hands the reading back to the run (missing: 'state: working')") and passes after. Verified locally: tests/fm-crew-state.test.sh, tests/fm-fleet-snapshot-view.test.sh, tests/fm-classify-decision-key.test.sh, tests/fm-watch-triage.test.sh, tests/fm-captain-hold-lifecycle.test.sh all pass; bin/fm-lint.sh (shellcheck 0.11.0 + actionlint) exits 0. Changes left uncommitted in the worktree * test: fold terminal-cleanup snapshot coverage into the completed-scout case Keep the ship/scout/secondmate supersession assertions without adding a nineteenth top-level fleet-view test, so CI can stay at the upstream suite count. * no-mistakes(document): Clarify socket-down override expiry in architecture doc * ci: retrigger flaky contribution check
…nchenguid#4689) * fix(spawn): launch codex crewmates with codex's hook layer disabled A freshly launched Codex worker never reached its instructions. Codex stopped it on an interactive "Hooks need review" modal whose selection sits on "Review hooks", which is neither trusting nor declining. Firstmate's key plane carries only Enter, Escape and Ctrl-C with no arrow navigation, so the selection cannot be moved, and pre-accepting the prompt by writing Codex's own trust store would record an operator consent that was never given. The hooks are the machine's own ~/.codex/hooks.json plus any project's .codex/hooks.json. A crewmate needs neither: its turn-end signal is the -c notify= program on the same launch, and Firstmate's project hooks are primary-session infrastructure that stands down in a child worktree. Crewmate and scout launches now pass --disable hooks. That is the opposite of --dangerously-bypass-hook-trust, which RUNS the untrusted hooks; disabling the feature runs none of them and leaves the operator's ~/.codex untouched. An unknown feature name is a hard Codex error, so a release that drops the flag fails the launch loudly instead of silently restoring the modal. A secondmate is a primary in its own home and keeps the project hooks its turn-end guard and session-start digest ride on. Verified on codex-cli 0.151.0: the modal is gone and the turn-end notification still lands. This unblocks the second review that every finished pull request is supposed to get. Fixes kunchenguid#4673 * no-mistakes(review): Fix contradictory hook count in Codex verification record
…d#4669, Fixes kunchenguid#4670) (kunchenguid#4710) * fix(bin): settle terminal contributions and wake once per read-failure episode A contribution whose last good observation is merged or closed is final: poll no longer re-reads it, projection keeps it fresh, and a stale error recorded beside it is cleared once. A genuine forge-read failure on an open contribution still records its error on every cycle but prints the unavailable wake only when it starts a failure episode; a successful read ends the episode. Open PRs linked from done tasks keep being observed. The false unavailable beside a complete observation was budget exhaustion mid-observation, already fixed by kunchenguid#4661. * fix(review): Settle terminal contribution owners * fix(review): Deduplicate shared contribution failure episodes * fix(test): Preserve settled terminal contribution records
* fix(crew-state): select authoritative validation runs by identity Use the AXI run overview and id-addressed status reads to preserve replacement review gates, report competing live runs as unknown, and retain newer failures. Keep the coarse ledger in creation order rather than preferring an older live row. Refs: kunchenguid#3215 * fix(review): Resolve same-branch run identities beyond capped history * fix(review): Fix run-selection compatibility, races, and worker-state fallbacks * fix(review): Limit run validation to the requested branch * fix(test): Anchor AXI fixtures and document remaining live evidence gaps * fix(document): Clarify run selection documentation and capture ownership * fix(lint): Fix ShellCheck diagnostics while preserving fixture isolation
* fix(AGENTS): send a captain-facing outcome instead of shipshape for finished requested work MAIN answered a supervision-branch outcome for completed captain-requested work (implementation done, PR ready for review and merge approval) with "Captain, shipshape.", reading section 9's no-action reply as covering it and reading the Pi protocol's "do not re-emit the anchor verbatim" as "no captain-facing response is owed". Section 9 now limits the shipshape reply to true no-ops (idle re-read, empty heartbeat, consequence-free acknowledgement) and requires a short outcome response naming what finished and what word is needed whenever requested work finishes or a result needs the captain's word, even when a transcript entry already shows the substance. The Pi protocol's re-emit rule now says it bounds repetition only, and carries a worked example of the ready-for-review outcome whose correct processing turn a shipshape reply fails. No executable contract evaluates the content of MAIN's captain-facing reply, so the regression is the protocol example in the owner doc rather than a text-match test. * no-mistakes(document): Clarify captain-facing outcomes versus no-ops * docs(pi): restore the ready-for-review regression example as a preserved-verbatim contract line The document step condensed the Pi protocol's re-emit rule and dropped the worked example of a finished, ready-for-review outcome whose correct processing turn a "Captain, shipshape." reply fails. That example is the contract's regression: no executable contract evaluates the content of MAIN's captain-facing reply, so the owner doc's example is the test case. Restore it directly under the re-emit rule, prefixed as a regression example that is kept verbatim and never condensed or summarized away. * no-mistakes(review): Clarify captain outcome and decision-word requirements * no-mistakes(document): Clarify captain-facing completion outcomes * docs(pi): require the PR URL in the visible captain-facing outcome reply Captain review on the regression example: drop the sample reply string and say only that the ready-for-review outcome requires relaying a captain-facing outcome response, not just "Captain, shipshape.". Fold in the visible-PR-handoff failure seen this session: after the branch outcome reporting this fix green, MAIN's visible reply was only "Awaiting your merge call." with no PR URL, leaning on the dim anchor. Section 9's URL rule now also covers a review or merge ask and names the visible reply as where the URL goes, sourced from the ready status, pr= metadata, or the supervision branch's summary and never left to a transcript entry. The Pi protocol adds the same-way failure and places the captain-facing text in the final visible assistant reply after the fm_branch_processed call, because Calm hides assistant text emitted in the same step as a tool call as a working note. Investigation verdict, evidence in the PR comment: no recent PR caused the handoff failure; Pi has hidden same-step pre-tool assistant text since kunchenguid#2339 (2026-08-13), kunchenguid#4655 changed only the Claude Code mod, and kunchenguid#4658 touched only remote report transfer. * no-mistakes(review): Restore safe outcome ordering and consolidate PR URLs * no-mistakes(document): Clarify captain-facing supervision outcomes * docs(AGENTS): keep the whenever-a-PR-is-mentioned trigger on the consolidated URL rule The consolidated section 9 URL rule narrowed its trigger to a review or merge ask, dropping the "whenever a PR is mentioned" catch-all from kunchenguid#3648 that keeps every PR URL copied from a durable record and never assembled from memory. Restore that trigger as a union with the review or merge ask so the one consolidated rule covers both.
* Fix foreign-owner turn-end supervision loop * no-mistakes(review): Scope foreign-owner safe exit to Claude guard * no-mistakes(document): Document Claude foreign-owner safe exit
…orb (kunchenguid#4778) Under set -u, stock macOS bash 3.2.57 treats "${arr[@]}" on an empty indexed array as an unbound variable and aborts the shell. In signal_turnend_panes_churned() the missing_keys loop was reachable with an empty array whenever every churned key already held a fresh .churn-since-* marker (a second churning turn-end inside an open deferral window), so each watcher cycle died about half a minute in and supervision restarted endlessly. The created_keys rollback loops had the same latent crash on their error paths. Audit of bin/ for the same pattern found one more confirmed-reachable case: remote_handoff's noncanonical-body scan iterates to_move, which is empty when a retried remote handoff finds every key already staged in the outbox. All other "${arr[@]}" sites are either count-guarded, guaranteed non-empty by construction, or unreachable while empty. Guard the three reachable expansions with the repo's existing "${arr[@]+...}" idiom. New regression test drives a real watcher through the all-marked churn path; the macos-stock-bash CI lane runs it under real /bin/bash 3.2 via FM_TEST_ONLY.
… lock. (kunchenguid#4783) The synthetic harness was named synthetic-claude, which Linux procps truncates to synthetic-claud so fm-lock.sh never matched a harness or wrote state/.lock before the test read it. Co-authored-by: Cursor <cursoragent@cursor.com>
* docs: require complete final responses across harnesses * no-mistakes(document): Document complete final replies for Grok Bot * docs: point Grok replies to the shared contract owner * no-mistakes(review): Clarify final recap without batching decision asks
* fix(calm): preserve substantive Pi mid-turn text * no-mistakes(review): Preserve substantive Pi Calm text per block * no-mistakes(test): Cover shared Calm preservation boundaries behaviorally * no-mistakes(document): Consolidate Calm preservation documentation
…guid#4799) * Handle Kimi workspace trust dialog * no-mistakes(review): Retry Kimi trust Enter and gate ready on dialog markers * no-mistakes(review): Gate Kimi ready on any trust marker and clean captures * no-mistakes(review): Read visible pane for Kimi trust and ready gates * no-mistakes(review): Add per-backend visible-pane capture for Kimi trust gate * no-mistakes(review): Harden Kimi viewport capture and trust dialog detection * no-mistakes(document): Document Kimi spawn refusal on cmux and Orca
…er (kunchenguid#4775) * fix(bin): report a record whose agent is gone once instead of escalating forever The wedge escalation path never asked whether there was still an agent to be wedged. A wedge is something stuck that might recover, so re-alarming it earns its cost; an agent that is gone never moves again, its pane never churns, the idle timer never resets, and the escalate path clears its own timer and re-arms with nothing bounding the count. Observed on a live fleet: two finished lanes reached 226 and 203 consecutive escalations, roughly one every FM_STALE_ESCALATE_SECS, indefinitely - about 400 notifications a day from two lanes with no agent running at all. On one, fm-control.sh exit answered already-stopped and fm-crew-state.sh read "failed - run failed". Closing the Herdr pane did not stop it either: with the pane genuinely gone and herdr pane read returning pane_not_found, the count kept climbing, because the poll is driven by the record's window= line rather than by the pane. The cost is not the repetition but that it drowns the alarms that matter. fm_backend_agent_state already separates a thinking agent from a gone one at process level. In the branch that was about to escalate, read it once and treat only its two recovery-grade verdicts - dead (endpoint present, no agent in it) and missing (endpoint authoritatively absent) - as proof, reporting that record once and not re-escalating it while it stays that way. Every other verdict, including alive, ambiguous, unreadable, unverified, and a read that failed outright, keeps the identical schedule, reason, and escalation count, so a genuinely wedged live agent is unaffected. The probe costs at most one backend read per window per threshold, the same budget the declared-wait consult and the worktree write probe already take. The report decides nothing about the record's fate: both lanes still held unlanded work and teardown refusing them was correct, so retiring, relaunching, or cleaning up stays with the supervisor. The once-only marker is owned entirely by that function and is dropped by the same read the moment the endpoint stops reading gone, so a replacement launched into the same window escalates normally and its own later death is reported again. Related, and not closed by this: kunchenguid#4412, kunchenguid#4482, kunchenguid#4316. Tests drive the real watcher against a record whose endpoint does not exist and pin both directions: dead and missing report once and never advance the count across later thresholds, while alive, ambiguous, and unreadable endpoints keep escalating with the identical reason and a climbing count. * fix(bin): bind the once-only dead report to the pane it reported Review of the parent commit found a reachable sequence where a later death in the same window lost its promised report. The marker was keyed on the verdict string alone and dropped only when a threshold probe read a non-gone verdict, but probes run only at thresholds: a replacement launched into the same window that dies without ever being probed alive - it crashes at startup, or works and then crashes - was absorbed by the previous death's marker. The pane's first sight yielded only the generic stale wake and every later threshold matched the stale marker, so the second death never got the detailed once-report that both the function's own comment and docs/architecture.md promise. Record the verdict together with the pane hash it was reported for, and absorb a repeat only while both still match. A replacement churns the pane, which resets the stale suppressor, wedge timer, and escalation count while no reset site touches this marker, so the pane half is what tells the second death apart from the first. The live-probe drop stays as it was. Clearing the marker at those reset sites instead would re-open unbounded re-alarming for a dead pane whose display ever ticks, which is the exact defect the parent commit exists to close. The noise bound is unchanged: an unchanged dead pane still absorbs on every later threshold and never advances the escalation count, and every verdict short of proof still escalates exactly as before. * no-mistakes(review): Key the dead-record once-marker on the busy incarnation token * no-mistakes(document): Document dead-record escalation cap in stale-pane config entry * no-mistakes(document): Add busy-state inventory line to AGENTS.md * no-mistakes(document): Document dead-record probe on busy-turn-bound wedge path
# Conflicts: # bin/fm-crew-state.sh # bin/fm-dispatch-resolve.sh # bin/fm-spawn.sh # bin/fm-test-run.sh # docs/configuration.md # docs/fm-test-portable-shards.md # docs/verification/dispatch-resolve.md # tests/fm-dispatch-resolve.test.sh
…e omp candidate returned: ...") fixed at root cause: fm_control_harness_supported in bin/fm-control-lib.sh returned early from a read loop over a process substitution, so the writer intermittently emitted "printf: write error: Broken pipe" on stderr, which the test captures with 2>&1 and compares exactly. Now iterates over a command substitution; test passes repeatedly with no Broken pipe, shellcheck clean. Shard 4 failure (tests/fm-procevent.test.sh, "the superseded paced runner invoked its stale command") is a pre-existing upstream timing flake in files this PR does not touch; could not reproduce in 25 local runs including under heavy CPU load, mechanism not identified, no speculative change made — needs CI rerun
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.
Merge this PR with a merge commit (Create a merge commit); never squash or rebase, because the branch carries a true two-parent merge of
upstream/mainthat must stay a merge so future upstream syncs see the shared history.The no-mistakes run that validated this branch was started with
--skip rebasefor the same reason: the pipeline's rebase step would otherwise be the one place the merge commit could be flattened, and the branch already containsorigin/main(acd7047, #25) through a plain merge.What upstream brought in
upstream/mainat 9bc051f, 16 commits since the merge-base 9f8ad95:The last four were already carried by fork commit ab912c7 (#19) as one squashed commit, which is why git could not see them as applied and reported conflicts in the files they touch.
Conflict resolution
Rule applied to every hunk: upstream's version wins verbatim for code the fork had only squashed in from upstream, and the fork's genuine additions are re-applied on top. Each surviving file was read whole afterwards and diffed against
upstream/mainto confirm the residual diff is fork material only.bin/fm-dispatch-resolve.sh(add/add): the fork's copy at ab912c7 was byte-identical to upstream 69d660a, so the only fork delta is the outcome log from feat(bin): log one JSON outcome line per dispatch-resolve call #24. Kept the fork file: upstream content plus the feat(bin): log one JSON outcome line per dispatch-resolve call #24 log.docs/verification/dispatch-resolve.md(add/add): same situation; kept the fork file, whose one extra line is the feat(bin): log one JSON outcome line per dispatch-resolve call #24 log evidence.tests/fm-dispatch-resolve.test.sh(add/add): same situation; kept the fork file, whose extra tests cover the feat(bin): log one JSON outcome line per dispatch-resolve call #24 log.bin/fm-crew-state.sh: the conflicting header comment was 334fa12's wording (squashed in feat(bin): merge upstream typed dispatch resolution and status-event fixes #19) against upstream f5d7f5f's later rewording of the same paragraph. Took upstream's paragraph. The fork's fix(bin): stop herdr server inheriting fm-crew-state snapshot overrides #17 basename guard onFM_CREW_STATE_*_OVERRIDEsurvives untouched and is the only remaining diff against upstream.bin/fm-spawn.sh: the wholelaunch_templatecase body conflicted because a fork no-mistakes pass had re-indented it by two spaces, so every line differed. Rebuilt from upstream's body (which adds--disable hooksto the codex crewmate launch, fa93097) and re-applied the three fork additions on top: the Claude--settingsJSON withautoCompactWindow(feat(fm-spawn): set autoCompactWindow 220000 for every Claude worker launch #20) and the startup-context trim (feat(bin): trim the startup context of Claude and Pi workers #13) plus its explanatory comment, and the Pi crewmate--exclude-toolsflag with its comment. Upstream's indentation is kept so the residual diff is substantive only.bin/fm-test-run.sh: two hunks insideportable_serial_weight_hints. Took upstream 4055cbd's refreshed hints verbatim for every script upstream has, then re-added the seven fork-only scripts in sorted position with the hints the fork gave them:tests/fm-branch-claude-mod-live-e2e.test.sh,tests/fm-branch-claude-mod-plugin.test.sh,tests/fm-branch-claude-mod.test.sh,tests/fm-branch-mod-bin.test.sh,tests/fm-precompact-skills.test.sh,tests/fm-promote.test.sh,tests/fm-trace-span-lib.test.sh. Upstream dropped thetests/fm-herdr-attached-viewer-live-e2e.test.shhint in its refresh; that is upstream's call and is kept. The fork's family-map additions for the mod andbin/fm-promote.shauto-merged cleanly.bin/fm-test-run.sh --check-coveragepasses withserial_unhinted=0.docs/fm-test-portable-shards.md: took upstream's refresh paragraph (the 2026-09-17 CI runs covering all 176 upstream serial scripts) and replaced the fork's "sixteen further hints" sentence with one naming only the seven fork-only scripts that still carry doubled local measurements, since upstream now has real measurements for the other nine.docs/configuration.md: the typed-dispatch-resolution section was identical to upstream apart from the two fork lines describing the feat(bin): log one JSON outcome line per dispatch-resolve call #24 outcome log; kept the fork hunk.Fork-only material verified intact after the merge: the Claude Code supervision-branch mod (
.claude/mods/fm-branch-mod, its docs, tests, and bin/ pieces), the dispatch-resolve outcome log (#24), the Claude workerautoCompactWindowlaunch setting (#20), thestate/.compact-skillsinventory line (#21), and the OTLP tracing work (#1 to #6).Regression evidence
The full serial suite ran on the upstream merge commit 51a1782; the later plain merge of
origin/main(fb2bec9, bringing in #25, a docs-only mod pin bump) was followed by the quick checks below on fb2bec9.--jobswas not used for--allbecause the runner refuses it (tests/fm-afk-contract.test.sh is not in the proven-isolated set).Lint and documentation checks (
CI=true bin/fm-lint.sh,bin/fm-doc-audience-check.sh), both rc=0:Coverage and the supervision-branch mod on fb2bec9 (
bin/fm-test-run.sh --check-coverage,claude plugin validate --strict .claude/mods/fm-branch-modon Claude Code 2.1.276,bin/fm-test-run.sh tests/fm-branch-claude-mod-plugin.test.sh):Full suite (
bin/fm-test-run.sh --all, serial, 116 minutes):All six failures are left in place because none is introduced by this merge: each one reproduces identically on a clean
git archivecopy of the pre-merge fork main (459972d) and ofupstream/main(9bc051f) on this host, so they are upstream's own or this host's environment.tests/fm-backend-zellij-smoke.test.sh-not ok - create_task failed("could not find a terminal pane for zellij tab 1") with zellij 0.45.1. Reproduces on both clean copies; the zellij backend is unchanged by this merge.tests/fm-composer-codex-idle-live-e2e.test.sh-not ok - codex (codex-cli 0.154.0): idle screen never classified empty (tmux read: unknown, cursorless styled read: unknown). Reproduces on both clean copies; the composer libraries are unchanged by this merge.tests/fm-gemini-harness.test.sh-not ok - GEMINI_CLI must identify a node-bundle gemini worker, got 'claude'. Reproduces on both clean copies, including withCLAUDECODEunset: the suite was run from inside a Claude Code worker, whose process ancestry the guard picks up.tests/fm-secondmate-liveness.test.sh-not ok - Herdr pane state unknown should map to unreadable, got 'missing'. Reproduces on both clean copies. Root cause is upstream 3e817d3 (fix(herdr): recover gone and drifted worker endpoints kunchenguid/firstmate#4120):fm_backend_herdr_agent_statenow maps an unknown pane state tomissingwhen the Herdr server is stopped, which is the case on this host with herdr 0.9.0 installed and not running, while the test still expectsunreadable. Not touched here because it is upstream's own behaviour and test.tests/fm-session-start.test.sh-not ok - a digest child that died mid-stage must still let the session open (parent exits 0): expected exit 0, got 143. Environmental: this worker inheritedFM_SESSION_START_STAGE_FILEfrom its spawning firstmate, and that variable is the flagbin/fm-session-start.shuses to tell a timed child from the parent, so every digest under test ran unbounded and the death-banner case terminated the wrong ancestor. On the cleanupstream/maincopy with the same inherited environment the script fails in the neighbouring runtime-bound case instead (not ok - a truncated session start did not say so, after 41 minutes of hung fakegit). On the merged head withFM_SESSION_START_STAGE_FILE,FM_CREW_STATE_META_OVERRIDE, andFM_CREW_STATE_STATUS_OVERRIDEunset it passes:FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=237088.tests/fm-sessionstart-nudge.test.sh-not ok - the compact run wrapper did not forward its source to instruction refresh (missing: 'RUN_TIER_AGENTS=updated'). Same inherited-environment cause; reproduces on both clean copies and passes on the merged head with the same three variables unset.CI on the opened PR
The first CI run on fb2bec9 passed 17 checks and failed two, both in code this merge does not change and both green in the local runs above:
Behavior portable serial 3-tests/fm-quota-choose.test.sh"bare omp candidate returned: ..." becausefm_control_harness_supportedinbin/fm-control-lib.shreturned early from areadloop over a process substitution, so the writer intermittently printedprintf: write error: Broken pipeon stderr, which the test captures with2>&1and compares exactly. The pipeline's CI repair round fixed this at the root in 8bedf23 (an ordinary follow-up commit on top of the merge; fb2bec9 is unchanged and remains its parent) by iterating over a command substitution instead. The function is byte-identical onupstream/main, so the same flake exists there.Behavior portable serial 4-tests/fm-procevent.test.sh"the superseded paced runner invoked its stale command", a timing race in the registration-pacing case (FM_PROCEVENT_LAUNCH_FLOOR_SECONDS=3) in files this PR does not touch. It could not be reproduced in 25 local runs, including under CPU load, so no speculative change was made; it passed on the CI re-run.All 19 checks passed on the re-run at 8bedf23.
Intent
Pull latest upstream firstmate changes, rebase ours over the top. Only run full regression if there was merge conflict (resolvable by git or otherwise).
Proceed as you recommended, exception use Opus/xhigh.
Context for reading that ask. The fork is github.com/andrewesweet/firstmate, upstream is github.com/kunchenguid/firstmate (remote
upstream). At intake main is 459972d, 34 commits ahead of upstream/main (9bc051f, 2026-09-18) and 16 behind; merge-base 9f8ad95. The firstmate recommendation the captain accepted was: bring upstream in through a pull request that merges upstream/main into main with a true merge commit, not a rebase, because a rebase would rewrite main and break the fork's standing posture (PRs merge under yolo, running homes fast-forward), and because a dry-run rebase already conflicted at the first supervision-branch mod commit. Conflicts exist, so the captain's rule makes the full regression mandatory for this task. A dry-rungit merge upstream/mainon main conflicted in eight files: bin/fm-crew-state.sh, bin/fm-dispatch-resolve.sh, bin/fm-spawn.sh, bin/fm-test-run.sh, docs/configuration.md, docs/fm-test-portable-shards.md, docs/verification/dispatch-resolve.md, tests/fm-dispatch-resolve.test.sh. The root cause of most of them is fork commit ab912c7 (PR 19), which squashed four upstream commits (69d660a typed dispatch resolution, 334fa12 latest status event read, 795e5e4 Orca worktree id, b0877b4 pending-reply clearing) into one fork commit, so git cannot see they are already applied; the fm-test-run.sh and shards-doc conflicts come from upstream 4055cbd (kunchenguid#4800) rebalancing the same serial-shard hints the fork's mod commits edited. Fork-only material that must survive intact: the Claude Code supervision-branch mod (.claude/mods/fm-branch-mod and its docs, tests, and bin/ pieces), the dispatch-resolve outcome log (fork PR 24), the Claude worker autoCompactWindow launch setting (PR 20), the state/.compact-skills inventory line (PR 21), and the OTLP tracing work (PRs 1 to 6). A separate one-line pin bump, fork PR 25 (CLAUDE_CODE_PIN 2.1.274 to 2.1.276 in the mod plus its two doc pages), is in flight on the same repository and may land on main during this task.What Changed
upstream/main(kunchenguid/firstmate, 16 commits from b0877b4 through 9bc051f) into the fork as a true merge commit, resolving conflicts inbin/fm-crew-state.sh,bin/fm-spawn.sh,bin/fm-test-run.sh, and the dispatch-resolve and portable-shards files so fork-only material (supervision-branch mod, dispatch-resolve outcome log,autoCompactWindowlaunch setting,.compact-skillsinventory line, OTLP tracing) stays intact; also merges the concurrent pin bump to Claude Code 2.1.276 (fix(mod): bump supervision-branch Claude Code pin to 2.1.276 #25).fm-spawn.shanswers the Kimi 2.0.0 folder-trust dialog and launches Codex crewmates/scouts with--disable hooks;fm-watch.shreports a dead-agent record once instead of escalating forever;fm-turnend-guard.shlets non-owner Claude Stops exit safely;fm-crew-state.shselects authoritative no-mistakes runs and distinguishes captain outcomes from no-op updates (with new v1.70.1 capture fixtures);fm-contributions.shsettles terminal observations;fm-mail-check.shhardening; Pi Calm preserves substantive mid-turn text via newfm-calm-preservation.tsmodules.fm-lint.shgains--partition/--telemetryand runs as a two-way matrix; full-coverage test shards rebalanced from 5 to 9 runners; new tests for the Codex hook-layer live E2E, foreign-owner turn-end repro, Kimi harness, and watcher lock/triage paths.Risk Assessment
✅ Low: True merge commit (no rewrite of main) whose eight hand-resolved conflict files reconcile exactly to upstream plus the fork-only material the intent names; every other file matches git's own auto-merge tree, PR 25's pin bump is carried verbatim, and no duplicate definitions, syntax errors, or colliding test expectations were found, leaving only the intent-mandated full regression for the test phase.
Testing
Audited the merge resolution by recomputing git's auto-merge tree and diffing it against fb2bec9 (only the 8 conflicted files differ; no conflict markers remain; fm-branch-mod byte-identical to fork main), syntax-checked every changed shell script, ran the runner's --check-coverage guard (223 scripts partitioned, 0 unhinted), then ran 22 targeted behaviour suites covering every conflicted file and every fork-only feature plus the upstream-touched watcher/contributions/mail/turn-end suites, including the supervision-branch mod's
claude plugin validate --strictandclaude plugin testunder the real installed Claude Code 2.1.276. All 22 passed with no gate skips. Full regression per the captain's conflict rule was not run here (the test phase is targeted by contract); it belongs to remote CI. Only pre-existing upstream gap observed:--changed --base acd7047dies onno changed-test mapping for source path: GROK_BOT.md, which upstream's own runner also lacks (not merge-introduced).bin/fm-test-run.sh --check-coverage→ FM_TEST_COVERAGE ok total=223 serial_unhinted=0; tests/fm-test-run.test.sh and tests/fm-ci-workflow.test.sh exit=0Evidence: Merge-resolution audit (auto-merge tree vs merge commit, per-file numstat, fork-only diffs vs upstream)
Source: Merge-resolution audit (auto-merge tree vs merge commit, per-file numstat, fork-only diffs vs upstream)
Evidence: Coverage guard after shard rebalance merge
Evidence: Targeted run 1 timing artifact
Source: Targeted run 1 timing artifact
Evidence: Targeted run 2 timing artifact
Source: Targeted run 2 timing artifact
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
⏭️ **Rebase** - skipped
Step was skipped.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bin/fm-test-run.sh --check-coverage→ FM_TEST_COVERAGE ok total=223 serial_unhinted=0; tests/fm-test-run.test.sh and tests/fm-ci-workflow.test.sh exit=0git merge-tree --write-tree acd7047 9bc051fthengit diff --stat <tree> fb2bec9(only 8 conflicted files differ)git grep -nE '^( | | )( |$)' fb2bec9(no conflict markers)git diff --stat acd7047 fb2bec9 -- .claude/mods/fm-branch-mod docs/claude-supervision-branch.md(empty: mod identical to fork main)bash -non every changed bin/.sh and tests/.shbin/fm-test-run.sh --check-coverage(FM_TEST_COVERAGE ok total=223 serial_unhinted=0 parallel_unhinted=0)bin/fm-test-run.sh --list --lane <each lane>(9 serial shards, 2 parallel, herdr)bin/fm-test-run.sh tests/fm-crew-state.test.sh tests/fm-dispatch-resolve.test.sh tests/fm-spawn-dispatch-profile.test.sh tests/fm-test-run.test.sh tests/fm-trace-context-spawn.test.sh tests/fm-trace-context-lib.test.sh tests/fm-trace-span-lib.test.sh tests/fm-branch-claude-mod.test.sh tests/fm-branch-mod-bin.test.sh tests/fm-precompact-skills.test.sh tests/fm-promote.test.sh tests/fm-bootstrap.test.sh tests/fm-ci-workflow.test.sh tests/fm-calm-claude-mod.test.sh(14/14 pass)bin/fm-test-run.sh tests/fm-branch-claude-mod-plugin.test.sh tests/fm-calm-claude-mod-plugin.test.sh tests/fm-watch-triage.test.sh tests/fm-contributions.test.sh tests/fm-mail-check.test.sh tests/fm-turnend-guard.test.sh tests/fm-branch-supervision.test.sh tests/fm-remote-secondmate-trace-context.test.sh(8/8 pass, plugin suites ran under real claude 2.1.276)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.