Skip to content

feat(bin): sync 19 upstream firstmate commits into the fork - #123

Merged
max-metaplanet merged 25 commits into
mainfrom
fm/fork-upstream-sync
Oct 19, 2026
Merged

max-metaplanet merged 25 commits into
mainfrom
fm/fork-upstream-sync

Conversation

@max-metaplanet

@max-metaplanet max-metaplanet commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Intent

Pull in what's useful from upstream firstmate, as the first step of the fork-drift work: bring the 19 ksrc/main commits we lack into our fork (merge or cherry-pick, resolving conflicts in favour of keeping both behaviours) and verify with the full suite.
Priority ones for us: 0791268 per-secondmate account pins, eeeeb91 Claude session lock survives /clear, f05b628 reclaim orphaned Claude auto-arm claims, 8ba34f1 positive daemon status in crew-state, 56074d0 reported checks when base requires none (overlaps our PR 115/117 fix), 4e6b9f5 operator evidence guards before wedge escalation, 66c300b version URLs for tool updates, c7b7798 empty inbox listing, 69f9d09 refuse spawn into unborn HEAD.
Harmless but irrelevant here: GitLab waiver, Polytoken adapter, pi, opencode, remote job identity, herdr project groups; take them anyway to reduce drift unless they conflict.
Report what landed and any conflict decisions.

The referenced fork check-policy fixes share one evaluator across PR-state reporting, merge verification and CI waits: configured required contexts, including missing contexts and their producer bindings, must pass; when the base has no required contexts, reported checks still count except explicitly marked advisory checks, and unreadable checks refuse. Keep that behaviour when integrating the upstream reported-check fallback.

What Changed

  • Merges all 19 upstream ksrc/main commits we were missing:
    • Fixes: per-secondmate account pins; the Claude session lock now stays with its session after /clear; orphaned Claude auto-arm claims get reclaimed; crew-state needs a positive daemon running status; operator evidence guards are checked before wedge escalation; watched tool updates accept version URLs; listing an empty inbox succeeds; spawn refuses a project whose HEAD is unborn.
    • New, off by default: a Polytoken crewmate/scout adapter (bin/fm-polytoken-lib.sh), Herdr project groups with an agents view (bin/fm-herdr-groups.sh, bin/backends/herdr-agent-view.py), and a GitLab --allow-no-pipeline merge waiver.
    • Also in: fixes for pi, opencode and remote job identity, plus their tests and docs.
  • Where upstream and fork code conflicted, the merge keeps both behaviours. It keeps the fork's guards for seats, teardown, worktree ownership and watcher termination, and adds the upstream paths alongside them. bin/fm-pr-state.sh is unchanged, so the fork's single check evaluator still decides PR state, merge checks and CI waits. Upstream's fallback (show reported checks when the base requires none) is satisfied through that evaluator, and its regression tests were adapted to it. The full per-file conflict log is in the merge commit message.
  • Follow-up fixes after the merge:
    • Account pins now control effective launch, trust and lock while claude_seat retains the separate named-seat identity. Removing a pin restores the saved seat; plain pin → unpin also returns to ordinary selection (bin/fm-spawn.sh, bin/fm-control.sh, docs/agent-control.md).
    • Fixed a flaky tick counter in the fake tmux used by tests/fm-watch-triage-delivery.test.sh, and the socket paths in tests/fm-herdr-groups.test.sh on macOS.
    • Added a manual trigger for the full-suite CI fallback in .github/workflows/ci.yml.

Risk Assessment

⚠️ Medium: The remaining files are either verbatim upstream takes (no fork edits were lost: every upstream-equal file was unchanged by the fork or is new) or clean, faithful unions of both sides (fm-lock shared claim lock plus lease/auto-arm locks with publish-then-handover-clear ordering, the single-read auto-arm parser extended with owner_session_id and the line-3 lock identity, the Polytoken verdict convention, the union config-inherit allowlist, the teardown cleanup union, test-call unions). Only a cosmetic comment misplacement was found, but the overall merge is large and touches the session-lock and account-selection paths, so it stays medium.

Testing

The configured selector command still exits 124 on this host because of a budget overrun the user already chose to ignore. Evidence for crew-state, pr-state, session-lock, herdr-groups and inbox comes from earlier rounds and was not rerun. This round reran the three suites that cover the pin/seat change against isolated fixture homes. Each ran the real fm-control.sh and fm-spawn.sh scripts with tmux and claude stubbed, and all passed. That includes the new named seat → pin → unpin regression and the existing pin → unpin, changed-pin and explicit-seat-vs-pin cases. No live Claude lab ran: it needs a signed-in pin store, and its workspace-trust write would change a real credential store. So every scenario is untested live.

  • Live validation: ⚠️ inconclusive - 0 of 5 scenarios driven live against the product
Scenario Result Live Evidence
A worker on named seat 'work' is relaunched under an account pin: it launches with CLAUDE_CONFIG_DIR set to the pin, and the meta keeps claude_seat=work ⏸️ untested no The earlier payload did not show a live result. It covered this only with a fixture-home test run (real fm-control.sh/fm-spawn.sh, tmux and claude stubbed). A live Claude lab needs a signed-in pin sto…
After the pin is removed, the relaunch returns to the recorded seat and the old pin path appears nowhere in the launch ⏸️ untested no The earlier payload did not show a live result. Only the fixture-home test with stubbed tmux/claude covered this. A live run needs a disposable signed-in pin store that is allowed to be modified.
Plain pin → unpin and changed mate pin: the launch follows the current pin, the pin is recorded as account and not as claude_seat, and the new pin gets workspace trust ⏸️ untested no The earlier payload did not show a live result. Only the fixture-home tests with stubbed tmux/claude covered this. The workspace-trust write would change a real credential store, so it needs a disposa…
Adversarial: an explicit --seat cannot override an active pin, and a missing recorded seat refuses before the old agent is stopped ⏸️ untested no The earlier payload did not show a live result. Only the fixture-home tests with stubbed tmux/claude covered this. A live run needs a disposable signed-in pin store that is allowed to be modified.
A per-secondmate pin and a named seat stay mutually exclusive, and pinned homes refuse raw Claude account overrides ⏸️ untested no The earlier payload did not show a live result. Only fm-worker-account.test.sh against fixture homes covered this. A live run needs a disposable signed-in pin store that is allowed to be modified.
Evidence: fm-control-relaunch transcript

Source: fm-control-relaunch transcript

Full automated test transcript: see the evidence link above.

Evidence: fm-worker-account transcript

