Skip to content

feat(tests): run live harness guards by default when available - #3889

Merged
kunchenguid merged 9 commits into
mainfrom
fm/fm-live-guards-default-on-r1
Sep 7, 2026
Merged

kunchenguid merged 9 commits into
mainfrom
fm/fm-live-guards-default-on-r1

Conversation

@kunchenguid

@kunchenguid kunchenguid commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

Intent

Make the live guards run by default where the harness exists, with binaries-only CI coverage and no secrets. This is T7 of the ship plan in the scout report data/nm-live-e2e-by-default-s1/report.md (Part A, section A10), whose substance is: capability-gated default-on live guards through an fm_live_gate helper in tests/lib.sh and a live-capability expected class in bin/fm-test-run.sh; the Pi package installed in the portable serial CI lane with --fail-on-gate-skip on its token; and the guideline sentence in the firstmate-coding-guidelines skill. No secrets in CI.

The problem being solved, from the same report: firstmate has 24 live-harness guards that each open with their own environment opt-in, so on the machine that has every harness installed - the machine the product and its own validation actually run on - all 24 skip and pass. Fourteen of them have never been run by the validation pipeline at all, including every primary-harness guard. A skip is counted as a pass, so a guard that silently stops working is indistinguishable from one that ran. Nine of the guards also never source the shared test helpers, so the gate-refusal boundary in bin/fm-gate-refuse-lib.sh blocks them whenever the pipeline is the thing running them.

The captain's recorded answer on the CI question (C4 = b): binaries only. Token-free guards and the Pi-package tests run in CI; prompt-submitting guards stay on the captain's own machine. No credentials are added to CI.

What Changed

  • Centralize live-guard gating so token-free checks run by default when required tools exist, while prompt-submitting checks remain opt-in.
  • Classify and record live capability skips, including their reasons, in runner output and timing artifacts.
  • Install the public Pi package in portable serial CI and fail if Pi-package tests capability-skip, without adding credentials.

Risk Assessment

✅ Low: The shared gate migration, CI package coverage, authorized opt-in exceptions, and follow-up fixes are internally consistent with the stated intent, with no remaining concrete source defect found.

Testing

The focused gate and runner tests passed, all 25 live guards produced the shared FM_LIVE=0 refusal under a sanitized environment, real installed Pi and lavish-axi guards ran default-on without their opt-in variables, Pi package typechecking ran without a gate skip, and reviewer-visible transcripts plus runner JSON were captured.

Evidence: Real Pi default-on responsiveness guard transcript

Source: Real Pi default-on responsiveness guard transcript

pi 0.84.4 keystroke echo, worst observed: floor 62.9 ms, extension idle 56.2 ms, extension delivering 52.4 ms
ok - supervision outcome delivery keeps the real Pi 0.84.4 TUI echoing keystrokes at its unloaded floor
Evidence: Real lavish-axi bearings guard default-on transcript

Source: Real lavish-axi bearings guard default-on transcript

# lavish-axi 0.1.61
ok - lavish-axi 0.1.61 reports a captain-ended session without reopening it and without failing
ok - the board build reopens a captain-ended session against real lavish-axi instead of arming a dead one
Evidence: Live-capability runner transcript showing explicit skip classification and reason

Source: Live-capability runner transcript showing explicit skip classification and reason

FM_TEST_BEGIN 2026-09-07T02:16:26Z tests/fm-bearings-board-lavish-live-e2e.test.sh family=live-harness-optin expected_gate_skip=live-capability
skip: live: disabled by FM_LIVE=0
fm-test-run: gate skip: tests/fm-bearings-board-lavish-live-e2e.test.sh: live: disabled by FM_LIVE=0
FM_TEST_END 2026-09-07T02:16:26Z tests/fm-bearings-board-lavish-live-e2e.test.sh exit=0 duration_ms=93 gate_skip=true
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=1 duration_ms=209
FM_TEST_SUMMARY_FAMILY family=live-harness-optin count=1 duration_ms=93 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-bearings-board-lavish-live-e2e.test.sh duration_ms=93
fm-test-run: wrote timing artifact: ~/.no-mistakes/evidence/01M1WRVA898BKAC5WB7XQ9DH02/live-capability-timing.json
Evidence: Runner timing artifact recording live-capability gate-skip semantics

Source: Runner timing artifact recording live-capability gate-skip semantics

