Skip to content

Upstream catch-up round 2 of N: merge through kunchenguid/firstmate#1737 - #75

Merged
HelloWorldSungin merged 12 commits into
mainfrom
fm/fm-upstream-catchup-round-2
Aug 11, 2026
Merged

HelloWorldSungin merged 12 commits into
mainfrom
fm/fm-upstream-catchup-round-2

Conversation

@HelloWorldSungin

Copy link
Copy Markdown
Owner

Summary

This is upstream catch-up round 2 of an N-round sweep.
It merges the first 10 upstream first-parent commits after the existing merge base, ending at bf01a423efb899aa82e776412ae3df9b169f827d (kunchenguid/firstmate#1737).
It then merges the latest fork main at 1fd5e331eb7dffbf0299e18757eea1e75226bfab, so the dashboard work that landed while this round was under way is preserved exactly.

Merge structure and landing requirement

This branch is merge-only.
It contains no rebase, force-push, squash, or cherry-pick.

  • 5976d3c is the upstream merge commit, with fork main and upstream bf01a42 as parents.
  • 9e494bf merges the newer fork main into the sync branch.
  • git merge-base --is-ancestor origin/main HEAD passes.
  • git merge-base --is-ancestor bf01a42 HEAD passes.
  • git merge-base HEAD upstream/main is bf01a42 after fetching upstream again.

This PR must be merged with an explicit merge commit, never squash or rebase.
Squashing would discard the upstream parentage, prevent the merge base from advancing, and make later rounds re-present these same commits permanently.

Why this round ends at 10 commits

The original 44-commit sweep was stopped before conflict resolution because its conflict surface was materially worse than round 1.
The split point was selected from read-only git merge-tree --write-tree --name-only measurements against successive upstream first-parent merge points:

Upstream commits included Conflicting files
5 11
10 14
15 23
20 25
25 25
30 28
44 32

The 10-commit surface is a strict subset of the 44-commit surface and performs the front-loaded structural reconciliation before the curve steepens.
The next round must remeasure the curve from its new merge base rather than assuming another 10-commit split.
After the final upstream fetch for this PR, upstream had advanced to 7f05100 and 37 commits remained beyond this branch.

Upstream applicability

Commit Upstream change Resolution and evidence
d0461e4 kunchenguid/firstmate#1661 prevent false watcher-down alarms in Claude sessions Adapted with the fork's launch quoting and robust watcher fixture readiness preserved; supervision and watcher-lock tests pass.
1cd97c0 kunchenguid/firstmate#1704 prevent fixture temporary-directory leaks Adapted into tests/lib.sh while retaining the fork's dashboard state-root isolation; the new fixture-cleanup suite and dashboard suite pass.
3089a57 kunchenguid/firstmate#1708 enable Herdr presentation spaces by default Taken as the new default-on contract while preserving project-board and other inherited fork config; Herdr presentation and secondmate inheritance tests pass.
bb352e7 kunchenguid/firstmate#1711 surface fleet-wide open decisions on every drain Adapted with fork metadata, outcome, and cleanup state preserved; both open-decision suites and watcher triage pass.
7ef26c4 kunchenguid/firstmate#1710 abort parked runs and reap leaked processes before cleanup Adapted through one shared no-mistakes run relationship owner while preserving the fork's live fix-round attribution, model checks, outcome publication, usage state, and agy cleanup; crew-state and cleanup suites pass.
bea3d23 kunchenguid/firstmate#1709 resolve the remote entrypoint directory through a PATH symlink Taken cleanly in production code; the new remote-entrypoint regression test passes.
71f0b3f kunchenguid/firstmate#1724 gate Pi Calm built-in overrides by activation state Taken cleanly; the complete Calm extension suite passes.
30b18b9 kunchenguid/firstmate#1727 persist secondmate parent bindings for cleanup Taken in production code while preserving the fork's remote inheritance synchronization test helper; parent-binding and remote-secondmate lifecycle suites pass.
ef2c3a2 kunchenguid/firstmate#1733 enforce latest AXI-family tool floors Taken with the fork's authentication-source rationale retained; bootstrap and documentation checks pass.
bf01a42 kunchenguid/firstmate#1737 bound open-decision scans with incremental cursors Adapted without adding another declared-wait token list; incremental cursor, durable decision, cleanup, and fleet snapshot tests pass.

Conflict resolutions

The measured 14 conflicting files were resolved on meaning:

  • AGENTS.md keeps the fork's PR observation, GBrain, usage, work-item, and metadata fields while taking the upstream default-on presentation contract, open-decision cursor, and drain instructions.
  • bin/fm-config-inherit-lib.sh takes the upstream default-on presentation inheritance semantics and retains the fork's project-board inheritance.
  • bin/fm-crew-state.sh uses the upstream shared no-mistakes helper without regressing the fork's active fix-round, unresolved live-head, degraded lookup, or historical-row attribution rules.
  • bin/fm-spawn.sh keeps the fork's launch-shell quoting and takes upstream's harness-specific secondmate supervision model.
  • bin/fm-teardown.sh keeps both timeout and no-mistakes helpers and removes every upstream cursor plus every fork-specific PR, GBrain, usage, run-step, and adapter artifact.
  • docs/architecture.md documents both the new fleet-wide open-decision scan and the fork's stronger current-run attribution behavior.
  • docs/configuration.md keeps all fork runtime knobs and rationale while adding the upstream cleanup timeout and current AXI floors.
  • docs/scripts.md keeps the fork's progress and model-verification entries and adds the shared no-mistakes helper.
  • tests/fm-backend.test.sh carries the union of fork and upstream fixture dependencies and pins a compatible task-tool fake for deterministic conformance tests.
  • tests/fm-gotmp.test.sh carries both secondmate-parent and agy trust dependencies.
  • tests/fm-remote-secondmate-lifecycle-e2e.test.sh retains the fork's progress-based blocked-inheritance wait helper.
  • tests/fm-teardown.test.sh carries both complete test families, including fork model, outcome, and usage safety plus upstream run-abort and leaked-process reaping.
  • tests/fm-watcher-lock.test.sh combines upstream cleanup on failed setup with the fork's readiness handshake that removed the race.
  • tests/lib.sh keeps dashboard isolation and adds registered fixture cleanup, signal traps, and orphan reaping.

The other operating-contract changes applied cleanly.
.agents/skills/bootstrap-diagnostics/SKILL.md adds the AXI-family floor handling without losing the fork's tool guidance.
.agents/skills/secondmate-provisioning/SKILL.md adds durable parent binding without changing the fork's charter, remote, or adapter constraints.

Fork-specific survival evidence

  • bin/fm-classify-lib.sh remains the single definition of a declared wait.
    Its owner comment says supervision reads the predicate directly and the fleet snapshot projects that same verdict without carrying a second token list.
    bin/fm-watch.sh and bin/fm-fleet-snapshot.sh both call status_is_paused_or_captain_held, and watcher, fleet snapshot, and dashboard tests pass.
  • The cursor and agy crew adapters remain present and restricted to crew-only, Herdr-only use.
    bin/fm-agy-trust-lib.sh remains sourced by spawn and cleanup, the dedicated CREW-ONLY, HERDR-ONLY skill section remains intact, and tests/fm-cursor-agy-adapter.test.sh passes all 11 checks.
  • Dashboard assets match the latest fork main exactly after the fork catch-up merge.
    git diff --quiet origin/main -- assets/dashboard passes, and dashboard, dashboard-inbox, and fleet-snapshot tests pass.
  • The fork's remote-secondmate machinery remains present.
    The remote lifecycle suite, parent-binding suite, remote entrypoint suite, secondmate harness suite, and remote safety suites all pass when their required task tool is available.
  • No parked decision branch was included.

Validation

Parent baselines were established before merging:

  • Fork parent 6eb5f1a: 146 test scripts, 0 failures, 18 environment-gated skips.
  • Upstream target bf01a42: 123 test scripts, 11 failures, 13 environment-gated skips.

Final head 9e494bffffc0764764a6e3b758bc5cf8eeb4f81b:

  • bin/fm-test-run.sh --all: 151 test scripts, 6 failures, 18 environment-gated skips.
  • Every final failure is on the upstream-parent baseline list.
  • The six local failures are tests/fm-backend-orca.test.sh, tests/fm-backend-zellij.test.sh, tests/fm-backlog-handoff.test.sh, tests/fm-decision-hold-lifecycle.test.sh, tests/fm-remote-backlog-handoff.test.sh, and tests/fm-secondmate-lifecycle-e2e.test.sh.
  • Each is attributable to this host still having tasks-axi 0.2.3 after this round imports the upstream 0.2.4 floor; the failure output names the incompatible tool, and no merge-caused failure remains.
  • bin/fm-lint.sh: clean with pinned ShellCheck 0.11.0.
  • bin/fm-doc-audience-check.sh: clean across 88 surfaces and 349 local links.
  • Targeted dashboard, fleet snapshot, cursor/agy, crew-state, cleanup, remote lifecycle, watcher, and open-decision suites pass.

This is deliberately a direct sync PR because rebasing through the normal pipeline would destroy the required merge structure.
The two "PR must be raised via no-mistakes" failures are expected for this PR and are not defects to fix.
Every other repository check must pass against the pushed head before merge.

karotkriss and others added 12 commits August 4, 2026 23:14
…d#1661)

* fix(guard): stop false watcher-down alarm mid-turn under Claude auto-arm

bin/fm-guard.sh derived its watcher-health verdict from fm_watcher_healthy,
which requires a live watcher process holding the home lock. Under the Claude
Stop-hook auto-arm supervision model the watcher is armed at each turn end and
exits on its wake, so it runs only between turns. Every guarded command run
mid-turn therefore found no live watcher and printed the "WATCHER DOWN -
SUPERVISION IS OFF" banner even though supervision was healthy. Because the
episode key was derived from the beacon mtime (which the between-turns watcher
advances every poll), the full banner re-printed on essentially every command,
and the message always blamed a "fresh beacon" that was in fact fresh.

Make the pull guard's health check model-aware via a new
fm_watcher_supervision_verdict in bin/fm-wake-lib.sh:

- Under the auto-arm model a beacon fresh within FM_GUARD_GRACE is healthy even
  with no live watcher process; only a beacon stale beyond grace (or absent) is
  a genuine lapse and alarms.
- Under every persistent-watcher harness (codex foreground checkpoint,
  opencode/pi/grok background arm, tmux, unknown) a live identity-matched
  watcher with a fresh beacon is still required, unchanged.

The banner now names the true failing condition, a missing live watcher process
versus a genuinely stale beacon, instead of always blaming the beacon, and the
once-per-episode dedup keys on that condition rather than the beacon mtime so a
genuine lapse announces once and does not re-print each turn.

The turn-end guard keeps the strict fm_watcher_healthy check because it fires at
the turn boundary, where the auto-arm brings a fresh watcher up and it
cooperates with that arm. fm_watcher_healthy itself is unchanged, so the arm
layer's start/attach/replace decisions are unaffected.

Tests in tests/fm-guard-stale-banner.test.sh cover the auto-arm healthy
fresh-beacon-without-a-watcher case, the auto-arm stale-beacon alarm and its
stable episode, the true-reason banner wording, and the reason-keyed episode
surviving a beacon mtime change; existing persistent-model cases are pinned to
that model.

* no-mistakes(review): Pin secondmate supervision model to launched harness

* no-mistakes(document): Align watcher documentation with model-aware supervision health
* fix(tests): stop fixture-tempdir helper from self-deleting under command substitution

fm_test_tmproot is almost always called as `TMP_ROOT=$(fm_test_tmproot prefix)`,
which forks a subshell to capture its stdout. The old implementation set its
EXIT cleanup trap inside that call, so the trap fired - and deleted the fixture
root - the instant the subshell exited, before the real caller's own EXIT trap
was ever installed. Every test using the documented call pattern leaked its
fixture root on every run; two suites had already independently discovered and
worked around this with ad-hoc mktemp calls.

Registration now goes through a $$-keyed registry file instead of in-process
state, since $$ resolves to the invoking shell's PID even inside the
subshell. The real cleanup trap is armed once at source time (always the real
caller, never a subshell) for EXIT, INT, and TERM. A best-effort orphan sweep
on next source reaps marked fixture roots old enough to be from a killed prior
run.

Simplifies the two existing ad-hoc workarounds (fm-procevent.test.sh,
wake-helpers.sh) back onto the shared helper now that it works correctly.

* no-mistakes(review): Preserve live fixtures during orphan reaping

* no-mistakes(review): Harden fixture ownership against PID reuse

* no-mistakes(review): Secure cleanup registry against path precreation

* no-mistakes(review): Make fixture registration transactional

* no-mistakes(document): Documentation already matches fixture cleanup behavior

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes
* feat(herdr): default presentation spaces on with an explicit opt-out

Herdr's disposable one-task presentation workspace was opt-in through the
presence of local config/herdr-presentation-spaces. It is now on by default,
and a home opts out by writing "off" into that same file.

Values are read with the whole-file whitespace-stripped convention the other
scalar config items already use, plus case folding. An absent file, an empty
file, and "on" all resolve on; only "off" opts out; an unrecognized value warns
and keeps the default rather than failing a spawn over a purely visual setting.
The empty file is exactly the historical opt-in form, so every home that had
already enabled the projection stays enabled with no migration step, and no
previously enabled home can be turned off by the flip.

Because absence now means on at both ends, secondmate inheritance needs no
item-specific convergence: mirroring an absent primary file converges a
secondmate to the same default-on rather than turning its projection off, and
only an explicit primary opt-out propagates the opt-out.

The gate itself moves into fm_backend_herdr_presentation_enabled in the Herdr
adapter so the semantics have one owner that regressions can exercise directly.

* no-mistakes(document): Document Herdr default-on presentation safety

---------

Co-authored-by: kunchenguid <[email protected]>
…henguid#1711)

* fix: surface consolidated open decisions on every wake-drain

A needs-decision or blocked event buried under later, unrelated status
appends was only ever shown via the last-line wake annotation, so a
still-open captain decision could go silently missed even though
status_open_decisions (fm-classify-lib.sh) already folds the whole
status stream correctly and fleet-snapshot/bearings already reuse it.

Wire that same fold into bin/fm-wake-drain.sh: a new fleet-wide
scan_open_decisions wrapper scans every state/<id>.status, and
fm-wake-drain.sh prints a separate, bounded OPEN DECISIONS section on
every drain (including the empty-queue fast path), so session-start
and every wake-handling turn surface it for free without duplicating
the open/resolved fold itself. Heartbeat wakes drain through the same
script, so this covers that surface too.

Also tighten status_open_decisions' file guard to skip an unreadable
status file instead of leaking a bash redirection error, now that a
fleet-wide directory scan can reach files a single targeted read
would not.

* no-mistakes(review): Prevent status symlinks leaking open decisions

* fix: drop unbounded perl subprocess from status symlink guard

The review step's own symlink-safety auto-fix (O_NOFOLLOW read via a
perl subprocess) forked one perl process per status file scanned by
the new fleet-wide open-decisions scan, with no cap - inflating
fm-wake-drain.sh's total external-read cost from 8 (the existing
annotation read_cap) to 18 in the enrichment-caps regression test.

The plain [ -L "$f" ] check already rejects any status file that is
itself a symlink before any read happens, which is exactly what the
new regression test exercises and is the same defense level the
sibling scan_captain_relevant_statuses/last_status_line already rely
on elsewhere in this file (no O_NOFOLLOW). Drop the subprocess-based
nofollow read and keep the cheap builtin guard.

* no-mistakes(document): Document actionable fleet-wide open decision drains
…kunchenguid#1710)

* fix(bin): abort orphaned no-mistakes runs and reap leaked processes at teardown

Teardown could remove a task's worker while its no-mistakes pipeline run was
still parked at a gate, leaving an orphaned run holding a fleet slot
indefinitely (observed 2026-08-03: runs parked 7h39m and parked at a
post-CI approval gate). It could also leave backgrounded/disowned
descendant processes rooted under the worktree or tasktmp surviving
reparented to init (observed: two `go test` binaries pinning CPU for
hours with no live task meta to attribute them to).

Add two coupled pre-teardown steps, both scoped to this task's exact
branch/head or worktree/tasktmp so they can never touch another task's
run or processes:
- conclude_task_no_mistakes_run aborts a run parked at a gate via
  `no-mistakes axi abort`, cd'd into the exact worktree so the daemon
  resolves the run itself rather than teardown naming a --run id.
- reap_task_worktree_processes sweeps for processes whose cwd is under
  the worktree or tasktmp (via `lsof -a -d cwd`) and TERM/KILLs them.

Both run before any worktree return, branch delete, or backend kill,
and are idempotent on a retried teardown. The branch+head attribution
logic is factored out of bin/fm-crew-state.sh into the new shared
bin/fm-nm-run-lib.sh so both scripts use the same ownership contract.

* no-mistakes(review): Fail closed on incomplete teardown cleanup

* no-mistakes(review): Bind teardown cleanup to verified run and process identities

* no-mistakes(review): Require confirmed aborts and convergent identity-safe process reaping

* no-mistakes(review): Handle process exits during teardown identity checks

* no-mistakes(review): Restore teardown library in hermetic gotmp fixtures

* no-mistakes(document): Document teardown run attribution and timeout

* no-mistakes(lint): Rename shell variable conflicting with done keyword

* no-mistakes: apply CI fixes
kunchenguid#1709)

The script installs as a symlink under ~/.local/bin. Taking dirname of
the symlink itself (instead of its real target) pointed SCRIPT_DIR at
~/.local/bin, breaking sourcing of the sibling fm-remote-job-lib.sh.
Resolve the real path first, preferring python3's os.path.realpath,
then realpath, falling back to the raw BASH_SOURCE on hosts with
neither.
…d#1724)

* fix(pi): stop Calm claiming a built-in tool name another extension owns

fm-calm.ts claimed bash/read/edit/write/grep/find/ls unconditionally at
extension load, regardless of whether Calm was on. Pi resolves two
extensions registering the same built-in name by first-registered-wins
with no merge and no unregister call, and Calm's project-local
.pi/extensions/ position beats any global or CLI-configured extension,
so a user who never even enabled Calm could have their own bash/read/etc
override silently replaced.

Captain-approved plan implemented:

- Registration is now gated on config/calm already being "on" at load
  time. A Calm-off session or reload registers nothing, so a non-Calm
  user never contests a name. This stays synchronous during the
  factory's own load, not deferred to session_start: /reload (and
  ctx.newSession/fork/switchSession) render the restored transcript from
  a pre-session_start snapshot of the tool registry, so a deferred claim
  would miss that render - confirmed by tests/fm-calm-pi-extension
  .test.sh's hidden-block-geometry E2E when trialed.
- The first time Calm turns on in a session that started off
  (activateBuiltInsIfNeeded, from the /calm command handler), Calm calls
  pi.getAllTools() - safe only once every extension has finished loading,
  unlike the load-time path above - to see whether a different extension
  already owns a name, and skips claiming only that one, leaving it and
  its owning extension fully intact and callable.
- A contested name found this way prints a prominent ctx.ui.notify()
  warning naming the tool, plus a console diagnostic.
- reportBuiltInLosses() remains the backstop for the one case neither of
  the above can reach: a session that starts or reloads with Calm already
  on, where the registry snapshot is taken before Calm gets any chance to
  check ownership. A symlink-safe realpath comparison avoids misreporting
  Calm's own registration as foreign when its path crosses a symlink
  (macOS /tmp, /var).

Confirmed, bounded trade-off: the very first time a session that started
Calm-off turns Calm on, tool-call rows already on screen from before that
toggle do not retroactively collapse, because Pi never lets an extension
re-point an already-rendered row at a definition registered later. Every
session after that first toggle starts with the preference already on and
takes the synchronous load-time path, so the guarantee is intact from
then on. docs/calm.md and the file's own header document this in full.

tests/fm-calm-pi-extension.test.sh gains test_builtin_gate_load_time
(config/calm off registers nothing, on registers all 7 synchronously at
load) and test_calm_activation_collision_and_regression_bound (first
activation claims every uncontested built-in, leaves a foreign bash tool
fully intact and callable, warns and logs the contested name, and locks
in the documented pre-activation bound against real ToolExecutionComponent
rendering). test_rendering_and_session_lifecycle and the live interactive
E2E are updated for the new gate-at-load and first-activation-bound
contract.