Source: fm-worker-account transcript

Full automated test transcript: see the evidence link above.

Evidence: fm-seat transcript

Source: fm-seat transcript

Full automated test transcript: see the evidence link above.

Evidence: Pin/seat relaunch cases
ok - fm-control relaunch: the replacement follows the home's current worker account pin
ok - fm-control relaunch: a named seat survives a worker account pin and returns once it is removed
ok - fm-control relaunch: mate pins are re-read for Claude and Pi, and unusable pins refuse before stopping the agent
ok - fm-control relaunch: an explicit seat cannot override the worker account pin
ok - relaunch and direct spawn relaunch refuse a missing recorded Claude seat
  • Outcome: ⏭️ skipped across 4 runs (1h55m4s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ⚠️ tests/fm-worker-account.test.sh:538 - The new merge-added regression call test_secondmate_pin_cannot_override_an_active_named_seat runs after the suite's echo "# all fm-worker-account tests passed" footer. If it fails, the log has already printed the all-passed line, which misleads anyone reading the output (the exit status still fails). Move the call up into the test list above the footer.
  • ℹ️ bin/fm-spawn.sh:3280 - The merge computes WORKER_ACCOUNT_MATE twice (once before the pin/seat mutual-exclusion check, and again right before fm_worker_account_select), with identical logic. The second assignment is redundant and can be dropped so the mate id has one definition for both consumers.

🔧 Fix applied.
✅ Re-checked - no issues remain.

  • ℹ️ tests/fm-watch-triage-stale.test.sh:1398 - When the four upstream wedge-guard cases were moved into the split stale suite, they were inserted between test_gone_report_rearms_when_the_endpoint_comes_back and its leading comment. The comment ("Reporting once must not mean reporting once forever...") now sits above the unrelated "opt-in operator guards" section header, and the gone-report test has no comment. Move that comment back so it directly precedes test_gone_report_rearms_when_the_endpoint_comes_back, after the guard block. This doesn't change behaviour. The helpers the moved cases use (wedge_threshold_fixture, wedge_threshold_round, ack_stopped_cycle, gone_endpoint_env) exist in tests/watch-triage-helpers.sh, and the fixture creates $dir/config as the cases require.
⏭️ **Test** - skipped
  • 🚨 configured test command failed with exit code 124
  • 🚨 tests/fm-herdr-groups.test.sh:60 - Upstream fm-herdr-groups suite failed on macOS after the merge. The fork's fm_backend_herdr_canonical_socket_path resolves /tmp to /private/tmp, but the upstream assertions expected the raw '/tmp/fm-groups-s1.sock'. Separately, the helper case put its AF_UNIX socket under the long macOS TMPDIR ('AF_UNIX path too long'). Fixed in the test only: the expected value comes from the OS's own resolution of /tmp, and the socket fixture lives in a short, registered fixture root under /tmp. The suite now passes 11/11 and cleans up.
  • ⚠️ .no-mistakes.yaml - The configured test command exits 124 on this host. The selector's 78 scripts were estimated at 289s serial but took 1,148s of suite time (727s wall time with 4 jobs), so they cannot fit the 300s local budget here. Nothing beyond the merge-relevant suites was rerun locally; CI must be green, including the planned workflow_dispatch full run, before merge.
  • ℹ️ tests/fm-test-fixtures.test.sh:315 - Host-only failures, not touched by the merge. fm-test-fixtures fails because the host cc/ld cannot link (macOS 27 CLT 'tapi error: malformed file'). fm-backend-zellij-smoke fails because the installed zellij 0.43.1 is below the verified 0.44 minimum. fm-extension-binding failed under 4-job contention and passes alone.
  • ℹ️ bin/fm-tool-update-check.sh:527 - Inherited upstream behaviour (the file is byte-identical to ksrc 45dd50a): a version_url whose body is an HTML page (https://example.com/) yields a version-shaped token ('1.6') instead of 'did not report a version'. Not a merge regression, but worth an upstream follow-up.
  • Live validation: ✅ go - 5 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Operator spawns a crewmate into a project with no commits; spawn refuses at once, names the unborn HEAD and the remedy, and leaves no task metadata or commits ✅ pass live spawn-unborn-head-live.txt: exit=1 after 2s with 'no commit yet (unborn HEAD) ... make one commit', no .meta, 0 commits, no tmux session
Crewmate follows the brief's inbox-listing command on an empty or absent inbox; it succeeds silently in bash and zsh and lists messages in numeric order (2, 10, 1000) ✅ pass live brief-inbox-listing-live.txt: exit=0 in every shell and inbox state; the old bare glob fails in zsh with 'no matches found'
Watched tool with version_url: an old binary reports 'update available' against the published version, a current binary stays silent, and an http:// URL or a missing command is refused ✅ pass live tool-update-version-url.txt (cases A, B, C, E)
PR on a base with no required checks (unprotected fork main): failing non-advisory reported checks are blockers, skipped checks are ignored, and a green PR passes ✅ pass live pr-checks-unprotected-base-live.txt: PR118 'REQUIRED CHECK: CI gate (red)' and 'Lint 2 (red)' exit=1, which matches gh's failures; PR122 exit=0
Claude primary runs session start, then /clear, then runs it again; the lock stays owned by the same Claude process and the session id is re-keyed without a foreign-owner refusal ✅ pass live session-lock-clear-live.txt: .lock=89644 (claude) before and after; .lock-session changed 9a403347... -> bf0dfa9a...; second start reported 'Lock: acquired by harness pid 89644'
Herdr project groups (upstream d20196a) on macOS: sync and clear hand the agents-view helper the fork's canonical socket, and the real helper talks to a local socket ⏸️ untested no The prior payload did not establish a live result. Only the suite's fake-Herdr fixture was driven (rerun-herdr-groups-fixed.log, 11/11 ok after the test fix), not a real Herdr session. The runbook lea…
Orphaned Claude auto-arm claim is reclaimed by a replacement session (f05b628) ⏸️ untested no Needs a dead Claude session that leaves its async Stop hook orphaned, followed by a replacement primary. fm-claude-stop-autoarm.test.sh owns that reproduction and is in the selector's local_deferred l…
Per-secondmate account pin selected on spawn and relaunch (0791268) and operator evidence guards before wedge escalation (4e6b9f5) ⏸️ untested no Needs a live secondmate spawn with a second Claude account store, and a wedged crew under a running watcher. Neither is available without altering credentials or running long supervision lifecycles. T…
crew-state reports the daemon up only on a positive 'daemon running' status (8ba34f1) ⏸️ untested no Proving the negative case needs a cleanly stopped shared no-mistakes daemon. Stopping it would disrupt the operator's running pipelines, including this one. fm-crew-state.test.sh covers it with a fake…
  • bash bin/fm-ci-change-scope.sh --local (selector: full=true, 78 local_scripts, 300000ms budget, priority suites deferred to CI)
  • bash bin/fm-test-run.sh --json <evidence>/configured-selection-timing.json --per-script-timeout-secs 1500 <78 selected scripts> without the outer budget: 74 passed; fm-herdr-groups, fm-test-fixtures, fm-extension-binding, fm-backend-zellij-smoke failed
  • bash tests/fm-extension-binding.test.sh alone: pass (flaky only under contention)
  • bash tests/fm-test-fixtures.test.sh alone: fails; cc on host fails with 'ld: tapi error: malformed file' (broken CLT on macOS 27)
  • bash tests/fm-herdr-groups.test.sh before and after the test fix: fail, then all 11 cases pass and fixture roots are cleaned up
  • Live: bin/fm-spawn.sh unborn-t1 <lab>/projects/unborn --mode local-only --yolo off --backend tmux in a marked lab home
  • Live: bin/fm-brief.sh scaffold, then ran its inbox-listing command in bash and zsh on absent, empty and populated inboxes
  • Live: bin/fm-tool-update-check.sh check with version_url pointing at the real Claude release URL (old and current binaries, http URL, URL without a version, entry without command)
  • Live: bin/fm-pr-checks.sh / bin/fm-pr-state.sh against real fork PRs #122 and #118 on the unprotected fork main, compared with gh pr checks
  • Live: lab Claude primary on private fm-lab tmux socket; ran bin/fm-session-start.sh, then /clear, then ran it again and read state/.lock and .lock-session

🔧 Fix applied.
3 issues (1 error, 2 warnings) still open:

  • 🚨 configured test command failed with exit code 124
  • ⚠️ .no-mistakes.yaml - The configured test command exits 124 on this host because the selected scripts cannot fit the 300s local budget. Full-suite coverage is deferred to the fork's parallel CI, and its workflow_dispatch full run must be green before merge.
  • ⚠️ .no-mistakes.yaml - The configured test command exits 124 on this host. The selector's 78 scripts were estimated at 289s serial but took 1,148s of suite time (727s wall time with 4 jobs), so they cannot fit the 300s local budget here. Nothing beyond the merge-relevant suites was rerun locally; CI must be green, including the planned workflow_dispatch full run, before merge.
  • Live validation: ✅ go - 5 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Herdr project groups suite passes on macOS after the test-only socket-path fix ⏸️ untested no The prior payload established only an automated fixture suite run (round2-herdr-groups-head.log), not a live result. Driving the Herdr lifecycle live was not authorized by the verification plan.
Spawning into a project with an unborn HEAD is refused with guidance and creates nothing ✅ pass live spawn-unborn-head-live.txt (disposable lab home, round 1; bin/ unchanged since)
Listing an empty or absent inbox succeeds in bash and zsh, and messages list in numeric order ✅ pass live brief-inbox-listing-live.txt
Claude session lock keeps ownership across /clear ✅ pass live session-lock-clear-live.txt plus round2-fm-session-lock-ancestry.log
On a base with no required checks, reported checks count and failing ones are surfaced, while the fork's required-check evaluator still refuses ✅ pass live pr-checks-unprotected-base-live.txt (real PRs 118/122) plus round2-fm-pr-state.log
Watched tool update via version URL reports an available update and rejects a non-https URL ✅ pass live tool-update-version-url.txt
crew-state requires a positive daemon running status ⏸️ untested no The prior payload established only the suite's daemon-status fixtures (round2-fm-crew-state.log), not a live result. A live check would need a running no-mistakes daemon, which is out of scope for a g…
Per-secondmate account pins, orphaned auto-arm reclaim and wedge operator-guard escalation ⏸️ untested no The prior payload established only the round-1 configured selection log and filtered suite cases, not a live result. A live check would mean relaunching real secondmates with real account stores and w…
Full suite green ⏸️ untested no The local selector exceeded its 300s budget on this host (configured-selection.log, exit 124), and running the full suite locally is not authorized. It needs the fork's parallel CI workflow_dispatch f…
  • bash tests/fm-herdr-groups.test.sh at HEAD (11/11 ok, no leftover /tmp fixtures)

  • bash tests/fm-crew-state.test.sh (exit 0, 0 not-ok; covers 8ba34f1d daemon status and 11becbbb override identity)

  • bash tests/fm-pr-state.test.sh (exit 0; covers 56074d03 reported-check fallback alongside the fork's required/advisory evaluator)

  • bash tests/fm-session-lock-ancestry.test.sh (exit 0; covers eeeeb916 re-anchor and auto-arm proof)

  • git diff --stat f97757a6 HEAD -- bin docs (empty: no product change since round-1 live evidence)

  • Round-1 live evidence reused: spawn-unborn-head-live.txt, brief-inbox-listing-live.txt, session-lock-clear-live.txt, tool-update-version-url.txt, pr-checks-unprotected-base-live.txt, configured-selection.log

  • 🚨 configured test command failed with exit code 124

  • ⚠️ live validation verdict: inconclusive (0 of 8 scenarios were driven live against the product); untested: Relaunching a worker after its Claude account pin is removed launches without the old pin directory as CLAUDE_CONFIG_DIR, Relaunch with an active or changed pin follows the pin, and a profile chosen with --seat is kept, Watch triage delivery re-arm captures the pane every time, crew-state reports a daemon as running only when the status is explicitly positive, Listing an empty inbox succeeds, One check evaluator: configured required checks must pass; with no required checks, reported non-advisory checks count; unreadable checks refuse, A Claude session keeps its lock ownership across /clear, Herdr project-group socket paths resolve correctly on macOS

  • Live validation: ⚠️ inconclusive - 0 of 8 scenarios driven live against the product

Scenario Result Live Evidence
Relaunching a worker after its Claude account pin is removed launches without the old pin directory as CLAUDE_CONFIG_DIR ⏸️ untested no The earlier payload did not show a live result. Only tests/fm-control-relaunch.test.sh was run (exit 0), against a disposable home with a fake tmux and harness. No live lab primary relaunch was perfor…
Relaunch with an active or changed pin follows the pin, and a profile chosen with --seat is kept ⏸️ untested no The earlier payload did not show a live result. Only the automated suites fm-control-relaunch, fm-worker-account and fm-seat were run, in disposable homes. No live lab primary was run.
Watch triage delivery re-arm captures the pane every time ⏸️ untested no The earlier payload did not show a live result. The fix is to a test fixture only, and only its own automated suite was run (exit 0).
crew-state reports a daemon as running only when the status is explicitly positive ⏸️ untested no The earlier payload did not show a live result. Only tests/fm-crew-state.test.sh was run, against fixture state, not a live lab.
Listing an empty inbox succeeds ⏸️ untested no The earlier payload did not show a live result. Only tests/fm-inbox.test.sh was run, against a disposable home.
One check evaluator: configured required checks must pass; with no required checks, reported non-advisory checks count; unreadable checks refuse ⏸️ untested no The earlier payload did not show a live result. Only the automated suites fm-pr-checks and fm-pr-state were run, with a stubbed gh. A live check against GitHub PRs is owned by CI and was not run.
A Claude session keeps its lock ownership across /clear ⏸️ untested no The earlier payload did not show a live result. Only tests/fm-session-lock-ancestry.test.sh was run. No live Claude session was driven.
Herdr project-group socket paths resolve correctly on macOS ⏸️ untested no The earlier payload did not show a live result. Only tests/fm-herdr-groups.test.sh was run. The verification plan did not authorize a live Herdr lifecycle locally.
  • env -u CLAUDE_CONFIG_DIR bash -c '. bin/fm-timeout-lib.sh; fm_exec_timed 1500 5 bash bin/fm-test-run.sh --per-script-timeout-secs 600 tests/fm-control-relaunch.test.sh tests/fm-watch-triage-delivery.test.sh tests/fm-worker-account.test.sh tests/fm-seat.test.sh tests/fm-crew-state.test.sh tests/fm-inbox.test.sh tests/fm-pr-checks.test.sh tests/fm-pr-state.test.sh tests/fm-session-lock-ancestry.test.sh tests/fm-herdr-groups.test.sh' (all exit 0)
  • Code reading of the f87a8f72 diff to bin/fm-control.sh resolve_relaunch_profile and to the bin/fm-spawn.sh RELAUNCH_SEAT handling

🔧 Fix applied.
2 issues (1 error, 1 warning) still open:

  • 🚨 configured test command failed with exit code 124
  • ⚠️ live validation verdict: inconclusive (0 of 5 scenarios were driven live against the product); untested: A worker on named seat 'work' is relaunched under an account pin: it launches with CLAUDE_CONFIG_DIR set to the pin, and the meta keeps claude_seat=work, After the pin is removed, the relaunch returns to the recorded seat and the old pin path appears nowhere in the launch, Plain pin → unpin and changed mate pin: the launch follows the current pin, the pin is recorded as account and not as claude_seat, and the new pin gets workspace trust, Adversarial: an explicit --seat cannot override an active pin, and a missing recorded seat refuses before the old agent is stopped, A per-secondmate pin and a named seat stay mutually exclusive, and pinned homes refuse raw Claude account overrides
  • Live validation: ⚠️ inconclusive - 0 of 5 scenarios driven live against the product
Scenario Result Live Evidence
A worker on named seat 'work' is relaunched under an account pin: it launches with CLAUDE_CONFIG_DIR set to the pin, and the meta keeps claude_seat=work ⏸️ untested no The earlier payload did not show a live result. It covered this only with a fixture-home test run (real fm-control.sh/fm-spawn.sh, tmux and claude stubbed). A live Claude lab needs a signed-in pin sto…
After the pin is removed, the relaunch returns to the recorded seat and the old pin path appears nowhere in the launch ⏸️ untested no The earlier payload did not show a live result. Only the fixture-home test with stubbed tmux/claude covered this. A live run needs a disposable signed-in pin store that is allowed to be modified.
Plain pin → unpin and changed mate pin: the launch follows the current pin, the pin is recorded as account and not as claude_seat, and the new pin gets workspace trust ⏸️ untested no The earlier payload did not show a live result. Only the fixture-home tests with stubbed tmux/claude covered this. The workspace-trust write would change a real credential store, so it needs a disposa…
Adversarial: an explicit --seat cannot override an active pin, and a missing recorded seat refuses before the old agent is stopped ⏸️ untested no The earlier payload did not show a live result. Only the fixture-home tests with stubbed tmux/claude covered this. A live run needs a disposable signed-in pin store that is allowed to be modified.
A per-secondmate pin and a named seat stay mutually exclusive, and pinned homes refuse raw Claude account overrides ⏸️ untested no The earlier payload did not show a live result. Only fm-worker-account.test.sh against fixture homes covered this. A live run needs a disposable signed-in pin store that is allowed to be modified.
  • env -u CLAUDE_CONFIG_DIR bash tests/fm-control-relaunch.test.sh (includes new case test_named_seat_survives_a_worker_account_pin and the updated changed-mate-pin case)
  • env -u CLAUDE_CONFIG_DIR bash tests/fm-worker-account.test.sh
  • env -u CLAUDE_CONFIG_DIR bash tests/fm-seat.test.sh
  • Reviewed git show HEAD diff of bin/fm-spawn.sh and bin/fm-control.sh against the user_chose_to_fix pin-seat-identity requirement
✅ **Document** - passed

✅ No issues found.

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

✅ No issues found.

Verification scope

Local validation uses targeted automated suites; the full suite is verified by the fork’s parallel GitHub CI on the final pushed head. The pipeline Test step was skipped under the authorized fork policy after its configured five-minute command timed out and live-product scenarios remained untested. The completed pin/seat fix passed the full relaunch, worker-account and seat suites; the new named-seat regression failed before the fix and passed after it. Automated coverage includes tests/fm-control-relaunch.test.sh (plain pin → unpin and named seat → pin → unpin), tests/fm-watch-triage-delivery.test.sh, tests/fm-crew-state.test.sh, tests/fm-inbox.test.sh and tests/fm-task-inbox.test.sh, tests/fm-pr-checks.test.sh, tests/fm-pr-state.test.sh, tests/fm-session-lock-ancestry.test.sh, and tests/fm-herdr-groups.test.sh. Final hosted CI passed on the published head.

Full hosted run on 5461cf84c2007f3b2abf282cb04077b4b81fc8d0: https://github.com/max-metaplanet/firstmate/actions/runs/39230432192 — passed, 28 successful jobs and two expected skips. The normal pull-request CI run also passed: https://github.com/max-metaplanet/firstmate/actions/runs/39230377525. No failed-job retry was needed.

Upstream integration conflict decisions

Base: 60e8fc2 (origin/main at intake).
Upstream: 45dd50a.
Strategy: one merge commit; all 19 upstream commits retained as ancestors.

Commits taken

Conflict decisions

  • .agents/skills/operational-home-layout/SKILL.md: Fork seat configuration; upstream per-secondmate account configuration. Decision: Keep both configuration entries.
  • bin/backends/herdr.sh: Fork send-failure/recovery semantics and harness variable; upstream Polytoken busy override. Decision: Keep fork send-failed and recovery handling; add Polytoken busy identity without losing the fork harness variable.
  • bin/fm-backlog-transition-lib.sh: Fork cached library directory; upstream GitLab completion support. Decision: Keep cached source path and extend forge ownership comment to GitLab; accept GitLab completion path.
  • bin/fm-config-inherit-lib.sh: Fork Claude/Codex seat inheritance; upstream Herdr project groups. Decision: Union the allowlist; per-secondmate account pins remain local to the primary home.
  • bin/fm-control.sh: Fork pre-stop seat checks; upstream per-mate pins and Polytoken launch checks. Decision: Select the per-mate pin while retaining its returned account for seat conflict validation; keep all Polytoken pre-stop checks. A valid explicit pin supersedes the old recorded Claude store on relaunch.
  • bin/fm-harness.sh: Fork in-process HARNESS_VERDICT result; upstream echo-based Polytoken detection. Decision: Add Polytoken through the fork verdict convention, retaining existing adapter detection.
  • bin/fm-lock.sh: Fork handover reservation and runtime publication; upstream session re-anchor lease/auto-arm locks. Decision: Share the existing claim lock and release helper, add lease/auto-arm locking, then publish runtime and clear an admitted handover before releasing locks.
  • bin/fm-pr-state.sh: Fork shared required-check evaluator from dbe11b1 and 91371c8; upstream 56074d0 adds a second gh pr checks fallback. Decision: Keep one evaluator through fm-pr-checks.sh and fm-pr-checks-lib.sh. It already checks non-advisory reported checks on unprotected bases, includes missing configured requirements, and fails closed on read errors. Adapt upstream regressions to this API; preserve the fork REQUIRED CHECK label and advisory policy.
  • bin/fm-spawn.sh: Fork parked-session resume, seats, unclaimed-worktree guard and ticket hook; upstream Polytoken, per-mate accounts and Herdr groups. Decision: Compose both paths, retain validate_spawn_worktree_unclaimed, seat gates, profile trust and metadata, and both hooks. Extend pin/seat refusal to the selected per-mate pin while retaining the primary-home seat guard. The selected durable Claude pin owns effective launch, trust and lock while set; account records it separately from claude_seat, preserving named-seat continuity when the pin is removed.
  • bin/fm-teardown.sh: Fork merged-at/park record cleanup and isolation protections; upstream generated Polytoken wiring cleanup. Decision: Keep fork cleanup and guards; add only task-owned Polytoken files and generated untracked wiring to existing guarded teardown.
  • bin/fm-test-run.sh: Fork timing entries and pipeline-spend suite; upstream Herdr-group and Polytoken suites. Decision: Union suite entries, preserve fork timing measurements for existing suites.
  • bin/fm-wake-lib.sh: Fork single-read auto-arm ledger parser; upstream session-owner identity fields. Decision: Extend the single-read parser with owner_session_id and the third-line lock identity; retain orphan recovery and lease logic.
  • bin/fm-watch.sh: Fork bounded run-activity deferral and escalation wording; upstream operator evidence guard. Decision: Keep both bounded deferrals and append operator guard evidence to both ordinary and deep-inspection escalations. Keep exact owned watcher termination semantics.
  • docs/agent-control.md: Fork seat relaunch policy; upstream per-mate account selection. Decision: Describe both policies with account pin checked before stopping the live agent.
  • docs/configuration.md: Fork seat sections and ticket timeout; upstream per-mate pins and remote convergence settings. Decision: Keep all sections, place per-mate pins under worker accounts before the seat sections, and retain all timeout entries.
  • tests/fm-control-relaunch.test.sh: Fork fixture cleanup and seat regressions; upstream account and away-admission regressions. Decision: Keep fixture-scoped cleanup and all regression calls; extend the changed-pin case to check trust in the new store and the separate account record; add named-seat → pin → unpin continuity coverage.
  • tests/fm-crew-state.test.sh: Fork no-fork metadata parsing test; upstream override-identity tests. Decision: Keep both test bodies and calls, plus upstream positive daemon-status cases.
  • tests/fm-pr-merge.test.sh: Fork named-case local selector; upstream GitLab waiver test definitions. Decision: Place upstream definitions before the named-case selector and retain every case.
  • tests/fm-supervision-host.test.sh: Fork split helper/suite layout; upstream snapshot-aware offer fixture. Decision: Update the shared supervision-host-helpers.sh implementation and retain its split consumers rather than duplicate the helper in one suite.
  • tests/fm-teardown.test.sh: Fork collision/released-claim cases; upstream Polytoken cleanup cases. Decision: Keep all regression calls.
  • tests/fm-watch-triage.test.sh: Fork split classifier/stale/delivery suites; upstream unsplit suite with four new operator-guard cases. Decision: Keep the split and move only new guard fixtures/cases into fm-watch-triage-stale.test.sh; do not resurrect duplicated legacy test bodies.

Additional integration and verification decisions

  • Preserve fork teardown, merge, push, worktree ownership/isolation, and exact-owned watcher termination guards. GitLab no-pipeline waiver remains explicit, attended-only, GitLab-only, and only accepts an explicit null pipeline; default and existing-pipeline safety checks remain in force.
  • Existing pull-request CI selects subsets and cannot prove the requested full suite. Add a manual CI workflow trigger using the existing full-suite fallback, so the feature head can run every required lane before landing; document that entry point. No local full suite or real Herdr lifecycle run is authorized.

Account-pin follow-up from hosted validation

Hosted serial shard 12 and a local run of tests/fm-control-relaunch.test.sh exposed a defect in the initial bin/fm-spawn.sh resolution: recording WORKER_ACCOUNT_ROOT as claude_seat makes a removed account pin persist through the named-seat continuity path. The existing pin-then-unpin case fails because the replacement still receives the old CLAUDE_CONFIG_DIR.

Firstmate authorized the resolution in steering message 003: preserve the pin as the effective launch, trust, and lock profile while set, but keep its record separate from durable named-seat identity, so removing the pin restores ordinary unpinned selection and genuine named seats retain continuity. Pipeline commit 5461cf84c2007f3b2abf282cb04077b4b81fc8d0 implemented this separation in bin/fm-spawn.sh, removed the earlier equality-clearing workaround from spawn/control, updated the documentation and account-record assertion, and added test_named_seat_survives_a_worker_account_pin. The entire relaunch suite passed; the new regression failed against the old code and passed with the fix. The correction is published, and the fresh full hosted run on that exact head passed. The neighboring tests/fm-worker-account.test.sh and tests/fm-seat.test.sh subsequently finished with exit 0 and no failing cases.

Base-update conflict decisions

The pipeline rebuilt the upstream merge onto fork base d225841b, preserving all 19 upstream ancestors and replaying the existing fixes. Two additional overlaps were resolved by composing both behaviors:

  • bin/fm-spawn.sh: the newer fork replaced the ticket-sync start hook with fm-task-event.sh "$ID" started; retain that task-event hook and the upstream Herdr project-group sync that follows it.
  • docs/configuration.md: the newer fork replaced FM_TICKET_SYNC_TIMEOUT with FM_TASK_EVENT_TIMEOUT; retain the new timeout plus upstream FM_SECONDMATE_CONVERGENCE_TIMEOUT and FM_REMOTE_INHERIT_PUSH_JOBS.

The nine affected suites passed in the pipeline; final full hosted CI also passed.

thelad-dev and others added 25 commits October 16, 2026 19:18
…ts view (kunchenguid#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check
…guid#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <[email protected]>
* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to kunchenguid#5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct
…kunchenguid#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes kunchenguid#6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder
* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation
…mand loads them (kunchenguid#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes kunchenguid#5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them
* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation
)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab04), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change

* no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions

* no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…ne (kunchenguid#7450)

Port the reported-check fallback and regressions from df60538. Preserve required-only reporting when required checks exist and refuse failed fallback reads.
* fix(tests): clean read-only relaunch fixtures

Use the shared fixture cleanup so generated read-only Git hook directories do not leave permission errors and temporary trees behind.

* fix(accounts): support durable per-secondmate account pins

Resolve optional primary-home secondmate account files through the worker pin parser and checks. Preserve existing defaults when no override exists and re-read the selected pin on spawn, relaunch, and recovery.

* no-mistakes(review): Name the rejected pin file in account refusals

* no-mistakes(document): Document per-secondmate account pins in relaunch and layout docs
…unchenguid#6958)

* feat(watch): consult opt-in operator guards before a wedge escalation

Add config/wedge-evidence-guards, an opt-in list of operator-owned guard
executables that the watcher's at-threshold wedge branch consults after the
wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL
answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX
consecutive deferrals recorded beside the other wedge-window records, and
the escalation that ends a capped run names the guard and its reason.
Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an
untrusted config or guard is never run. With the config absent the ladder is
unchanged.

Refs kunchenguid#6919

* no-mistakes(document): Document wedge-evidence-guards in home layout index

* no-mistakes(document): Align jev-guards CRITICAL verdict with bounded deferral
…guid#7460)

* fix(bin): make the brief's inbox listing succeed on an empty inbox

The worker brief told crewmates to list the inbox with a bare *.msg glob.
On an empty inbox that glob fails: bash ls exits 2 and zsh aborts with
'no matches found'. Use find piped to sort -V so the listing is silent on an
empty or absent inbox and keeps numeric order past 999.

Refs kunchenguid#7244

* no-mistakes(review): Make relaunch note inbox listing safe when empty
…unchenguid#7394)

* fix(bin): fit remote second-mate convergence inside the startup network bound

The deferred startup network stage (120s) timed out once four second mates
were remote: the mates already converge concurrently, but each mate's
inheritance push sent its fifteen allowlisted items one SSH round trip after
another, so a single mate's convergence took 64-76s after a ~16s liveness
pass.

- fm-remote-inherit-push.sh validates and snapshots every item locally first,
  so a local refusal now sends nothing, then sends the items up to
  FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in
  allowlist order. A failed item still fails the push with its own error, and
  no further item is started after it. The receiver is unchanged: each item is
  its own file and generation record, and the host's job worker still runs one
  home's commands one at a time.
- fm-bootstrap.sh gives each remote mate's convergence its own budget,
  FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push
  hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry
  marker, instead of holding the whole stage past its bound.

* fix(bin): nudge a remote second mate to re-read only when something changed

Each remote convergence attempt records its retry marker before it starts,
so a sweep cut off by the startup network bound or failing before any change
left a marker that made the next session start nudge every remote mate even
though its instructions and inherited files were unchanged. The marker now
records whether a re-read is owed, set only once an attempt actually changed
the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/,
or .agents/skills/ no longer counts as a change.

* fix(bin): keep a remote mate's re-read owed when its convergence is cut short

A convergence step stopped by the per-mate budget loses its output, so a
push that had already applied an item reported nothing and left the retry
marker with no re-read owed; the next start then saw every item unchanged
and never told the mate to re-read. A step cut off by the budget now marks
the re-read owed, and so does a failed push whose output shows items it had
already pushed or removed.

The lifecycle e2e suite runs every remote leg through the real entrypoint
and job worker on the test machine, so it now gives convergence ample time;
the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose
budget and failure cases are also made independent of machine load.

* no-mistakes(review): Keep re-read owed on partial or unknown completion

* no-mistakes(review): Persist owed re-read when killed mid-mutation

* no-mistakes(document): Fix stale remote re-read owed docs

* test: send inherited items one at a time in the remote lifecycle e2e fixture

Behavior portable serial 5 failed on the watcher auto-relaunch leg of
tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push
started overlapping its sends. Across 14 recent main CI runs that suite's
remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close
to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range,
while legs that push nothing were only 5-10% slower. The watcher relaunch is a
remote spawn, and the only changed code on that path is the inheritance push.

This fixture's transport has no network latency and its job worker runs one
home's commands one at a time, so overlapping sends cannot hide any round trip
there and only add submission overhead to every remote spawn. The suite now
sends one item at a time, as it did before; the overlapped scheduler stays
covered by tests/fm-bootstrap-network-parallel.test.sh, and the production
default of four is unchanged. The watcher leg's failure now also prints the
watcher's output.

* no-mistakes(document): Clarify remote re-read obligations and consolidate documentation

* fix(bin): record a remote mate's re-read as owed before convergence can change its home

A live run against a real remote second-mate home showed the owed re-read
still lost when the startup network bound stopped the stage. That bound
stops it the way `timeout -k 1` does: TERM to the stage's process group, then
KILL one second later. Bash defers a TERM trap while the convergence worker
waits in a command substitution, and the remote call runs in its own timed
process group, so the KILL landed before the trap could record the re-read.
The remote home had already applied the change, the next start saw every item
unchanged, sent nothing, and deleted the marker, so the mate was never told
to re-read.

Bootstrap convergence and config-push now write the record owed before any
remote step can change the home, and write it back only after the attempt has
reported: removed after confirmed unchanged convergence or a successful send,
and back to owed=0 when a failed attempt's outcome proves nothing changed. A
kill at any point therefore leaves the re-read owed. The TERM/INT traps are
gone. The kill regression now sends TERM and then KILL one second later, as
the startup bound does; it fails on the previous head and passes here.

* no-mistakes(document): Clarify convergence timeout scope and consolidate reread documentation
…d#6987)

* fix(bin): refuse spawn into a project with an unborn HEAD

Spawn into a repository with no commit waited 60s for treehouse and then reported that the worktree was the spawning project itself, never naming the cause. Refuse before the wait and name the unborn HEAD and the remedy. The project-management skill now states that a new local repository needs a first commit.

* docs(skills): tell the captain a new project needs a first commit

The Create a project step no longer reads as firstmate committing into the project. It states that spawn refuses an unborn HEAD and that the captain is told the project needs a first commit.

* test: give spawn fixtures a first commit for the unborn-HEAD refusal

* no-mistakes(review): Commit foreign consent fixture so spawn guard passes
…log items for GitLab MRs (kunchenguid#7462)

* feat(bin): add an attended GitLab --allow-no-pipeline merge waiver

A GitLab repository that deliberately runs no merge request pipeline could
never be merged through fm-pr-merge.sh: the guard requires a successful head
pipeline at the current head, and GitLab has no per-check waiver.

--allow-no-pipeline waives only the pipeline condition, and only when GitLab
reports head_pipeline as present and null. A failed, running, canceled, or
stale pipeline still refuses, every other condition (open, mergeable
detailed_merge_status, no conflicts, discussions resolved) still holds, and
the verified head is still passed to glab as --sha. The flag is attended-only
(refused while the away-posture record exists), GitLab-only, and takes no
value; without it the default refusal is unchanged.

* fix(bin): close a GitLab merge request task's backlog item with a note

tasks-axi accepts a --pr link only as a GitHub or Forgejo pull request, so
after a GitLab merge request landed, teardown could never complete the
backlog Done transition and left the close pending forever.

Extend the existing Gerrit carve-out in fm_backlog_done and
fm_backlog_retain, and the captain-hold answer replay that shares it, to
record a GitLab merge request URL as a "GitLab merge request <url>" note,
until tasks-axi accepts GitLab merge request URLs. GitHub and Forgejo pull
requests are still recorded as pr links.

* no-mistakes(document): Note GitLab --allow-no-pipeline waiver in merge-watch record
## Commits taken

- d20196a feat(herdr): opt-in project groups with status tags and a sorted agents view (kunchenguid#7434)
- ce69740 fix(bin): pin LC_ALL=C for remote job process identity reads (kunchenguid#7410)
- 64dddf6 fix(opencode): ignore child stdin EPIPE in guard and encoder (kunchenguid#7447)
- 11becbb fix(bin): ignore crew state overrides for other tasks (kunchenguid#5881)
- eeeeb91 fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (kunchenguid#7415)
- 66c300b feat: support version URLs for watched tool updates (kunchenguid#7449)
- 3094475 fix(pi): keep a live session's extension markers when a nested Pi command loads them (kunchenguid#7287)
- f05b628 fix: reclaim orphaned Claude auto-arm claims (kunchenguid#5939)
- c4f4333 feat(bin): add Polytoken crewmate/scout worker adapter (kunchenguid#7321)
- 11990a2 Fix away branch relaunch admission (kunchenguid#7444)
- 56074d0 fix(bin): show reported checks when a pull request's base requires none (kunchenguid#7450)
- 0791268 fix: support durable per-secondmate account pins (kunchenguid#7452)
- 4e6b9f5 feat(bin): consult operator evidence guards before wedge escalation (kunchenguid#6958)
- c7b7798 fix(bin): make inbox listing succeed when the inbox is empty (kunchenguid#7460)
- 63fc5eb fix: bound remote secondmate convergence and preserve owed re-reads (kunchenguid#7394)
- 8ba34f1 fix: require positive daemon running status in crew-state (kunchenguid#7317)
- 1aa2a21 fix(tests): stabilize supervision host drain and offer fixtures (kunchenguid#7467)
- 69f9d09 fix(bin): refuse spawn into a project with an unborn HEAD (kunchenguid#6987)
- 45dd50a feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs (kunchenguid#7462)

## Conflict decisions

- `.agents/skills/operational-home-layout/SKILL.md`: Fork seat configuration; upstream per-secondmate account configuration. Decision: Keep both configuration entries.
- `bin/backends/herdr.sh`: Fork send-failure/recovery semantics and harness variable; upstream Polytoken busy override. Decision: Keep fork send-failed and recovery handling; add Polytoken busy identity without losing the fork harness variable.
- `bin/fm-backlog-transition-lib.sh`: Fork cached library directory; upstream GitLab completion support. Decision: Keep cached source path and extend forge ownership comment to GitLab; accept GitLab completion path.
- `bin/fm-config-inherit-lib.sh`: Fork Claude/Codex seat inheritance; upstream Herdr project groups. Decision: Union the allowlist; per-secondmate account pins remain local to the primary home.
- `bin/fm-control.sh`: Fork pre-stop seat checks; upstream per-mate pins and Polytoken launch checks. Decision: Select the per-mate pin while retaining its returned account for seat conflict validation; keep all Polytoken pre-stop checks. A valid explicit pin supersedes the old recorded Claude store on relaunch.
- `bin/fm-harness.sh`: Fork in-process HARNESS_VERDICT result; upstream echo-based Polytoken detection. Decision: Add Polytoken through the fork verdict convention, retaining existing adapter detection.
- `bin/fm-lock.sh`: Fork handover reservation and runtime publication; upstream session re-anchor lease/auto-arm locks. Decision: Share the existing claim lock and release helper, add lease/auto-arm locking, then publish runtime and clear an admitted handover before releasing locks.
- `bin/fm-pr-state.sh`: Fork shared required-check evaluator from dbe11b1 and 91371c8; upstream 56074d0 adds a second gh pr checks fallback. Decision: Keep one evaluator through fm-pr-checks.sh and fm-pr-checks-lib.sh. It already checks non-advisory reported checks on unprotected bases, includes missing configured requirements, and fails closed on read errors. Adapt upstream regressions to this API; preserve the fork REQUIRED CHECK label and advisory policy.
- `bin/fm-spawn.sh`: Fork parked-session resume, seats, unclaimed-worktree guard and ticket hook; upstream Polytoken, per-mate accounts and Herdr groups. Decision: Compose both paths, retain validate_spawn_worktree_unclaimed, seat gates, profile trust and metadata, and both hooks. Extend pin/seat refusal to the selected per-mate pin while retaining the primary-home seat guard. The selected durable Claude pin owns trust and recorded store on relaunch so old seats cannot override it.
- `bin/fm-teardown.sh`: Fork merged-at/park record cleanup and isolation protections; upstream generated Polytoken wiring cleanup. Decision: Keep fork cleanup and guards; add only task-owned Polytoken files and generated untracked wiring to existing guarded teardown.
- `bin/fm-test-run.sh`: Fork timing entries and pipeline-spend suite; upstream Herdr-group and Polytoken suites. Decision: Union suite entries, preserve fork timing measurements for existing suites.
- `bin/fm-wake-lib.sh`: Fork single-read auto-arm ledger parser; upstream session-owner identity fields. Decision: Extend the single-read parser with owner_session_id and the third-line lock identity; retain orphan recovery and lease logic.
- `bin/fm-watch.sh`: Fork bounded run-activity deferral and escalation wording; upstream operator evidence guard. Decision: Keep both bounded deferrals and append operator guard evidence to both ordinary and deep-inspection escalations. Keep exact owned watcher termination semantics.
- `docs/agent-control.md`: Fork seat relaunch policy; upstream per-mate account selection. Decision: Describe both policies with account pin checked before stopping the live agent.
- `docs/configuration.md`: Fork seat sections and ticket timeout; upstream per-mate pins and remote convergence settings. Decision: Keep all sections, place per-mate pins under worker accounts before the seat sections, and retain all timeout entries.
- `tests/fm-control-relaunch.test.sh`: Fork fixture cleanup and seat regressions; upstream account and away-admission regressions. Decision: Keep fixture-scoped cleanup and all regression calls; extend the changed-pin case to check trust in the new store and recorded profile.
- `tests/fm-crew-state.test.sh`: Fork no-fork metadata parsing test; upstream override-identity tests. Decision: Keep both test bodies and calls, plus upstream positive daemon-status cases.
- `tests/fm-pr-merge.test.sh`: Fork named-case local selector; upstream GitLab waiver test definitions. Decision: Place upstream definitions before the named-case selector and retain every case.
- `tests/fm-supervision-host.test.sh`: Fork split helper/suite layout; upstream snapshot-aware offer fixture. Decision: Update the shared supervision-host-helpers.sh implementation and retain its split consumers rather than duplicate the helper in one suite.
- `tests/fm-teardown.test.sh`: Fork collision/released-claim cases; upstream Polytoken cleanup cases. Decision: Keep all regression calls.
- `tests/fm-watch-triage.test.sh`: Fork split classifier/stale/delivery suites; upstream unsplit suite with four new operator-guard cases. Decision: Keep the split and move only new guard fixtures/cases into fm-watch-triage-stale.test.sh; do not resurrect duplicated legacy test bodies.

## Additional integration and verification decisions

- Preserve fork teardown, merge, push, worktree ownership/isolation, and exact-owned watcher termination guards. GitLab no-pipeline waiver remains explicit, attended-only, GitLab-only, and only accepts an explicit null pipeline; default and existing-pipeline safety checks remain in force.
- Existing pull-request CI selects subsets and cannot prove the requested full suite. Add a manual CI workflow trigger using the existing full-suite fallback, so the feature head can run every required lane before landing; document that entry point. No local full suite or real Herdr lifecycle run is authorized.
…s, plus one doc line. The "PR must be raised via no-mistakes" check needs no code change. 1. Shard 12, `tests/fm-control-relaunch.test.sh`, "an unpinned replacement must launch exactly as before": a real merge conflict, reproduced locally. - **Cause:** when a Claude account pin applies, the fork saves the pin's directory as the task's recorded Claude profile (`claude_seat`). A relaunch without `--seat` reuses that recorded profile. So after the pin was removed, the replacement still launched under the old pin directory (`CLAUDE_CONFIG_DIR=<old pin>`). - **Rule that must hold:** a Claude profile recorded only because of a pin must not outlive the pin. - **Where it applies:** both places that read the recorded Claude profile on relaunch. - `bin/fm-spawn.sh`: the launch owner sets `RELAUNCH_SEAT`. - `bin/fm-control.sh` (`resolve_relaunch_profile`): checks the profile before the old agent is stopped. - **Fix:** both now ignore a recorded `claude_seat` that equals the task's recorded `account` (the pin's directory). - **What stays the same:** profiles chosen with `--seat` are still kept. An active pin still overrides the recorded profile, and a changed pin is still followed. - **Docs:** updated the matching line in `docs/agent-control.md`. 2. Shard 8, `tests/fm-watch-triage-delivery.test.sh`, "re-arm 4 never captured the pane": a flaky test, not caused by this change. - **Cause:** the fake `tmux` empties its tick counter file and then rewrites it. Stopping the watcher doesn't stop that child process, so the test sometimes read an empty file (`[: : integer expression expected`). - **Fix:** the fake now writes to a temp file and renames it into place, so the counter is never read empty. 3. "PR must be raised via no-mistakes": fails because the attestation records that the test step was approved over a failing test command (exit 124). The user already declined fixing that in test round 2, so no code change is warranted. It stays red until `test.allow_approve_over_failure` is set in the default-branch `.no-mistakes.yaml`, or until the PR is re-attested. **Verification:** run locally on macOS with `CLAUDE_CONFIG_DIR` unset. These files passed with no failures: `fm-control-relaunch`, `fm-watch-triage-delivery`, `fm-seat`, `fm-worker-account`, `fm-worker-account-live-e2e`. `shellcheck -x -S warning` is clean on the changed scripts. I didn't rerun the other serial shards
@max-metaplanet max-metaplanet added the fm-ci-validated Deliberately validated by this repository CI instead of the local no-mistakes pipeline label Oct 19, 2026
@max-metaplanet
max-metaplanet merged commit 999fef7 into main Oct 19, 2026
52 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fm-ci-validated Deliberately validated by this repository CI instead of the local no-mistakes pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.