Skip to content

upstream sync 2026-11-29 - #26

Merged
screamyx merged 21 commits into
mainfrom
fm/fm-upstream-sync-1128
Nov 29, 2026
Merged

screamyx merged 21 commits into
mainfrom
fm/fm-upstream-sync-1128

Conversation

@screamyx

@screamyx screamyx commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

WAITS FOR THE OWNER: sign-in and credential changes

Two upstream commits touch sign-in or credentials, so this PR is not to be merged on green checks alone.

Range

Upstream main as fetched, 19 commits through fe93901 (the intake mail said 14, through 30dae60).
Merge commit, upstream history kept; fetched by URL only, no upstream remote.

Conflicts and how each was settled

  • bin/fm-harness.sh (ancestry_names_omp): took upstream's HARNESS_ANCESTRY_HOPS loop and kept our fork change ps -ww (c302bcb, unlimited ps width), which the rest of the file still uses. Matches neither side exactly: upstream loop plus our -ww.
  • bin/fm-watch.sh (two places): kept ours. Our line also clears .wedge-raised-$key with the model-stream marker (fork change e3a4f1b); upstream's fm_rm_present would have dropped that.
  • bin/fm-spawn.sh (header comment): combined both: "model, effort, fast mode, and a declared Claude or Codex account". Comment only.
  • docs/configuration.md (worker permissions row): kept both added links, our "Claude worker tool scope" and upstream's "several Codex accounts".
    Auto-merged files were not touched by hand. No fork change was dropped.

Running pieces changed

AGENTS.md, bin/ (spawn, control, harness, watcher, wake, classify, busy, composer, pr-check, teardown, fleet snapshot, bearings, new account-quota libs), .agents/skills/, the .claude firstmate-calm mod, .pi and .omp extensions. Running firstmates need a restart to pick this up (not restarted here).

Tests

No CI checks exist on this fork, so nothing will report green. Local result below.
Full CI lane composition run locally: both parallel lanes, plus all 19 serial shards (shards 1-5 and 6-19, one at a time).
62 scripts failed at least once. I re-ran every one of them on a copy of the pre-merge main (3e90b85) in the same environment:

  • 57 fail on the pre-merge main too. Causes seen: shared /tmp/fm-* task directories owned by another user, ruby not installed, host load/process-ancestry sensitivity. They are not caused by this merge.
  • 5 failed once on the merge but passed on base. On re-run: fm-agy-primary, fm-codex-stop-park and fm-supervision-host pass on the merge (load flakes); fm-gemini-harness and fm-remote-job fail on both merge and base on re-run (same failure).
    Result: no failure found that the merge introduces. fm-lint.test and fm-test-run.test are among the 57 that fail identically on base.
    The one pipeline fix commit (c387ea6) widens a poll window in tests/fm-pr-check-security.test.sh; that test failed identically on base. This file is otherwise upstream-identical; drop the commit if you prefer.
    Lint step: heavy-file shellcheck runs were killed by TERM on the loaded box (exit 143); one info-level SC2086 in an upstream-identical test file.

Upstream review notes (not changed here)

Review decisions: all five ask-user findings skipped, no code change. These are upstream's own code, kept identical to upstream:

  • abort-absorb-status-scope (bin/fm-classify-lib.sh): the abort exception also applies to status-only signals.
  • captain-hold-restart-deduplication (bin/fm-watch.sh): a restart between queuing a due reminder and publishing its ledger can queue it twice.
  • secondmate-summary-byte-regression (bin/fm-fleet-snapshot.sh): full queued titles can push a secondmate summary past its byte cap.
    Also decided: take upstream as fetched (19 commits); the merge waits for the owner (sign-in change).
    The nine auto-fix review findings (Codex raw-launch HOME mismatch, abort wake busy evidence, pause PR parsing and snapshot race, omp double consumption, Pi auth wrap, Claude composer wrap, spaceship warp direction, codex-stop-park test oracle) are likewise upstream code, left unchanged.

Intent

Mail from the firstmate-upstream-check job, 29 Nov 04:30, word for word:

agent-001 for the owner (daily upstream check, owner order 22 Nov 02:38): kunchenguid/firstmate main has 14 commits that screamyx/firstmate main lacks (latest 30dae60, 2026-11-28T16:07:46Z). Merge upstream main into screamyx/firstmate as one PR titled 'upstream sync '. Keep our own changes where they conflict and list each conflict and how you settled it in the PR body. Run the full test suite. Merge when checks pass, unless the merge changes sign-in or security: then it waits for the owner. After the merge, pull ~/git/firstmate, and say whether the running firstmates need a restart (do not restart either without agent-001).

What Changed

  • Merges kunchenguid/firstmate main into this fork. This adds bin/fm-account-quota-lib.sh and bin/fm-codex-account-quota.sh, with the Claude quota script and fm-worker-account-lib.sh reworked to use the shared library. It also changes the Rex backend (bin/backends/rex.sh) and fm-spawn.sh, fm-teardown.sh, fm-harness.sh and fm-control.sh.
  • Changes supervision and watching in fm-watch.sh, fm-classify-lib.sh, fm-busy-lib.sh, fm-wake-lib.sh, fm-pr-check.sh and the bearings snapshot and board scripts. The Pi calm extension gains a new working-spaceship renderer (.pi/extensions/lib/fm-calm-working-spaceship.ts), and the OMP watch extension and the firstmate-calm mod are updated.
  • Updates the docs and skills to match, and adds or extends shell tests. The new tests are fm-codex-account-quota and fm-watch-beacon-progress, and fm-calm-pi-extension, fm-backend-rex and fm-worker-account are extended.

Risk Assessment

🚨 High: The merge changes Codex sign-in and requires owner approval, and the reviewed code can launch under the wrong account or suppress actionable watcher wakes.