{
  "families": [
    {
      "count": 1,
      "duration_ms": 93,
      "failed": 0,
      "name": "live-harness-optin"
    }
  ],
  "finished_at": "2026-09-07T02:16:26Z",
  "run_id": "fm-test-run-1788747386350-86011",
  "scripts": [
    {
      "duration_ms": 93,
      "exit": 0,
      "expected_gate_skip": "live-capability",
      "family": "live-harness-optin",
      "gate_skip": true,
      "gate_skip_reason": "live: disabled by FM_LIVE=0",
      "path": "tests/fm-bearings-board-lavish-live-e2e.test.sh"
    }
  ],
  "selection": "scripts;jobs=1",
  "started_at": "2026-09-07T02:16:26Z",
  "summary": {
    "duration_ms": 209,
    "failed": 0,
    "skipped_gate": 1,
    "total": 1
  }
}

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed (4) ✅
  • 🚨 tests/fm-bearings-board-lavish-live-e2e.test.sh:26 - The required “capability-gated default-on live guards through an fm_live_gate helper” migration omits this live-harness-family guard. With lavish-axi installed and no FM_BEARINGS_LAVISH_LIVE setting, it still exits through its private opt-in check, so the token-free guard remains silently skipped and never receives the shared gate-refusal bypass. Wire it through fm_live_gate with the policy required by the stated intent.
  • 🚨 tests/fm-composer-matrix-live-e2e.test.sh:44 - This token-free guard is explicitly kept opt-in, contradicting the required “token-free guards ... run in CI” and capability-gated default-on behavior. On a host with tmux and installed harnesses but no FM_COMPOSER_MATRIX_LIVE setting, it still skips without examining them. The newly introduced host-trust exception and corresponding generalized guideline exceed the stated intent; remove the exception and restore the narrower default-on policy unless the captain authorizes containment.

🔧 Fix: Wire bearings guard and remove composer exception policy
1 error still open:

  • 🚨 tests/fm-pi-branch-responsiveness-live-e2e.test.sh:34 - The intent requires “Token-free guards ... run in CI,” but this guard remains opt-in. Its own contract states that it runs Pi offline and starts no model turn, so with Pi, tmux, and node installed it still skips unless FM_PI_BRANCH_RESPONSIVENESS_E2E=1. Make this gate default-on so the binaries-only CI lane and capable local hosts execute it.

🔧 Fix: Run Pi responsiveness guard by default
1 error still open:

  • 🚨 tests/fm-live-gate.test.sh:178 - The new whole-family sweep only matches *-live-e2e.test.sh and *-herdr-e2e.test.sh, so it misses fm-afk-pi-herdr-return-e2e.test.sh, even though the runner classifies that script as live-harness-optin. That guard retains its private opt-in check: FM_LIVE=0 or FM_LIVE=1 has no shared-gate effect, and its skip is nevertheless labeled live-capability by the changed runner. Include this guard in the executable sweep and migrate it to fm_live_gate opt-in FM_AFK_PI_HERDR_E2E herdr jq pi python3.

🔧 Fix: Gate AFK Pi Herdr through authoritative family sweep
1 warning still open:

  • ⚠️ tests/fm-live-gate.test.sh:186 - The family sweep sets FM_LIVE=0 but inherits every per-guard variable. Since fm_live_gate intentionally gives a guard's own =1 precedence over FM_LIVE=0, running the suite from a shell with (for example) FM_CLAUDE_LIVE_E2E=1 launches the real prompt-submitting guard instead of performing the promised cheap refusal sweep, then fails the assertion. Execute swept guards with their per-guard controls removed or under a sanitized environment while preserving required basics such as PATH and HOME.

🔧 Fix: Sanitize live gate test environments
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-live-gate.test.sh
  • bash tests/fm-test-run.test.sh
  • env -u FM_PI_BRANCH_RESPONSIVENESS_E2E -u FM_LIVE FM_TEST_SKIP_ORPHAN_REAP=1 bash tests/fm-pi-branch-responsiveness-live-e2e.test.sh
  • env -u FM_BEARINGS_LAVISH_LIVE -u FM_LIVE FM_TEST_SKIP_ORPHAN_REAP=1 bash tests/fm-bearings-board-lavish-live-e2e.test.sh
  • Sanitized-environment runner check: FM_LIVE=0 bin/fm-test-run.sh --json … tests/fm-bearings-board-lavish-live-e2e.test.sh
  • bin/fm-test-run.sh --fail-on-gate-skip 'installed @earendil-works/pi-coding-agent package not found' tests/fm-pi-primary-types.test.sh
  • Verified git status --short remained clean and no tested live processes remained
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…installed

The 24 live-harness guards each opened with their own env check, so on the
machine that has every harness - the one the product and its validation
actually run on - all of them skipped and passed. Fourteen had never been run
by the pipeline at all.

tests/lib.sh gains fm_live_gate as the single owner of that decision: a guard
that spends no model tokens runs wherever its tools are installed, a guard that
submits prompts stays opt-in, an absent tool is a named capability skip, and a
guard's own variable or FM_LIVE forces it on (turning an absent tool into a
failure) or off. Every live guard now opens with it, which also carries the
test-suite gate-refusal bypass into the guards that never sourced the shared
helpers and were therefore refused whenever a gate agent ran them.

bin/fm-test-run.sh records what a skip means: the family's expected class is
live-capability rather than a bare env opt-in, and each gate skip's reason is
logged and written to the timing artifact, so a lane can say which tool this
host could not exercise.

Only the token-free guards flip to default-on: composer-matrix, the harness
liveness drift guard, and the Herdr version floor. cursor-primary submits three
prompts, so it stays opt-in.

Running the drift guard unasked immediately found a real defect it existed to
catch: it resolved the harness through a generic `command -v cursor`, which on
a machine that also has the Cursor editor finds the editor launcher rather than
cursor-agent. That binary exits at once, leaving a bare shell in the pane and a
liveness-drift failure no classifier change could fix. It now asks
fm_cursor_resolve_binary first, the same verified owner fm-spawn uses.

CI installs the public Pi package in the portable serial lane and fails on its
skip token, so the Pi extension tests stop passing silently against a package
that is not there. No secret is added.

Verified on macOS 26.5.2 arm64: the drift guard runs with no variable set and
classifies 8 installed harnesses alive; the Herdr version-floor guard runs by
default and checks 4 real releases; every live guard refuses together under
FM_LIVE=0.
Running it unasked is red on a healthy machine for reasons no code change here
removes: a harness that has not trusted this checkout sits on its own trust
dialog, which the guard treats as an unreadable composer and correctly fails.
The opencode 1.18.29 and grok 1.0.13 composer drift it also surfaced reproduces
identically on main and is filed as separate work.

So this token-free guard stays opt-in with the reason stated in its header, and
the coding guidelines record the narrow exception: a guard whose verdict
depends on host state that installing its tools does not establish may stay
opt-in, because one that is permanently red is one the fleet learns to ignore.
The other two token-free guards keep running by default.
@greptile-apps

greptile-apps Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; both previously reported CI gaps are closed because the Pi typecheck runs in portable-parallel-1 with its package installed and every current prerequisite skip matches the lane’s failure token.

Reviews (3): Last reviewed commit: "no-mistakes(ci): Fixed CI’s Pi typecheck..." | Re-trigger Greptile

