Skip to content

Merge upstream/main (7 commits) into fork main via true merge commits - #37

Merged
andrewesweet merged 11 commits into
mainfrom
fm/fm-upstream-sync-3
Sep 20, 2026
Merged

andrewesweet merged 11 commits into
mainfrom
fm/fm-upstream-sync-3

Conversation

@andrewesweet

@andrewesweet andrewesweet commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Merge commit required — do not squash or rebase. Merge this PR with git merge --no-ff / GitHub's "Create a merge commit": the deliverable is the branch's true two-parent merges, and squash/rebase would erase the upstream-integration structure this sync exists to land.

Upstream sync: kunchenguid/firstmate main → andrewesweet/firstmate main

Merges upstream/main 9bc051ff..1b1b6e05 (7 commits) into the fork's main via true merge commits. Branch tip 3466307d is itself a merge of the fork's latest main, so this PR carries upstream and the fork's newest main (PRs #34, #36) in one validated head.

What upstream brought in (the 7 commits)

Upstream commit Subject Kept?
1b1b6e05 fix(bin): stop labeling Herdr as experimental (kunchenguid#4972) yes
b6930db7 fix(bin): keep supervisor status closes from waking the same home (kunchenguid#4895) yes
2bcb88c3 ci: standardize workflow timeouts into three tiers (kunchenguid#4910) yes
65a3bac6 feat: park main under the away posture on Pi (kunchenguid#4889) yes
4812db80 fix(bin): preserve Claude lock ownership after helper recycling (kunchenguid#4894) yes
1bb72cc5 fix: disable compact adviser for spawned agents (kunchenguid#4877) dropped in full
daaffdb5 fix(bin): create captain-hold rows when Beads requires due (kunchenguid#4854) yes

1bb72cc5 is dropped entirely by resolution decision. That commit exists solely to disable the compact adviser for spawned agents (COMPACT_ADVISER_DISABLE=1 launch prefix, pane export, LAUNCH_ENV_PREFIX floor membership, its test files, and its docs paragraph). The captain's standing decision (2026-09-19) is that the compact-adviser runs in auto mode everywhere it supports auto, loaded via config/claude-function-hooks — the fork's behaviour wins wherever that commit conflicts with it. Every piece of 1bb72cc5 was removed during conflict resolution: the launch prefix and export in bin/fm-spawn.sh, its two test files (tests/fm-spawn-compact-adviser-disable.test.sh, -remote.test.sh), their support entries in tests/fixtures.sh and bin/fm-test-run.sh, and the docs paragraph in docs/configuration.md. Post-merge verification: zero COMPACT_ADVISER references remain.

Conflict resolutions (6 conflicted files)

  1. bin/fm-spawn.sh — dropped all of 1bb72cc5 (launch prefix, pane export, env-prefix floor); kept the fork's OTEL_RESOURCE_ATTRIBUTES header, config/claude-function-hooks opt-in, and force-persistence launch settings, restructured per the fork's trace-context work; kept upstream's away-posture spawn gates (spawn_refuse_if_away_spend_cap, spawn_require_relocated_queued_work, fm_lease_away_relocated backlog gate) and the verified-Herdr wording (no longer experimental).
  2. docs/configuration.md — removed the compact-adviser paragraph and the "kill switch described below" phrase (part of the 1bb72cc5 drop); otherwise both sides' edits stand.
  3. docs/verification/runtime-backends.md — kept both added sections: the fork's "Claude Code supervision branch" pin-evidence section and upstream's "away posture parks main" subsection (nested under "Pi supervision branch" to preserve heading hierarchy). Both byte-verified against their sources.
  4. tests/fm-captain-hold-lifecycle.test.sh — kept both added tests: fork's test_close_paths_emit_hold_spans_over_the_recorded_hold_time and upstream's test_hold_creates_a_captain_row_when_beads_requires_due_without_custom_type.
  5. tests/fm-kimi-harness.test.sh (2 hunks) — fork's unset TRACEPARENT; scrub prefix wins (fork's trace-context restructure replaced upstream's adviser-disable prefix in launch assertions).
  6. tests/fm-send-resolve-key.test.sh — kept the fork's 2 span tests; added upstream's test_decision_answer_partition_relocates_under_the_record (auto-merged body).

Plus tests/fm-spawn-dispatch-profile.test.sh (3 hunks, in the same resolution pass): fork's launch expectations win — unset TRACEPARENT; prefix, function-hooks settings JSON, claude_expected_launch() with the hooks-prefix parameter — replacing upstream's export COMPACT_ADVISER_DISABLE=1; expectations.

Post-merge fixes on the branch

Regression evidence

All run on the branch head before validation:

  • bin/fm-lint.sh — pass
  • bin/fm-doc-audience-check.sh — ok surfaces=105 local_links=453
  • bin/fm-test-run.sh --check-coverage — pass (total=223 parallel=24 ... serial=183 serial_shards=9 herdr=16)
  • bin/fm-test-run.sh --all (serial; --jobs refused by the runner on this host — unproven stateful scripts stay serial): FM_TEST_SUMMARY total=223 failed=9 skipped_gate=28
  • bin/fm-test-run.sh tests/fm-branch-claude-mod-plugin.test.sh — pass (Claude Code 2.1.278)
  • claude plugin validate --strict .claude/mods/fm-branch-mod — pass (pin 2.1.278 == PATH claude 2.1.278)

The 9 script-level failures, triaged

  • 1 merge-caused, fixed: fm-branch-claude-mod.test.sh tracked-agent staleness — fixed by 637e3feb; the test passes standalone after regeneration.
  • 2 are upstream's own, reproduce on a clean upstream/main checkout, left as-is: fm-session-lock-ancestry.test.sh ("the pty-host was not reparented to init after the daemon ended" — the new fixture from 4812db80 expects macOS launchd reparenting) and fm-test-run.test.sh's nested --jobs-admission assertion, which fails only because it chains the same script. Both fail identically on pristine upstream/main on this host.
  • 6 environmental on this host, reproduce identically on a clean pre-merge fork main: fm-backend-zellij-smoke.test.sh (also verified on clean upstream/main; zellij 0.45.1 cannot hold sessions on this WSL2 host), fm-composer-codex-idle-live-e2e.test.sh (codex 0.154.0 TUI never renders its composer in the isolated tmux server here), fm-procevent-quota.test.sh (lab state-root permissions), fm-procevent.test.sh (listener reparenting, same host semantics), fm-secondmate-liveness.test.sh (live Herdr pane-state mapping), and the affected script counts above. None of these scripts or their subjects were touched by the merge (git diff 1e5e6826..HEAD is empty for them).
  • 1 load flake: fm-watcher-lock.test.sh HUP-exit timing — passes standalone on the branch.

Known drift (follow-up work, not in scope here)

The regenerated fm-branch.md now carries upstream's away-posture prompt text (POSTURE: AWAY tail, decision-row intake) that only the Pi supervision extension implements; the fork-only Claude hooks module (branch.ts) does not read state/.afk-contract and still stands down on the legacy state/.afk flag. The generated file must match its upstream generator byte-for-byte (enforced by test), and extending the fork's mod to the away posture is feature work beyond an upstream sync — flagged for follow-up.

Pipeline

Updates from git push no-mistakes

Run 01M2Y5KDPMQX1G4FB6T7VHXWAJ on no-mistakes: all nine steps completed at head 3466307 (the attestation section was lost when the PR description was rewritten mid-run; restored here, attesting the same completed run).

RooseveltAdvisors and others added 11 commits September 18, 2026 11:48
…id#4854)

Captain holds have no due semantics and are a hold kind, not a Beads issue
type. The create path now waives due.required and maps to native type task.

Co-authored-by: Cursor <cursoragent@cursor.com>
* feat(bin): launch every spawned agent with the compact adviser disabled

Every crewmate, scout, and secondmate Firstmate launches now starts with
COMPACT_ADVISER_DISABLE=1, on a fresh spawn and on a relaunch alike, so an
unattended session never activates the compact adviser.
The value is unconditional: no configuration file gates it and there is no
override, unlike the trace carrier beside it.

Three carriers deliver it, because no single one covers every launch shape.
The pane shell receives an export beside GOTMPDIR, so the agent's own children
inherit it too.
The launch command carries an explicit assignment, prepended outermost so it
wins over any ambient value the pane already held.
The cleared launch environment sets it again at the `env -i` boundary and keeps
COMPACT_ADVISER_DISABLE in the fixed operational floor, which is what preserves
the switch when config/launch-env-allowlist empties the environment, and what
delivers it on a remote host that never had the value.

bin/fm-control.sh relaunch, the bootstrap secondmate relaunch, and the remote
secondmate transport all rebuild their launch through bin/fm-spawn.sh, so they
inherit the same floor.
The captain's own primary session is untouched.

The two new suites drive the real spawn and then execute the launch command the
pane actually received, with the harness replaced by a probe that prints its own
environment, rather than matching script text.
They cover ship and secondmate launches with the allowlist absent and enabled,
the pane export and its ordering, fm-control.sh relaunch, and the full parent to
remote-host chain.

* no-mistakes(review): Export compact-adviser disable across compound launches

* no-mistakes(document): Document spawned-agent compact-adviser environment guarantee
…henguid#4894)

* fix(bin): let a background Claude session keep owning its session lock

Session-lock ownership was decided by process ancestry alone. Under an
unattended Claude session the model loop runs in a transient bg-spare
bridged to the front-end by a shared daemon; when that bridge is
recycled the contiguous claude-named ancestry from a hook to the
recorded owner breaks while the owner pid stays alive, so the Stop
auto-arm stood down as a foreign live owner, the turn-end guard ended
every turn with its read-only diagnostic, and fm-lock.sh refused - a
self-sustaining outage until restart.

Ownership is now ancestry membership OR a trusted same-session id,
never id-first:

- fm-session-lock-lib.sh accepts CLAUDE_CODE_SESSION_ID only when
  CLAUDE_PID is a Claude-shaped member of the current contiguous run,
  compares it against the id recorded in state/.lock-session, and
  requires the recorded pid to still be a live harness. No id, no
  sidecar, an untrusted id, a different id, or a dead recorded pid
  leaves the ancestry verdict unchanged. Ids are never read from ps
  argv.
- fm-lock.sh accepts a same-session holder at both refusal sites,
  writes, refreshes, and clears the sidecar only under its claim lock
  (including the early already-mine exit, skipped only while the
  deferred startup sweep leases that lock), keeps it byte-identical
  across a same-session confirmation, records CLAUDE_PID on lock line 1
  for a session with a trusted id so a shared daemon or front-end that
  outlives the session never keeps a dead session's lock alive, never
  rewrites a live line 1 on a same-session confirmation, and names the
  recorded id in the live-owner refusal.
- The .lock line-1 format is unchanged, so every reader that takes the
  whole first line as the pid keeps working; the guard's foreign-owner
  exit is unchanged and inherits the fix through the shared predicate.

Tests: the ancestry suite drives the ancestry and id signals apart in a
deterministic process table (asserting the divergence) and runs a real
orphaned front-end/daemon/pty-host/spare tree through six phases with
the real lock, auto-arm, and guard scripts; the foreign-owner repro
keeps its negative control and adds a same-id positive control.

Disclosure: no live unattended Claude background session ran on the
verifying machine. The topology is documented by the real process
listings in kunchenguid#3902, kunchenguid#2314, kunchenguid#3398, and kunchenguid#4066; coverage is the structural
predicate plus the executable fixtures, not a live pass.

Residual: bin/fm-sessionstart-nudge.sh keeps its own private ancestry
walk (it only decides whether to print a nudge) and may nudge on a
resume in the recycled case.

Out of scope, deliberately: no structured lock format, no guard budget
changes, no daemon-identity rejection, no fork lineage.

* no-mistakes(review): Wait for claim lock; revert failed sidecars

* no-mistakes(review): Revalidate ownership after wait; restore sidecars

* no-mistakes(review): Roll back sidecar by publication phase

* no-mistakes(review): Restore sidecar only if lock line is unchanged

* no-mistakes(review): Trust session ids without a spelling allowlist

* no-mistakes(review): Disarm sidecar rollback before backup cleanup

* no-mistakes(document): Updated session-lock ownership documentation
* feat: park main under the away posture on Pi

While the away-posture record exists on a Pi primary, the supervision branch
takes every actionable wake, no processing turn opens on main, captain rows
accumulate for the return brief, and main's standing authority relocates to
the branch through the existing guarded scripts.

- lib/fm-branch-dispatch.ts: read the record at every routing decision; while
  it exists claim check, decision-owned, and heartbeat rows too, keeping the
  two broken-queue vetoes; expose checkSeqs so a claimed check row lifts task
  scoping.
- fm-primary-pi-watch.ts: offer every actionable row under the record; a
  declined wake and every watcher-failure alarm still reach main.
- fm-branch-supervision.ts: drop the legacy .afk decline; append a fixed
  POSTURE: AWAY tail carrying the record's read-back verbatim per wake; open no
  processing request while the record exists, re-checked immediately before a
  request would open and at every run boundary; present the accumulated rows
  at the first run boundary after archive.
- fm-lease-lib.sh: fm_lease_forbid_branch passes the branch for opted-in
  actions only while fm-afk-contract.sh validate succeeds on a confirmed live
  record; PR merge, fresh spawn, and decision answer opt in, local landing
  never does.
- fm-send.sh: a --resolve-key naming an open needs-decision or captain-held
  task is a decision answer and meets the partition; blocked: keys stay
  steering.
- fm-spawn.sh: enforce the record's spend cap for a fresh ordinary spawn by
  either actor; relaunches and secondmates exempt.
- fm-branch-prompt.sh: fixed Postures section and the verbatim
  ask-user-authority policy; the prefix stays byte-stable.
- fm-afk-return.sh: count what the away session handled from the store.
- docs, afk skill, AGENTS.md stub: main parked on Pi, green merge gate
  absolute while away.
- tests: watcher and branch extension suites, fleet-record, merge, and
  decision-answer suites cover the relocation, the vetoes, the tail, the
  parked processing turn, the cancellation, the re-presentation, and the
  spend cap; dated live-guard evidence recorded.

* no-mistakes(review): Refuse branch merge after preflight archive race

* no-mistakes(review): Fix away wake, spawn, and processing races

* no-mistakes(review): Suppress parked processing; narrow away-only rejection

* no-mistakes(review): Abort dedicated processing; gate branch spawn once

* no-mistakes(review): Stamp away-only on the dispatch offer

* no-mistakes(review): Treat invalid away records as spend-cap absence

* no-mistakes(review): Drop spawn test hook; abort processing-opened runs

* no-mistakes(review): Bind abort to opening prompt; cap-read absence

* no-mistakes(review): Limit away branch spawn to queued work only

* no-mistakes(document): Correct AFK posture documentation
* ci: simplify CI job timeouts to a three-tier policy

Replace the scattered per-job timeout values (10m parallel, 25m lint, 30m
serial, 10m macOS) with three readable tiers, each a hang tripwire with
headroom rather than a packing estimate:

- fast (5m): coverage guard, repo invariants, timing aggregate
- normal (30m, one shared budget): lint partitions, portable parallel
  shards, portable serial shards, macOS stock Bash
- heavy (Herdr only): 20m step tripwire on the family run so always()
  cleanup still runs, under a 75m job-level last-resort backstop

The workflow's header comment states the policy and points at
docs/fm-test-portable-shards.md "Timeouts", which now owns it, and each
job names its tier beside timeout-minutes. tests/fm-ci-workflow.test.sh
asserts the policy against the parsed workflow instead of the old
per-job minute values: every job joins exactly one tier, exactly three
distinct job-level values exist, the fast tier stays within 5-10
minutes, the normal budget stays at least double the modeled parallel
lane sum reported by fm-test-run.sh --check-coverage, and the Herdr step
tripwire stays below its job backstop with an always() cleanup after it.

Concurrency supersession, shard counts, lane membership, and fail-fast
settings are unchanged.

* no-mistakes(review): Decouple the normal timeout from packing estimates

* no-mistakes(review): Assert Herdr teardown follows the family run

* no-mistakes(review): Pin Herdr family-run timeout to 20 minutes

* no-mistakes(review): Ignore comments when identifying Herdr steps

* no-mistakes(review): Identify Herdr steps by declarative ids

* no-mistakes(document): Clarify authoritative three-tier timeout policy
…nchenguid#4895)

* fix(bin): keep supervisor status closes from waking the same home

A drain that already folded OPEN DECISIONS has presented those bytes even
when the watcher has no matching seen marker. Treat that fold, and the
presentation cursor, as known so the bookkeeping close stays quiet while
later worker lines still signal.

* no-mistakes(review): Keep folded worker failures waking past supervisor closes

* no-mistakes(review): Wake on unlisted folded worker lines; batch multi-key closes

* no-mistakes(review): Stop folded worker resolved lines from counting as already read

* no-mistakes(document): Correct self-announced close marker contract in docs
* Stop steering operators away from Herdr

* no-mistakes(review): Neutralize remaining Herdr opt-out documentation wording
Brings in upstream kunchenguid/firstmate 9bc051f..1b1b6e0 (7 commits):
Herdr verified-adapter wording, supervisor status-close wake fix, CI
workflow timeout tiers, away-posture parking on Pi, Claude lock
ownership across helper recycling, compact-adviser disable for spawned
agents, and captain-hold rows when Beads requires due.

Conflict resolutions:
- bin/fm-spawn.sh: kept the fork's config/claude-function-hooks opt-in,
  trace-context/OTEL launch surface, and Claude force-persistence +
  startup-context settings; took upstream's away-posture spawn gates
  and verified-Herdr wording; dropped every piece of upstream 1bb72cc
  (COMPACT_ADVISER_DISABLE export, pane export, env floor membership,
  docs, fixtures support, and its two regression files) because the
  captain's standing decision keeps the compact adviser in auto mode
  everywhere it supports auto, loaded through config/claude-function-hooks.
- docs/verification/runtime-backends.md: kept both the fork's Claude
  Code supervision-branch pin evidence and upstream's away-posture
  verification entry (placed under Pi supervision branch).
- tests: kept fork launch expectations (unset TRACEPARENT prefix,
  function-hooks/settings JSON) and added upstream's new Beads-due and
  partition-relocation tests alongside the fork's span tests.
- Reverted tests/fixtures.sh and bin/fm-test-run.sh pieces that existed
  only to support the dropped compact-adviser tests.
Brings in the fork's merged PR 34 (fm/branch-jev-gates): shadow advisory
facts and the candidate gates scorer, so this branch's validation and PR
carry the head that will ship.
…enerators

The upstream merge changed the generator's inputs (away-posture
relocation from 65a3bac and the ask-user-authority policy copy), so the
tracked agents/fm-branch.md went stale against bin/fm-branch-agent-md.sh.
Regenerated; tests/fm-branch-claude-mod.test.sh's staleness check pins it.
…sync-3

Carries the fork's newest main (c50581c, dispatch model/probability/margin
telemetry) into the upstream-sync branch per the plain-merge precedent:
the branch keeps both true merges (upstream 1b1b6e0 and fork main) with
two parents each, so the shipping PR carries upstream and main intact.
@andrewesweet andrewesweet changed the title feat(bin): sync upstream firstmate 9bc051ff..1b1b6e05 via true merge Merge upstream/main (7 commits) into fork main via true merge commits Sep 20, 2026
@andrewesweet
andrewesweet merged commit daab2a9 into main Sep 20, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants