Skip to content

fix: report stale AXI tools during bootstrap - #1701

Merged
kunchenguid merged 2 commits into
mainfrom
fm/fm-ghaxi-min-version-warn
Aug 4, 2026
Merged

kunchenguid merged 2 commits into
mainfrom
fm/fm-ghaxi-min-version-warn

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

Add stale *-axi version floors to Firstmate startup bootstrap so below-minimum installs surface loudly as MISSING diagnostics rather than silently breaking hands-off behavior.

Requirements (current accepted form):

  1. gh-axi minimum 0.1.29 in bin/fm-bootstrap.sh beside NO_MISTAKES_MIN, using existing tool_version_at_least, emitting MISSING: gh-axi (install: ...) when present but older. Rationale: fm-pr-merge passes bare --squash; gh-axi <0.1.29 rejected that shorthand and broke non-interactive merges. Do NOT change fm-pr-merge merge-method logic.
  2. tasks-axi: raise declared floor in bin/fm-tasks-axi-lib.sh (fm_tasks_axi_compatible owner) from 0.1.1 to true requirement 0.2.2 (atomic multi-id mv for secondmate handoffs). Keep feature probes for --archive-body and multi-id mv as defense in depth. This subsumes backlog item fm-tasksaxi-probe-bump-p2.
  3. quota-axi: verify existing FM_QUOTA_AXI_MIN=0.1.16 in bin/fm-quota-axi-lib.sh against what dispatch consumes today (per-model limits/effectiveAvailability, schemaVersion 3). Raise only if evidence shows 0.1.16 predates required data; do not lower. Keep 0.1.16 if runway is optional additive (0.1.17) and dispatch treats absence as uncertainty.
  4. Placement/one-owner: each floor in its tool owner (gh-axi inline in bootstrap like no-mistakes; tasks and quota in their libs). Same MISSING bootstrap diagnostic path for all three. No second copy of floor values.
  5. Update bootstrap header version-gated tool docs and docs/configuration.md toolchain list; bootstrap-diagnostics if it enumerates version-gated tools. Docs point at owners rather than duplicating rationale everywhere.
  6. Colocated regression tests via real bootstrap path with fake PATH stubs: below-min fires MISSING, at/above silent, unparseable fails closed. Cover all three floors. Never assert by grepping implementation source.
  7. bin/fm-lint.sh clean; existing tests green. Harness/backend agnostic detect-only check.

Decisions made while implementing:

  • FM_TASKS_AXI_MIN=0.2.2 constant with comparison aligned to quota-axi style; feature probes retained.
  • quota-axi kept at 0.1.16: verified 0.1.16 already emits schemaVersion 3 and per-model effectiveAvailability; 0.1.17 only adds optional runway; quota-array-dispatch treats absent runway as uncertainty.
  • Updated bootstrap-facing test fake toolchains that used exit-0 gh-axi stubs so the new version floor does not spuriously fail unrelated suites.

What Changed

  • Report installed gh-axi versions below 0.1.29 as MISSING during bootstrap.
  • Raise the tasks-axi compatibility floor to 0.2.2 while retaining feature probes, and document the retained quota-axi 0.1.16 floor.
  • Add bootstrap regression coverage for below-minimum, compatible, and unparseable AXI tool versions, with compatible stubs across affected suites.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed
✅ **Rebase** - passed
✅ **Review** - completed
✅ **Test** - passed
✅ **Document** - passed
✅ **Lint** - passed
✅ **Push** - passed

… uses

Add gh-axi 0.1.29 floor so bare --squash PR merges stop failing quietly on
older builds. Raise tasks-axi to FM_TASKS_AXI_MIN=0.2.2 (multi-id mv) while
keeping feature probes. Keep quota-axi at 0.1.16 after verifying schema 3
and per-model availability already ship there; runway remains optional.
@kunchenguid
kunchenguid merged commit 4a9979a into main Aug 4, 2026
13 checks passed
@kunchenguid
kunchenguid deleted the fm/fm-ghaxi-min-version-warn branch August 4, 2026 20:38
nbost130 pushed a commit to nbost130/firstmate that referenced this pull request Aug 5, 2026
* feat(bootstrap): gate stale axi CLIs at the floors firstmate actually uses

Add gh-axi 0.1.29 floor so bare --squash PR merges stop failing quietly on
older builds. Raise tasks-axi to FM_TASKS_AXI_MIN=0.2.2 (multi-id mv) while
keeping feature probes. Keep quota-axi at 0.1.16 after verifying schema 3
and per-model availability already ship there; runway remains optional.

* no-mistakes(document): Clarify AXI compatibility documentation ownership
withally added a commit to withally/firstmate that referenced this pull request Aug 5, 2026
…fork (#13)

* perf: shard portable serial tests across CI runners (kunchenguid#1544)

* perf(ci): shard the portable serial behavior lane across runners

The Behavior portable serial job ran all 69 scripts of the serial
remainder on one runner. The measured serial sum on run 30725985757 was
1143762 ms (19m04s) against a 20-minute timeout, so the job intermittently
reached the cap and was cancelled with every step passing. Setup is only
about 7s, so the cost is entirely test wall time.

Split the lane into four separate-runner shards. Each shard is still
strictly serial, and separate runners mean no two of these stateful
scripts ever share a machine, so the split needs no concurrency isolation
proof. Assignment is longest-processing-time bin packing over measured
per-script duration hints, balancing every shard to 285941 ms (~4m46s) of
expected work, and the timeout tightens from 20 to 15 minutes.

bin/fm-test-run.sh owns the shard count and refuses a lane whose "ofN"
disagrees with it, while ci.yml derives the same count from
strategy.job-total rather than a literal, so changing it in either file
alone fails the lane loudly instead of leaving part of the required suite
unrun. --check-coverage additionally proves the shards are non-empty,
disjoint, and exactly equal to the serial lane. No test is weakened,
skipped, or removed.

Also replace the wall-clock sleeps in the --jobs scheduler test fixture
with an explicit signal handshake between the fixtures. The old
0.5s-versus-0.05s race failed on a loaded machine; the handshake passes
under sustained CPU saturation.

* no-mistakes(review): Correct portable serial shard balance evidence

* no-mistakes(document): Document portable serial shard evidence accurately

* fix(bin): correct session lock and attached watcher supervision (kunchenguid#1545)

* fix(bin): identify harness sessions by path and report delivered wakes

Two supervision faults, both reported by a contributor and both open on the
default branch.

Fault 1: the Stop auto-arm never claims the home. fm_harness_ancestry_pid()
matched only the basename of `ps -o comm=`, and Claude Code's native installer
names the per-session executable by its version (.../share/claude/versions/
2.1.220), so that basename identifies nothing. Three real failure shapes follow:
a version-named session is missed entirely and the hook exits 0 with the epoch
never written (unconditional on Linux, where procps reports the kernel exec name
and ignores argv[0]); a claude-named daemon that directly parents sessions wins
the outermost-contiguous-claude rule ahead of the session itself; and a session
that is both version-named and daemon-parented has its live lock reclaimed as
stale and rewritten to the shared daemon pid, corrupting the home's ownership
record.

Harness identity now also reads whole components of the executable path and of
argv[0], which is what both platforms still carry. Matching whole components
only keeps that widening safe: bin/fm-claude-stop-autoarm.sh and ~/.claude/hooks
scripts have no "claude" component. Ownership is then decided against the
session's whole contiguous harness ancestry rather than one chosen pid, which is
the honest form of the question the library already documents ("does the current
process descend from that same harness?"). That subsumes the outermost-pid rule
for Claude's nested bg-spare worker chain instead of reverting it, and lets a
daemon-parented session recognize its own lock. Lock acquisition still writes the
outermost pid of the run, the only pid that lives as long as the session.

Fault 2: an attached arm reports a delivered cycle as FAILED. The watcher prints
its one reason line to its own stdout, so only the arm that forked it can read
that line; an arm that attached observes nothing but a released lock and called a
completely successful cycle "cycle ended without an actionable reason". No
supervision event was lost - the durable queue held it - but every harness
protocol reads that line as "supervision is down" and directs a manual re-arm.

The arm now resolves an unobservable close against the durable wake queue, which
records every wake before the watcher prints it and whose sequence counter never
rewinds, not even across a drain. A cycle the queue proves delivered a wake
reports that wake and exits 0; a cycle whose records a handling turn already
drained reports the delivery without inventing a reason line; only a cycle that
delivered nothing is still the typed nonzero failure. Fixing it in the arm covers
codex, opencode, pi, grok and kimi, not just the Claude Stop path.

Regressions: tests/fm-session-lock-ancestry.test.sh pins both platforms' ps
semantics behind a deterministic process table and runs the real Stop auto-arm in
version-named, daemon-parented, and combined real process trees, each orphaned so
the walk cannot escape the fixture. tests/fm-watch-arm.test.sh drives a real
watcher and a real attached arm through a real wake. Every fault case fails on
the previous code.

* no-mistakes(review): Bind watcher delivery records to process identity

* no-mistakes(review): Return validated watcher identity atomically

* no-mistakes(review): Track watcher successors by PID and identity

* no-mistakes(document): Consolidate watcher arm-cycle documentation ownership

* fix(bin): harden Claude supervision auto-arm recovery (kunchenguid#1495)

* fix(supervision): harden Claude auto-arm failure handling

* no-mistakes(review): Guarantee automatic retry after Claude auto-arm failures

* no-mistakes(review): Gate attended fail-open on verified supervision failure

* no-mistakes(document): Document Claude auto-arm retry and guard scope

* no-mistakes: apply CI fixes

* fix(supervision): make Claude fail-open progression monotonic

* no-mistakes(review): Preserve auto-arm failure episodes until verified watcher recovery

* no-mistakes(review): Linearize auto-arm failure progression across existing locks

* no-mistakes(review): Linearize positive recovery across shared failure episode lock

* no-mistakes(review): Scope Claude recovery contention to Claude guard mode

* no-mistakes(document): Align supervision auto-arm documentation

* no-mistakes(review): Preserve actionable wakes despite healthy successors

* no-mistakes(document): Refresh supervision auto-arm documentation

* feat(bin): require an explicit per-task delivery contract (kunchenguid#1563)

* feat(bin): require an explicit ship delivery mode in fm-brief

A ship brief's definition of done was shaped by a silent per-project registry
lookup, so an adjusted brief and the task's recorded delivery could disagree and
no one had to decide anything per task.

fm-brief now requires --mode on ship scaffolds, validates it against the closed
set, refuses the conditional no-mistakes-prod-only registry policy as a task
mode, and records the choice as a fixed machine-readable "Delivery contract:
mode=<mode>" line that fm-spawn can check. --mode is refused on scout and
secondmate scaffolds, and --yolo is refused outright because the worker never
owns approval decisions.

* feat(bin): require an explicit ship delivery contract at spawn and promotion

fm-spawn resolved every ship and scout task's mode and yolo from the project
registry, so the delivery posture was never a per-task decision and could
contradict the brief the worker was about to follow.

fm-spawn now requires --mode and --yolo on ship spawns, validates both against
their closed sets, and reads the brief's recorded delivery contract line and
refuses a mismatch before any endpoint exists; a brief scaffolded before that
line existed warns once and launches on the flag. A batch carries one shared
contract that each pair still checks against its own brief. Scout and secondmate
spawns refuse the flags, and a scout now records no mode or yolo at all, which
teardown and the snapshot already tolerate. When the explicit mode carries less
rigor than the project's standing posture, a deviation notice is printed and the
spawn continues, so the registry stays advisory rather than an enforced default.

fm-promote requires the same two flags, because a scout carries no posture to
inherit, and writes them into the task record with the kind flip.

fm-project-mode keeps its one registry parser for the mechanical consumers that
have no task in hand, accepts the conditional no-mistakes-pr