Comment thread .github/workflows/ci.yml Resolved
…rallel-1, where fm-pi-primary-types.test.sh runs, and enforcing its package-missing gate skip there. Verified with fm-lint.sh, workflow actionlint, coverage partition checks, lane membership, and git diff checks
Comment thread .github/workflows/ci.yml Resolved
…pm, tsc, and Pi-package capability skips a shared prefix and configuring both relevant CI lanes to fail on that prefix. Verified missing tsc emits the expected skip, missing Pi package becomes a runner failure, and actionlint, ShellCheck, and git diff checks pass
@kunchenguid
kunchenguid merged commit 5592cb6 into main Sep 7, 2026
15 of 16 checks passed
@kunchenguid
kunchenguid deleted the fm/fm-live-guards-default-on-r1 branch September 7, 2026 03:30
rinnikha added a commit to rinnikha/firstmate that referenced this pull request Sep 7, 2026
…-compaction (#1)

* feat(tests): run live harness guards by default when available (kunchenguid#3889)

* feat(tests): run live harness guards by default where the harness is installed

The 24 live-harness guards each opened with their own env check, so on the
machine that has every harness - the one the product and its validation
actually run on - all of them skipped and passed. Fourteen had never been run
by the pipeline at all.

tests/lib.sh gains fm_live_gate as the single owner of that decision: a guard
that spends no model tokens runs wherever its tools are installed, a guard that
submits prompts stays opt-in, an absent tool is a named capability skip, and a
guard's own variable or FM_LIVE forces it on (turning an absent tool into a
failure) or off. Every live guard now opens with it, which also carries the
test-suite gate-refusal bypass into the guards that never sourced the shared
helpers and were therefore refused whenever a gate agent ran them.

bin/fm-test-run.sh records what a skip means: the family's expected class is
live-capability rather than a bare env opt-in, and each gate skip's reason is
logged and written to the timing artifact, so a lane can say which tool this
host could not exercise.

Only the token-free guards flip to default-on: composer-matrix, the harness
liveness drift guard, and the Herdr version floor. cursor-primary submits three
prompts, so it stays opt-in.

Running the drift guard unasked immediately found a real defect it existed to
catch: it resolved the harness through a generic `command -v cursor`, which on
a machine that also has the Cursor editor finds the editor launcher rather than
cursor-agent. That binary exits at once, leaving a bare shell in the pane and a
liveness-drift failure no classifier change could fix. It now asks
fm_cursor_resolve_binary first, the same verified owner fm-spawn uses.

CI installs the public Pi package in the portable serial lane and fails on its
skip token, so the Pi extension tests stop passing silently against a package
that is not there. No secret is added.

Verified on macOS 26.5.2 arm64: the drift guard runs with no variable set and
classifies 8 installed harnesses alive; the Herdr version-floor guard runs by
default and checks 4 real releases; every live guard refuses together under
FM_LIVE=0.

* fix(tests): keep the composer-matrix guard opt-in

Running it unasked is red on a healthy machine for reasons no code change here
removes: a harness that has not trusted this checkout sits on its own trust
dialog, which the guard treats as an unreadable composer and correctly fails.
The opencode 1.18.29 and grok 1.0.13 composer drift it also surfaced reproduces
identically on main and is filed as separate work.

So this token-free guard stays opt-in with the reason stated in its header, and
the coding guidelines record the narrow exception: a guard whose verdict
depends on host state that installing its tools does not establish may stay
opt-in, because one that is permanently red is one the fleet learns to ignore.
The other two token-free guards keep running by default.

* no-mistakes(review): Wire bearings guard and remove composer exception policy

* no-mistakes(review): Run Pi responsiveness guard by default

* no-mistakes(review): Gate AFK Pi Herdr through authoritative family sweep

* no-mistakes(review): Sanitize live gate test environments

* no-mistakes(document): Document default-on live guard behavior

* no-mistakes(ci): Fixed CI by installing the Pi package in portable-parallel-1, where fm-pi-primary-types.test.sh runs, and enforcing its package-missing gate skip there. Verified with fm-lint.sh, workflow actionlint, coverage partition checks, lane membership, and git diff checks

* no-mistakes(ci): Fixed CI’s Pi typecheck skip enforcement by giving npm, tsc, and Pi-package capability skips a shared prefix and configuring both relevant CI lanes to fail on that prefix. Verified missing tsc emits the expected skip, missing Pi package becomes a runner failure, and actionlint, ShellCheck, and git diff checks pass

* feat(spawn): add config/crew-autocompact-pct for claude crewmate/scout auto-compaction

Adds a local, gitignored knob so a home can set Claude's real
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE threshold for its own claude crewmates and
scouts, without imposing one operator's number on every firstmate user or on
firstmate's own primary session.

- fm-spawn.sh validates the file (bare integer 1-99) before any endpoint or
  worktree is created, refusing the spawn with an actionable error on a
  malformed or out-of-range value, and prefixes the claude launch template
  with CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=<n> for crewmate/scout kinds only.
- Added to FM_INHERITABLE_CONFIG so it propagates into secondmate homes
  through the existing inherited local-material path, including the
  config-reread nudge to an already-running secondmate.
- Documented in docs/configuration.md and pointed to from AGENTS.md section 2
  and the secondmate-provisioning skill's inherited-material lists.

* no-mistakes(document): align crew-autocompact-pct doc wording with durable behavior

* fix(tests): quote hyphenated id literal to silence ShellCheck SC2100 false positive

* no-mistakes(document): point crew-autocompact-pct inheritance at fm_config_inherit_items owner

* no-mistakes(review): reject interior whitespace in config/crew-autocompact-pct

* no-mistakes(document): document crew-autocompact-pct whitespace intent and test pointer

---------

Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: rinnikha <[email protected]>
eduardstan added a commit to eduardstan/firstmate that referenced this pull request Sep 7, 2026