* no-mistakes(document): Document Calm tool collision boundaries

* no-mistakes: apply CI fixes
…#1727)

* fix(bin): give secondmate homes a durable parent binding record

Finished-worker cleanup on a remote second mate refused forever with
"cannot resolve the primary home ... durable parent binding". The
remote launch hands the child the remote code checkout as its parent
home (fm-spawn.sh's sole writer of FM_PUBLIC_FOLLOWUP_PRIMARY_HOME
receives FM_HOME=$FM_ROOT from fm-remote-secondmate-control.sh's
host-local launch), and that path can never carry the parent's real
records, so the guard refused unconditionally once relay looked active
anywhere on that host.

fm-home-seed.sh and fm-remote-home-provision.sh now write a durable
.fm-secondmate-parent record next to the .fm-secondmate-home identity
marker, naming the home's route to its parent as local (with the real
parent path) or remote (with the parent's SSH alias for diagnostics
only). fm-teardown.sh's cleanup gate reads it: a remote parent is out
of scope for the delegated-promise check (the whole promised-public-
reply subsystem is same-filesystem by construction, so a remote parent
can never hold one), while a token committed directly to the child's
own .env file - never the process environment - still refuses, so an
unrelated export in the remote host's login shell can no longer mask
in. For a local secondmate, the durable parent_home now also backs up
the launch-time env var, closing a silent fail-open where a restart
that dropped the launch prefix made the guard treat a genuinely active
parent relay as off.

Regression coverage drives the real remote route (SSH boundary + Herdr
fixture) and real fm-home-seed.sh seeding rather than hand-crafted
markers.

* no-mistakes(review): Captain: fail closed on unsafe durable parent records

* no-mistakes(review): Captain: enforce durable parent binding commit protocol

* no-mistakes(review): Captain: publish local parent binding before identity

* no-mistakes(review): Captain: refuse conflicting local parent bindings

* no-mistakes(review): Captain: reject non-regular secondmate seed leaves

* no-mistakes(review): Captain: enforce unique durable parent bindings

* no-mistakes(review): Captain: reject route-incompatible durable parent fields

* no-mistakes(document): Document durable secondmate parent bindings

* no-mistakes(lint): Fix secondmate parent parser ShellCheck warnings

* no-mistakes: apply CI fixes
* feat(bin): gate lavish-axi at its session_ended floor in bootstrap

bin/fm-procevent-lavish.sh decides that a human "Send & End" review is
terminal by reading session_ended from the poll response's leading session
block. That field first shipped in lavish-axi 0.1.35, so an older installed
build silently leaves every ended review source armed forever and captures
an empty ended result on each later cycle. The same release is what makes a
plain reopen refuse a session the human deliberately ended.

Add LAVISH_AXI_MIN=0.1.35 to the existing axi-family floor structure in
bin/fm-bootstrap.sh, reusing tool_version_at_least and the same MISSING
diagnostic gh-axi already emits, so an incompatible build is reported as an
upgrade request before any review surface is armed. Later lavish-axi
releases only add artifact-authoring surface the adapter never reads, so
the floor is the feature-introduction point rather than latest.

Fixtures that stubbed lavish-axi as a bare exit-0 tool would now be read as
unparseable builds, so tests/lib.sh gains fm_fake_version_tool and every
bootstrap-running suite uses it for lavish-axi.

* no-mistakes(review): Clarify lavish-axi version floor rationale

* no-mistakes: apply CI fixes

* feat(bin): set axi-family floors to current latest under the bump policy

The axi-family bootstrap floors are the CURRENT LATEST published version of
each tool, captain-bumped periodically to move the whole fleet onto the
newest axi tools. They are not the minimum feature-introduced version. The
earlier lavish-axi work set a feature-minimum floor, which is the opposite
of this policy, so replace it along with the older feature-minimum rationale
carried by tasks-axi and quota-axi.