Testing

I re-ran the one suite that failed last round, tests/fm-pr-check-security.test.sh, on the target commit. It exited 0 with 92 ok results. The teardown-race test, which only prints on failure, did not fail, so refused cleanup no longer removes persisted merge authority in that run. I did not re-drive the other three scenarios from round 1, and I did not run the full repository suite.

  • Live validation: ✅ go - 1 of 1 scenarios driven live against the product
Scenario Result Live Evidence
Merge authority survives a teardown race: concurrent cleanup during an active merge poll must not remove or downgrade persisted authority (existing test test_teardown_cannot_race_authority_consumption… ✅ pass live pr-check-security.log: full suite exit 0, 92 ok, 0 failures
Evidence: PR-check security suite log

Source: PR-check security suite log

ok - raw-byte parser accepts canonical URLs and rejects the complete adversarial matrix
ok - GitHub Enterprise config resolves override, home, then the library code root
ok - GitHub Enterprise hosts are accepted only when the home names them and their host reaches every forge call
ok - GitLab merge requests are followed on any instance and never wake falsely
ok - arming baselines an already degraded change so only a later failure wakes
ok - arming records its baseline, including an on-train merge request, before publishing the poll
ok - a stalled baseline read fails arming without a lock or poll
ok - a stalled re-arm leaves the previous watch and metadata intact
ok - an unreadable baseline read permits arming with an unknown baseline
ok - the merge-time re-record skips the baseline read and keeps the watch's marker
ok - Forgejo poll reads one pull request by number through tea api and wakes only on merged true
ok - Forgejo login match parses tea's JSON in every line shape, in the helper and the static poll
ok - the Gerrit watch wakes only on an explicit merged status and never on submittability
ok - Gerrit arming records no patch set revision and the merge path refuses to submit
ok - Gerrit arming accepts a published HEAD only by the change's current patch set tree
ok - a no-mistakes Gerrit ready report requires the pipeline's fixes recovered into the published copy
ok - validated merged polls notify once and retire before the next watcher cycle
ok - a repeat identical merged poll for an already-notified task is absorbed, never queued as a main-blocking row
ok - a failed upward merge report keeps its poll armed for repair and retry
ok - a lane merged through bin/fm-pr-merge.sh is still cleaned up when its poll sees the merge
ok - a failed cleanup queue keeps the merged poll armed until cleanup retries
ok - staged self-merge and poll interleavings are never silent
ok - queued merges retain their away authority after captain return
ok - poll distinguishes attended authorization from external landing
ok - accepted merge authority refuses rebound task metadata
ok - accepted merge authority persists under the lifecycle lock
ok - teardown cannot race merged-poll authority consumption
ok - poll retirement preserves a replacement authority record
ok - a merge detected by the poll is reported upward from a secondmate home exactly once
ok - a different merged PR for the same task gets its own first notification
ok - a merged poll on a persistent secondmate retires silently: no outcome, marker, or wake, and every lifecycle artifact preserved
ok - queue, receipt, and every fixed-path removal crash point recover without loss or repeated execution
ok - open/red, closed-unmerged, malformed, and forge errors remain armed until an exact merged transition
ok - replacement, nonterminal, tampered, and custom results receive no deletion authority
ok - queue failure and untrusted receipts preserve canonical poll evidence
ok - GitHub and GitLab exact merged results share one retirement path
ok - PR and teardown entrypoints reject invalid arguments before every side effect
ok - arming refuses a draft pull request, naming it, and arms a ready or unreadable one
ok - fm-pr-check refuses to record a PR or arm a merge watch on a secondmate record
ok - fm-pr-check refuses to register a PR whose named head is only in the worker copy
ok - fm-pr-check refuses a direct-PR registration while a later commit is only in the copy
ok - the merge-time re-record refreshes before refusing: origin's unfetched head is accepted, an unpushed one refused
ok - the scan records the PR a done line reports and leaves prose, scouts and recorded PRs alone
ok - the scan reports a refused registration once and records the PR on a later retry
ok - the scan retries a refused task within two sweeps despite a hanging registration
ok - the scan starts a later sweep at a different task so a hanging registration cannot starve it
ok - a scan bounds its registrations' remote refresh by its budget and hands the next sweep to the task it never started
ok - the scan publishes the poll of a task whose pr= has none
ok - the scan keeps a PR the supervisor recorded during its registration
ok - the scan leaves a merged task's retired poll alone
ok - the scan arms a replacement PR despite an older PR's merge marker
ok - the scan registers nothing from a non-canonical or superseded done line
ok - the scan reads the ready line past supervisor annotations, on each ready shape
ok - the scan reads the ready line past a wait on the same PR, and only that wait
ok - a replacement PR on a newer ready line takes over pr= and the merge poll
ok - a failed scan replacement restores the previous watch without degraded watching
ok - the scan keeps a recorded PR the status log never named
ok - the scan does not replace a PR whose merge was already reported
ok - a merge record holding its lock blocks the scan from replacing that PR
ok - a scan keeps the recorded PR when its ready status is withdrawn during forge reads
ok - a replacement keeps the current watch when refused and yields to a PR recorded meanwhile
ok - a timed-out registration publishes one notice, retries, and clears on success
ok - a timeout or refusal notice stays owed until its wake is durably queued, then is queued once
ok - a timeout that lands after the cleanup trap is still reported as a timeout
ok - the watcher durably queues a scan cut at its check bound, once
ok - the watcher sweep scans only with config/pr-register-scan present, then records a reported PR and queues a refusal or a timeout
ok - valid direct and merge flows record exact metadata and reject multiline head metadata
ok - rejected metacharacter bytes remain inert at generation and watcher time
ok - static poll is silent except for one merged line and remains watcher-bounded
ok - degraded wake reads are opt-in; absent flag keeps GitHub and GitLab polls merged-only, silent, and baseline-free
ok - watcher refreshes the degraded-watch flag each sweep and drops disabled poll results
ok - a degraded-watch flag only in a home reached through FM_ROOT_OVERRIDE arms the baseline and wakes
ok - GitHub poll emits one degraded line per failing rollup and stays silent otherwise
ok - a degraded ready PR wakes once per head/pipeline transition and stays silent on a repeat
ok - a degraded wake is queued before its dedupe marker, so a failed marker save never silences it
ok - partial poll publication failure restores the prior watch and registered file identities
ok - TERM during PR registration restores the old poll and its registered identities
ok - interrupted atomic preparation cleans private temporaries and publishes nothing
ok - concurrent watchers observe only complete private poll publications
ok - poll publication paths refuse symlinks and directories
ok - live poll and custom-check artifacts require private single-link files
ok - registered generations survive template updates and relaunch metadata without executing sidecar code or trusting forged bytes
ok - a poll armed before a volume renumber is re-recorded under the control lock and keeps detecting merges
ok - a renumbered registration is never re-recorded around a tampered artifact: swapped-check altered-check swapped-sidecar altered-sidecar altered-template-hash wrong-mode hardlinked-check split-device foreign-device, or a pending retirement
ok - direct re-arm publication waits without replacing an armed poll
ok - device re-record publication waits without rewriting its registration
ok - post-rename poll validation faults revoke both names and allow a clean retry
ok - bootstrap does not rewrite unauthenticated checks or emit retired migration diagnostics
ok - watcher signals promptly stop custom checks and clean private state
ok - returned custom check descendants are drained on installed and fallback timeout paths
ok - a timed-out custom check surfaces its timeout and earlier output on installed and fallback timeout paths
ok - teardown refuses unsafe degraded and train markers before lifecycle cleanup
  • Outcome: 🔧 2 issues found → auto-fixed ✅ across 2 runs (30m52s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 14 issues (3 errors, 11 warnings)
  • 🚨 bin/fm-worker-account-lib.sh:360 - The intent says, “Merge when checks pass, unless the merge changes sign-in or security: then it waits for the owner.” This change adds codex login status for declared accounts and changes the credentials passed to Codex workers. Hold the merge for explicit owner approval even if checks pass. The launch behavior is at bin/fm-spawn.sh:7972 and the account policy is at docs/configuration.md:1953.
  • ⚠️ bin/fm-watch.sh:3150 - The intake reported “14 commits” through 30dae608. The merge instead takes 19 through fe939017, including new dated reminders, Pi launch classification, and Rex placement changes. Confirm whether this sync should deliver the later five commits or leave them for the next sync. I recommend confirming the range before approving the sign-in changes.
  • 🚨 bin/fm-worker-account-lib.sh:486 - A Codex ship launched with --account ordinary and a supported raw command that sets HOME passes the sign-in check against the caller’s ordinary account, then opens Codex against the raw command’s different ~/.codex. The task still records account=ordinary, so quota selection and billing can refer to different accounts. Enforce the same effective home at account selection and launch, or refuse raw launches whose credential source cannot be verified. The check uses the caller’s HOME at bin/fm-worker-account-lib.sh:320, raw commands pass through at bin/fm-spawn.sh:3342, and the ordinary launch only unsets CODEX_HOME at bin/fm-spawn.sh:7977.
  • 🚨 bin/fm-classify-lib.sh:3014 - After an abort, the watcher can read a busy record from before the abort, then read a newer idle record’s timestamp and suppress the wake. The helper also calls the classifier without a pane tail, so a relaunch stuck on trust or Pi sign-in can qualify using only its fm-spawn seed. Require a single validated observation that supplies both the busy verdict and its timestamp, and require evidence of a real turn before absorbing the wake. The shared record reader validates ts but omits it at bin/fm-busy-lib.sh:418, and the launch rejection checks require a tail at bin/fm-busy-lib.sh:1194 and bin/fm-busy-lib.sh:1197. The test at tests/fm-watch-triage.test.sh:725 currently treats the seed alone as sufficient.
  • ⚠️ bin/fm-classify-lib.sh:3089 - The abort exception is documented for a bare turn-end, but the shared predicate also applies it to status-only signals. With the flag enabled, a worker who writes a fresh routine working: update after an abort can have that update silently marked seen under the new exception. No stated requirement extends abort absorption to status files. Remove that acceptance path and apply the exception only to batches eligible as bare turn-ends. The watcher passes mixed inputs at bin/fm-watch.sh:4703 and the scope is documented at docs/configuration.md:1200.
  • ⚠️ bin/fm-pr-check.sh:128 - A pause that names the ready PR as a bare URL and a different PR as a Markdown link passes the scan. Whitespace tokenization misses the second link and the scanner arms the earlier PR’s merge poll despite the documented requirement that every named PR match. Extract each URL independently or reject an ambiguous pause. The same parser decides initial registration at bin/fm-pr-check.sh:163 and replacement at bin/fm-pr-check.sh:491. The mixed-PR fixture at tests/fm-pr-check-security.test.sh:1196 only exercises bare URLs.
  • ⚠️ bin/fm-pr-check.sh:104 - The scanner reads the latest pause from the live status file, then copies the file. If the worker appends working: between those reads, truncating the copy at the old pause discards the new event and registers the earlier PR. Read the latest status and preceding pauses from one snapshot, and recheck readiness before publishing a scan registration. The recheck at bin/fm-pr-check.sh:491 only covers replacement and calls the same inconsistent reader.
  • ⚠️ bin/fm-watch.sh:3188 - A watcher interrupted after queuing a due reminder at bin/fm-watch.sh:3188 and before publishing its ledger at bin/fm-watch.sh:3193 queues the same task and date again after restart. The wake queue allocates a fresh sequence for the same key at bin/fm-wake-lib.sh:2865. The advertised once-across-restarts guarantee requires a durable publication receipt that survives acknowledgement. That added recovery mechanism needs authorization. The restart test at tests/fm-watch-open-decisions.test.sh:376 only restarts after both writes succeed.
  • ⚠️ bin/fm-fleet-snapshot.sh:1141 - Full queued titles and reasons now travel in every secondmate summary. A home close to its configured byte cap can cross it on the next ordinary refresh after several detailed holds, causing Bearings to lose the home’s current work and decisions as well as its queued text. The cap rejects the whole file at bin/fm-fleet-snapshot.sh:1331. Remote homes may fall back to stale data at bin/fm-fleet-snapshot.sh:1852 and local homes become unavailable at bin/fm-fleet-snapshot.sh:1862. Choose how to preserve the live summary and the full-text board together. I recommend keeping core fleet data readable and retrieving full gate text separately when needed. That additional transport needs authorization.
  • ⚠️ .omp/extensions/fm-primary-omp-watch.ts:598 - Both omp start handlers can report the same idle turn. If that turn contains two merged wakes and a third identical wake becomes pending between those events, the second event consumes the new wake using a copy from the earlier turn. Replacement then drops the undelivered wake from its handoff. Count a delivered occurrence once at the appropriate event boundary, and match complete wake segments. Both handlers feed the same matcher at .omp/extensions/fm-primary-omp-watch.ts:1109 and .omp/extensions/fm-primary-omp-watch.ts:1112. The duplicate-event fixture at tests/fm-omp-harness.test.sh:1090 leaves no pending wake to catch this.
  • ⚠️ bin/fm-busy-lib.sh:1079 - On a narrow Pi pane, the credential error can fit while Use /login to log into a provider wraps. The line-based matcher misses the guidance and bin/fm-busy-lib.sh:1201 returns busy fm-spawn for a worker that rejected its brief. Establish the signature across wrapped capture rows while retaining both pieces of evidence. The portable capture at tests/fm-crew-state.test.sh:3446 only supplies unwrapped output.
  • ⚠️ bin/fm-composer-lib.sh:2012 - The named Claude composer fix still refuses a legitimate wrapped draft when a continuation row ends in + or |. For example, a line ending in C++ is treated as a structural edge even when the titled top and closing rules identify the composer. Herdr can still withhold Enter. Use the proven composer bounds for both recognition and extraction. The cursorless extraction loop repeats the broad edge test at bin/fm-composer-lib.sh:2111.
  • ⚠️ .pi/extensions/lib/fm-calm-working-spaceship.ts:74 - The spaceship warp advances two cells in a four-cell cycle, so the dash columns stay fixed and the other cells blink. Left and right shifts give identical frames. Use a pattern whose two-cell shift produces visibly directional motion. The clock is at .pi/extensions/lib/fm-calm-working-spaceship.ts:261. The frame assertion at tests/fm-calm-pi-extension.test.sh:4185 also passes a right-moving or static repeating field. Use the visible leftward movement promised at docs/calm.md:69 as the oracle.
  • ⚠️ tests/fm-codex-stop-park.test.sh:218 - The version test’s capable=0 assertion also matches registered-capable=0, and the refusal assertion at tests/fm-codex-stop-park.test.sh:223 has the same overlap. The test therefore passes if the first probe returns the wrong eligibility result and the second returns the expected one. Assert each complete output line against the eligibility policy in docs/configuration.md:455.
🔧 **Test** - 2 issues found → auto-fixed ✅
  • ℹ️ tests/fm-pr-check-security.test.sh:5223 - tests/fm-pr-check-security.test.sh fails the check 'teardown race: refused cleanup removed persisted authority' on this tree and on base 3e90b85. It predates the merge and is not caused by it.
  • 🚨 live validation verdict: no-go (4 of 4 scenarios were driven live against the product); failed: PR-check security: merge authority survives a teardown race (existing suite)
  • Live validation: ❌ no-go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Codex stop-park watcher keeps one watcher across quiet boundaries and warm-compacts (existing suite run against this worktree) ✅ pass live fm-codex-stop-park.log, exit 0
Watcher captain-hold reminders and open-decisions backlog behave after restart (existing suite) ✅ pass live fm-watch-open-decisions.log, FM_TEST_COMPLETE
Watch triage, busy and wedge-guard handling (existing suite) ✅ pass live fm-watch-triage.log, 86 ok and 0 not ok before the 500s cap
PR-check security: merge authority survives a teardown race (existing suite) ❌ fail live fm-pr-check-security.log, 3 runs on HEAD and 1 run on base 3e90b85 all fail the same check
  • bash tests/fm-codex-stop-park.test.sh (exit 0)
  • bash tests/fm-watch-open-decisions.test.sh (passed, FM_TEST_COMPLETE)
  • bash tests/fm-watch-triage.test.sh (86 ok, 0 not ok, cut off by the 500s cap)
  • bash tests/fm-pr-check-security.test.sh on HEAD and on base 3e90b85f (same single failure)

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

  • Live validation: ✅ go - 1 of 1 scenarios driven live against the product
Scenario Result Live Evidence
Merge authority survives a teardown race: concurrent cleanup during an active merge poll must not remove or downgrade persisted authority (existing test test_teardown_cannot_race_authority_consumption… ✅ pass live pr-check-security.log: full suite exit 0, 92 ok, 0 failures
  • bash tests/fm-pr-check-security.test.sh (full file, exit 0, 92 ok, 0 failures)
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 143)
✅ **Push** - passed

✅ No issues found.

jesstelford and others added 21 commits November 26, 2026 15:16
… lavish board (kunchenguid#6357)

* fix(bearings): show full Charted Next titles and reasons on the lavish board

Charted Next rows on the board clipped their title and reason with an
ellipsis, and the snapshot shortened gate titles before the board saw them.
Charted Next rows now wrap their full text, and the snapshot's new
--fields gate-text opt-in carries untruncated title_full and reason_full
for the board while the chat digest keeps its compact bounds.

* fix(bearings): keep secondmate Charted Next text whole across the home summary

A secondmate's home summary shortened queued titles to 120 characters and
hold or blocked reasons to 160 before the bearings projection saw them, so
--fields gate-text still handed the lavish board clipped text for secondmate
gates. The summary now keeps up to 500 characters for those fields, which
covers any realistic backlog item while 20 bounded rows stay far inside the
summary byte cap. The stock macOS Bash CI lane's pinned Bearings test count
moves to 61 for the gate-text regression.

* no-mistakes(review): Pass secondmate queued title and reasons untruncated

* test(bearings): expect untruncated queued text in the secondmate home summary
…ancels it (kunchenguid#8779)

* fix(bin): exec the herdr lab server launch so a timed-out provision cancels it

On bash builds that keep a subshell for an async function (macOS /bin/bash
3.2, the Linux CI bash), $! of the backgrounded launch was that subshell, so
fm_herdr_lab_cancel_provision left the herdr server running after a timed-out
provision. The launch now execs herdr through fm_herdr_lab_raw_exec, making
$! the server process on every bash; the cancel is unchanged.

The timed-out provision test now asserts, right after the provision returns,
that the launch process is gone, synchronized on the launch recording its pid
instead of a fixed sleep.

Fixes kunchenguid#8775

* no-mistakes(document): Document lab provision timeout cleanup

---------

Co-authored-by: Kun Chen <[email protected]>
…ist (kunchenguid#8457)

* feat(bin): choose a codex account per ship or scout from a declared list

Add config/codex-accounts, the Codex counterpart of config/claude-accounts:
one Codex home per line (ordinary for the default ~/.codex, or an absolute
CODEX_HOME). While the list exists, every Codex ship or scout spawn names one
declared entry with --account, chosen at intake by the quota-array-dispatch
procedure from bin/fm-codex-account-quota.sh rows. The entry is checked with
codex login status in a stripped environment, launched with CODEX_HOME set
(or unset for ordinary) and CODEX_API_KEY and CODEX_ACCESS_TOKEN unset,
recorded as account=, and reused by relaunch unless --account moves it.
Without the list every Codex launch is unchanged and --account refuses.

bin/fm-worker-account-lib.sh now keys the declared list, its root variable,
and its shed credentials by runner, and the per-account quota read moves into
bin/fm-account-quota-lib.sh shared by the Claude and Codex entry points.

* no-mistakes(ci): I fixed both Greptile findings, and the new tests for each fail before the fix and pass after it. ci-1, Codex secondmates (`bin/fm-worker-account-lib.sh`). The rule: a secondmate without its own account pin file (Codex) must never read `config/codex-accounts`. `fm_worker_account_select` now returns early for such a secondmate, right after it refuses an explicit `--account`, and before the list is parsed. So an empty, malformed or unreadable list no longer blocks the launch or a relaunch. I checked the other place that reads the list, `fm_worker_account_relaunch_request`: it already returns before the read when given a secondmate. Ships, scouts, Claude and Pi follow the same path as before. New test: `test_codex_account_list_leaves_secondmates_alone` in `tests/fm-worker-account.test.sh` now writes a malformed `config/codex-accounts` and checks that a Codex secondmate still launches unchanged (exit 0, no `account=`). Before the fix it was refused with "config/codex-accounts must hold one account per line". ci-2, quota timeout (`bin/fm-account-quota-lib.sh`). The rule: each Claude account read must still honor the old `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS`. `fm_account_quota_report` now picks the per-read limit once: `FM_ACCOUNT_QUOTA_SECONDS` first, then `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS` for Claude only, then 60. The old variable is documented in the lib header. New test: `test_the_claude_read_timeout_is_honored` in `tests/fm-claude-account-quota.test.sh` uses a fake quota-axi that takes 3 seconds. With `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS=1` the account is reported unreadable. Adding `FM_ACCOUNT_QUOTA_SECONDS=10` overrides it and the account is measured. Checks: `tests/fm-worker-account.test.sh`, `tests/fm-claude-account-quota.test.sh` and `tests/fm-codex-account-quota.test.sh` all pass, and `shellcheck -x` is clean on the four changed files. I did not reply to or resolve any PR comment
kunchenguid#8708)

* feat(watch): opt-in absorb of turn-ends after an aborted run

An aborted no-mistakes run keeps current state at failed until a fresh run
starts, so every turn-end of a worker that kept working surfaced.
config/turnend-abort-absorb absorbs it only when the run store records an
abort and an exact busy verdict is newer than the run's end.

Fixes kunchenguid#8675

* no-mistakes(document): Document turnend-abort-absorb flag

* fix(watch): match the exact abort errors no-mistakes records

A gate abort fails the run with 'step <name>: aborted by user[: <reason>]'
and 'axi abort' cancels it with 'cancelled: aborted by user'. Match those
errors exactly and no longer treat a run cancelled by a new push as aborted.

* no-mistakes(review): Fix abort-absorb docs for cancelled runs

* fix(watch): take the abort-absorb busy state from the busy-state verdict

* fix(lint): clear ShellCheck findings the new classify sources expose
…guid#8565)

Claude Code 2.1.323+ type-checks the Calm mod without
allowImportingTsExtensions and ignores a plugin tsconfig, so
`claude plugin validate --strict` refused the mod (TS5097 on the
.ts import specifiers) and the mod's test fixtures drifted from the
engine's declarations. Keep the .ts specifiers Node needs behind
@ts-ignore TS5097, update the fixtures (Spinner suffix, UserMessage
isExpanded, fs.stat isLink, ui.blit cells variant), and record the
2.1.326 verification. Runtime behavior is unchanged.

Closes kunchenguid#8558
…d#8174)

* fix(codex): admit Stop-park releases from 0.163.0

* no-mistakes(document): Remove stale Codex version selection claim

* fix(bin): reach a Codex primary from its SessionStart hook depth

Codex publishes no harness marker, so the session start digest identifies a
Codex primary only through the ancestry walk in bin/fm-harness.sh. That walk
examined eight processes, while the installed Codex runs the tracked
SessionStart wrapper nine parents above the digest's harness probe (eleven
and thirteen for the wake drain and guard probes). The digest therefore
reported harness unknown and rendered the generic supervision block, while
the session lock walker, which examines sixteen processes, still named the
Codex session.

The harness walks now share one sixteen-process reach matching
fm_harness_ancestry_pids, so the digest verdict and the lock owner come from
walks of the same reach. Marker and ancestry precedence is unchanged.

The Pi rebuild cases in the session-open suite set only the Pi marker beneath
the suite's long-lived codex fixture, which the shorter walk never reached;
they now run beneath a pi-named process, as a real Pi session's hooks do.

Adds a portable depth regression, a composed SessionStart regression under a
renamed codex process, and a token-free live SessionStart case for the
installed Codex.

* docs(codex): align version policy and ancestry trial scope

* no-mistakes(document): Clarify Codex SessionStart release coverage

* no-mistakes(document): Correct Stop park script reference

* no-mistakes(document): Clarify Codex Stop park and startup coverage
* fix: read a wrapped typed line in a named Claude composer

In a Claude session started with a name, the session title is drawn into
the composer's top rule. A titled top rule was accepted only when the
prompt glyph row sat directly on the closing rule, so typed text that
wrapped onto a second row read unknown and could not be extracted. A
backend that reads back its typed payload before pressing Enter then
withheld Enter: on a pane narrower than the text, the send failed, or
the text stayed in the composer and blocked every later send.

Accept the wrap rows between the glyph row and the closing rule when
they are contiguous, non-blank, edge-free and within
FM_COMPOSER_PI_MAX_LINES. A glyph followed by a blank row or a longer
region before the next rule still reads unknown.

* no-mistakes(document): Document wrapped named Claude composer reads
…guid#8786)

* fix(bin): read the PR scan past a review wait on the same PR

A worker may declare its review wait with a paused: line right after its
ready done: line. The scan treated that wait as a later crew line and never
recorded the PR or armed its merge poll. The scan now reads back over paused:
lines whose every PR URL is the ready PR, while a paused: line naming no PR or
another PR, and any working:, blocked: or failed: line, still stop it.

Fixes kunchenguid#8762

* no-mistakes(review): ignore punctuation around a PR URL in a paused line
…ng home's state (kunchenguid#8785)

fm-teardown.sh ran the retiring home's fm-procevent.sh with only FM_HOME and
FM_ROOT_OVERRIDE, so an inherited FM_STATE_OVERRIDE sent preflight, sweep, and
reconcile to the parent's state root. Retirement then refused on the parent's
directory mode, or swept the parent's own registrations and left the child's.

Pass FM_STATE_OVERRIDE="$home/state" on all three calls, match the docs and
recovery command, and replace the fake sweep test with the real fm-procevent.sh
under a parent override at modes 775 and 700, checking the parent's source and
directory mode stay unchanged.
…d#8769)

* feat(calm): selectable spaceship working presentation via config/calm-ship

Add an optional spaceship variant for Calm's animated working row on Pi,
selected by the local config/calm-ship file.

- Add .pi/extensions/lib/fm-calm-working-spaceship.ts: a persistent banner
  under its own firstmate-calm-working-spaceship widget key, with an idle
  two-row saucer-over-hull rest pose drifting left to right, a single-row
  `=( * )` warp sprite while a run is thinking, a bounded settle ease back
  into the drift, freeze/resume continuity across hide and show, resize
  clamping, narrow fallbacks, and idle crew markers read from the home's
  state records on a slow tick.
- .pi/extensions/fm-calm.ts resolves config/calm-ship with the same
  effective-home and FM_CONFIG_OVERRIDE rules as config/calm, at extension
  load and again on session_start and /calm. Anything other than
  "spaceship", including an absent file, keeps the boat, which stays the
  default. The boat's own presentation path and its shared widget slot with
  standalone Pi Calm are unchanged; the spaceship is dispatched as a
  separate banner that owns its own slot, and a selection switch tears down
  the replaced variant before installing the new one.
- Document the variant in docs/calm.md and the config/calm-ship schema in
  docs/configuration.md.
- Cover selection, rendering, mode, settle, and freeze/resume in
  tests/fm-calm-pi-extension.test.sh, and add the new module to the
  typecheck fixture in tests/fm-pi-primary-types.test.sh.

Supersedes the earlier attempt in kunchenguid#5567, which was
closed unmerged on 2026-10-18 with a branch that had conflicted. This is a
fresh port onto current main, not a revival of that branch.

* no-mistakes(review): Remove crew markers, dead saucer code, fix doc

* no-mistakes(review): Document calm-ship Pi-only scope and trim rule

* no-mistakes(review): Copy spaceship into live e2e; poll drift check

* no-mistakes(review): Tear down spaceship banner on shutdown; map module

* no-mistakes(review): Gate spaceship banner to one agent run

* no-mistakes(review): Share working slot; drop dead spaceship code

* no-mistakes(review): Name both presentation modules in file header

* no-mistakes(document): Align Calm docs with selectable spaceship variant

* feat(pi): keep the spaceship banner for the whole session with idle drift

The selectable spaceship working presentation was scoped to one agent run,
which left Pi's stock working row in place the rest of the session. Make it
ambient: while Calm is active and config/calm-ship selects it, the banner is
installed at session_start and lives until session_shutdown, and the run signal
drives its mode instead of its visibility.

Idle shows the two-row resting pose, a three-cell (|) saucer directly over a
three-cell |^| hull, drifting one column every ~1.5s with a starfield streaming
left past it. A run switches the same banner into the single-row compact
=( * ) warp; the settle relaxes the pose, returns the starfield to the idle
cadence immediately, and eases the pace back into the drift over a bounded
handful of graduated moves.

The boat is unchanged and stays run-scoped. Both presentations still share the
one working-row slot, so a dual Calm install renders one animation and a
presentation another extension installed is left alone.

* no-mistakes(review): Document dual-Calm spaceship exception and tests

* no-mistakes(document): Correct Calm spaceship narrow-fallback wording

* no-mistakes(document): Remove stale spaceship widget-key export

* no-mistakes(document): Align Calm spaceship docs with ambient banner

* test(calm): keep the spaceship harness out of a Bash 3.2 command substitution

Stock macOS Bash 3.2 lexes a heredoc body nested in $(...) as shell text,
so a prose apostrophe inside the JS harness opened shell quoting there and
an unbalanced parenthesis ended the substitution early. The macOS parse
sweep then reported an unrelated later line as an unmatched backtick.

Attach the harness to a group command that redirects to an output file,
the shape every other node harness in this file already uses, and read the
captured output back afterwards. The fixture, the JS harness, and every
assertion are unchanged.

* no-mistakes(review): Narrow dual-install docs; test Calm toggle

* no-mistakes(document): Scope Calm spaceship lifetime claims to calm.md

* no-mistakes(ci): Addressed Greptile finding ci-1 in tests/fm-calm-pi-extension.test.sh. The "absent config/calm-ship" case previously wrote an empty file, so readFileSync still succeeded and the missing-file fallback was never exercised. It now removes the file with `rmSync(..., { force: true })` (imported alongside writeFileSync), and the existing boat assertions are unchanged (no stale widget after session_start, boat hull during the run, clean settle on agent_settled). No product code touched, and no sibling sites write an empty calm-ship file. Verified by running the suite directly with FM_PI_PACKAGE_DIR pointing at the Pi 1.6.1 package-layout shim: all cases pass, including the "working-spaceship modes and selection" case; the four tmux/pi interactive E2E cases skip because tmux is absent, as expected
…id#8823)

* fix(bin): refresh watcher beacon at progress checkpoints

* fix(watch): reject zero checkpoint interval

* no-mistakes(document): Align beacon comments with checkpoint behavior

* fix(watch): checkpoint signal triage progress

* no-mistakes(review): Checkpoint turn-end worker classification

* no-mistakes(document): Document watcher beacon checkpoint behavior

---------

Co-authored-by: Pitch Perfekt Collective <[email protected]>
…chenguid#8711)

omp joins several queued follow-ups into one prompt or one text part
separated by a blank line. consumeWake only finished a pending wake when
the whole text equalled its content, so merged wakes were never finished
and the same replacement handoff was replayed in every later session.
Each pending wake whose full content the text carries is now consumed,
once per occurrence.
…chenguid#8778)

* feat(bin): reclaim a returned Treehouse pool slot's disk at teardown

A returned pool slot keeps every git-ignored build artifact behind
(node_modules, .next, dist, Electron builds), so pools only ever grow
across finished tasks. Teardown now destroys a ship or scout task's own
returned slot by default, relying on treehouse destroy's safe-by-default
behavior so unlanded, dirty, or otherwise disposable-ineligible slots are
only skipped with a warning, never a teardown failure. Opt out home-wide
with config/keep-pool-slots.

* no-mistakes(review): Release slot owner claim before pool slot destroy

* no-mistakes(document): Document keep-pool-slots flag in home layout

* feat(bin): make pool-slot reclaim opt-in (config/reclaim-pool-slots)

Per maintainer review on the PR: invert the flag so destroying a
returned pool slot only happens when a home explicitly opts in, never
by default. An unconfigured teardown behaves exactly as before this
feature existed.

* no-mistakes(review): Fix home-layout skill reclaim flag name
* fix(rex): resolve the launcher session from REX_BLOCK

* no-mistakes(document): Drop stale REX_SESSION from comments

* no-mistakes(lint): Fix ShellCheck warnings in Rex tests
…id#8631)

An idle watcher poll starts many short-lived programs whose answers bash
can give itself. Replace them with builtins on the per-poll path, keeping
every result and error word the same:

- sign each status file once per scan and pass that signature to the
  seen check instead of signing it again
- on Darwin, read path state, size and identity with one stat instead of
  four or five, with the same fields and error words
- hex-encode plain-ASCII signature fields with printf -v instead of
  od | tr; any other byte keeps the od encoding
- read the presentation marker, turn-ended markers and the pane capture
  file with $(<file) instead of cat, and strip the pgid without tr
- read kind/backend/harness from a window's meta with one builtin loop
  instead of grep | cut, keeping every value of a repeated key
- skip rm for per-window markers that do not exist (fm_rm_present, same
  exit status as rm -f; a dangling symlink still counts as present)
- skip mkdir of an existing state dir and dirname at library load

Measured with one method: a PATH-shim tracer that logs every program
start (absolute-path calls routed through the shims via BASH_ENV), on
macOS with /bin/bash 3.2, against a synthetic idle home (10
already-reported status files, tmux panes printing a clock, FM_POLL=3).
Each figure is the start count of one steady idle poll (polls after the
first two, between watcher beacon touches) in a 40-second traced run;
every steady poll in a run had the same count. Base is 427056c, the
other side is this commit, both exported from git:

- no task windows: 195 -> 86 starts per poll (-56%)
- four task windows: 291 -> 130 starts per poll (-55%)

An earlier measurement of part of this work reported 102 -> 72 and
170 -> 116 with the same tracer; those pairs differ because they measured
a different baseline - a tree that already had the first half of these
changes - and only the second half on top of it, so they are not quoted
here.

status_observed_signature output is byte-identical before and after on
72 fixture cases (regular, empty, symlinked, dangling, non-ASCII and
invalid-byte targets, directory, unreadable, FIFO, missing; LC_ALL=C and
UTF-8) under bash 3.2 and 5.3.

Not measured: Herdr panes, Linux, wake/drain/ack turns, the periodic
check and home-summary runs, and forks that do not exec.

The inactive-reconcile per-poll fast path and the procevent uname/id
caching are left to kunchenguid#7329 and kunchenguid#7349, which already propose them.

Refs kunchenguid#7330
…d#8469)

* feat(watch): wake on an arrived captain-hold --until date (kunchenguid#8444)

Behind the existing opt-in config/open-decision-reminders flag, queue one
check wake per main-home captain hold and --until date when the date arrives.
A durable ledger keeps a watcher restart from refiring a recorded pair.

* no-mistakes(review): Skip Done rows in captain hold wake

* no-mistakes(document): Document captain-hold date wake skips Done rows

* no-mistakes(ci): Throttle failed captain-hold reads and bound them

* docs(watch): list captain hold date wake in the header reason index (kunchenguid#8444)
…nguid#7901)

* test: retry removal of a lock directory the waiter still writes

The waiter creates owner directories inside the state directory while
it waits. One rm -rf can lose that race, leave the directory in place,
and let the waiter return 0.

On origin/main the test matches the copy that failed in CI run
https://github.com/kunchenguid/firstmate/actions/runs/40652730373
(job "Behavior portable serial 3"):
rm: cannot remove '/tmp/fm-wake-tests.ckX5w2/lock-dir-removed/state': Directory not empty
not ok - the lock wait over a removed directory returned 0, not 1

Locally, fm_lock_owner_dir against rm -rf printed "Directory not empty"
3 times in 300 tries. The unfixed test passed 40/40 because the race
did not land. The fixed test passed 20/20. A removal that never
succeeds fails with "the lock directory survived 50 removal retries".

* test(wake-queue): rename the lock directory before the bounded removal retry
…8855)

* fix(rex): resolve the launcher session on Rex 0.1.0

Rex 0.1.0 rejects a block id as a session.view target, so a Firstmate
running directly in a Rex terminal could not spawn any task and skipped
per-home session cleanup. Resolve the launcher from REX_SESSION when set,
refusing when that session does not hold REX_BLOCK exactly once; otherwise
walk the session list for the single session holding the block, and keep
the block-target call only as a fallback when the list cannot be read.
The refusal now names its reason and the next step.

Fixes kunchenguid#8842

* no-mistakes(review): Make real-Rex smoke no-walk assertion detect flagged ls calls

* no-mistakes(review): Require a matching session_id before confirming the Rex launcher block

* no-mistakes(review): Warn when secondmate placement skips an unresolved Rex launcher

* no-mistakes(review): Stop blaming Rex build in inventory-unreadable refusal

* no-mistakes(review): Restore test coverage for retirement's launcher-session exclusion

* no-mistakes(test): Document Rex launcher behaviour for builds 1758 and 2181

* no-mistakes(document): Clarify Rex per-home session fallback wording

* no-mistakes(ci): I fixed ci-2 (Greptile: unreadable session views were silently skipped). The rule being broken: before placing anything, Firstmate must confirm that REX_BLOCK appears exactly once inside the chosen session, so a session whose view can't be read must never count as "no match". There are three places that read a view, and two already followed this rule. The REX_SESSION path refuses when fm_backend_rex_view_holds_block fails, and the legacy block-target fallback refuses when it can't parse the view. Only the session-list walk in fm_backend_rex_sessions_holding_block treated an exit-0 view it couldn't parse as a non-match and moved on. Fix (bin/backends/rex.sh): in the walk, after a session.view exits 0, the response must be valid JSON whose `.session_id` matches the listed session before the exactly-once check runs. If it isn't, the walk returns 1, and fm_backend_rex_launcher_session refuses with "a live session's view could not be read". I updated the function comment to match. I added no new helpers or branches. Tests: - The fake fixture (tests/rex-fake-fixture.sh) has a new `view-garbled` switch. It holds a session id, and that session's view exits 0 with truncated JSON. - tests/fm-backend-rex.test.sh has a new case where the other session's view is garbled. Resolution must refuse with that reason. Without the fix, the walk would skip the garbled session and resolve to the launcher session. - The existing walked-view-without-session_id case now expects that same unreadable-view refusal, in line with the earlier decision that a view without session_id is unresolved on every path. When I removed the fix temporarily, that assertion failed, and the whole file passed again once I put it back. Results: tests/fm-backend-rex.test.sh passes with exit code 0 (42 tests ok). `/opt/homebrew/bin/shellcheck -x` is clean on all three changed files. I ran no other suites. I replied on the Greptile thread that it is fixed: kunchenguid#8855 (comment). The fix is not committed or pushed yet, so the thread will show it only once the pipeline pushes. As you asked, I changed nothing for ci-1 (Full suite waiting on the full-ci label) and did not comment asking for the label
@screamyx screamyx changed the title feat: upstream sync 2026-11-29 upstream sync 2026-11-29 Nov 29, 2026
@screamyx
screamyx merged commit cc83213 into main Nov 29, 2026
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.