State the policy explicitly in bin/fm-bootstrap.sh's header, which owns it,
and in each per-tool floor owner, so no future change argues a floor back
down to the earliest release that happens to satisfy some behavior. Remove
the lavish-axi session_ended and upstream-PR citation, the tasks-axi
multi-ID-mv minimum argument, and the quota-axi credential-source argument
as floor rationale; the tasks-axi feature probes remain as a separate
defense-in-depth concern.

Floors: lavish-axi 0.1.45 (was 0.1.35), tasks-axi 0.2.4 (was 0.2.2),
quota-axi 0.1.17 (was 0.1.16), gh-axi 0.1.29 unchanged and already latest.
Each was verified against the tool's current published version.

The mechanism is unchanged: the same shared version helper and the same
MISSING diagnostic path. The below-fires and at-or-above-silent regression
rows move to the new floors, keeping each boundary genuine by pinning the
patch immediately below each floor rather than a version that was only
below the old one. Fleet fixtures move to the new floors so a bootstrap-
running suite is not reported as an out-of-date build.

Three operator-facing backlog handoff and receipt errors named "0.2.2+"
while the enforced floor moved, so they now point at the floor's owner
instead of duplicating a version number that drifts.

* no-mistakes(review): Centralize AXI floor policy beside constants

* no-mistakes(review): Clarify bootstrap boundary test comment

* no-mistakes(document): Centralize AXI floor policy rationale
…guid#1737)

* fix(bin): bound OPEN DECISIONS scan cost with a per-status-file cursor

The fleet-wide OPEN DECISIONS scan added in kunchenguid#1711 re-reads and refolds
every task's entire lifetime status log on every drain, so its cost
grows unbounded with total log size. Add status_open_decisions_incremental
and scan_open_decisions_incremental to fm-classify-lib.sh: they persist a
per-status-file byte cursor plus the folded open-decision set, and fold
only newly appended bytes on each call, reusing status_open_decisions'
exact fold-line rule (extracted into _fm_decision_fold_line) so the two
strategies can never disagree on what is open. A missing or invalidated
cursor (new task, truncated/rewritten/shrunk log) falls back to a full
re-fold. bin/fm-wake-drain.sh now calls the incremental wrapper instead
of the whole-file scan.

* fix(bin): add O(1) rotation detection and read-failure guarding to the cursor fold

Add the two pieces the incremental open-decisions cursor was missing,
scoped to this repo's actual status-file usage (create-once, append-only,
never replaced or rewritten in place):

- An O(1) device+inode identity check (one stat call) alongside the
  existing size-shrink check, so a status file replaced/rotated/recreated
  at the same path is detected and falls back to a full re-fold, even
  when the replacement is the same size. A same-inode, same-size,
  in-place byte edit is a deliberately accepted gap: no code path in
  this repo ever does that to a status file.
- Checked reads: a stat/wc/tail failure is a genuine I/O error, not
  "the file is empty" - it now reports the already-trusted persisted
  open set unchanged instead of risking a silent invalidation.

Both stay O(1) plus new bytes per call, matching the cursor's bounded-
cost design; no content hashing or pending-fragment machinery.

* no-mistakes(review): Preserve cursor state across failed incremental reads

* no-mistakes(review): Refold status when cursor cache reads fail

* no-mistakes(document): Document cursor-backed open-decision scanning

* no-mistakes: apply CI fixes
# Conflicts:
#	AGENTS.md
#	bin/fm-config-inherit-lib.sh
#	bin/fm-crew-state.sh
#	bin/fm-spawn.sh
#	bin/fm-teardown.sh
#	docs/architecture.md
#	docs/configuration.md
#	docs/scripts.md
#	tests/fm-backend.test.sh
#	tests/fm-gotmp.test.sh
#	tests/fm-remote-secondmate-lifecycle-e2e.test.sh
#	tests/fm-teardown.test.sh
#	tests/fm-watcher-lock.test.sh
#	tests/lib.sh
@cursor

cursor Bot commented Aug 11, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@HelloWorldSungin
HelloWorldSungin merged commit 2f0d999 into main Aug 11, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants