Skip to content

test: consolidate lifecycle behavior coverage - #80

Merged
kunchenguid merged 6 commits into
mainfrom
fm/tests-consolidate-c6
Jun 25, 2026
Merged

kunchenguid merged 6 commits into
mainfrom
fm/tests-consolidate-c6

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

Implement the firstmate test-suite consolidation specified by the audit report at data/tests-e2e-t7/report.md. Goal: move operator-visible lifecycle behavior into a few real end-to-end tests, table-drive repetitive cases, and add a shared test helper, WITHOUT weakening any safety-critical coverage - net result a smaller, less brittle suite with similar-or-better real coverage and runtime under ~2-3 minutes.

Key decisions and tradeoffs (so the diff's deletions read as intentional, not lost coverage):

  • Added tests/lib.sh (fail/pass, self-cleaning temp root, fakebin/git/meta helpers, common assertions) plus two behavior-area helper libraries (tests/secondmate-helpers.sh, tests/wake-helpers.sh) for the fakes that encode lifecycle/terminal behavior and don't belong in the generic lib. All test files were refactored onto these incrementally, keeping the suite green at every step.
  • Split the two giant files by behavior area: fm-secondmate.test.sh became fm-secondmate-lifecycle-e2e.test.sh (happy-path operator flow) + fm-secondmate-safety.test.sh (safety matrices/units); fm-wake-queue.test.sh became fm-wake-queue.test.sh (queue losslessness) + fm-watcher-lock.test.sh + fm-daemon.test.sh.
  • Added two new e2e tests the report specifies: fm-secondmate-lifecycle-e2e (seed -> spawn -> routed send -> backlog handoff -> recovery respawn -> teardown, asserting the durable contracts) and fm-wake-daemon-lifecycle-e2e (routine self-handle, terminal status written while the watcher is down then caught on restart, exactly one buffered digest, no duplicate from housekeeping, and a stale transient->persistent->resume phase).
  • Expanded fm-afk-inject-e2e with a normal single-digest scenario, and DELETED five overlapping fake-tmux injection cases (afk_present_injects_with_marker, inject_digest_is_single_line, composer_guard_defers_on_partial_input, inject_types_once_retries_enter_only, inject_no_duplicate_on_success) that the real-tmux e2e now owns; persistent-Enter-swallow stays as a compact unit because the e2e only swallows once.
  • Table-driven: secondmate teardown path-boundary matrix (unmarked/ancestor/active-descendant/repo-descendant folded 3 functions into 1), watch-arm started/self-heal (folded 2 cases), guard warnings (folded 4 into 1 with resilient substrings + ordering checks), spawn-batch and bootstrap parsers, and fm-update worlds (combined T1+T2 single-parent FF, and T7+T8 registry backstop/dedup/self-exclusion).
  • Added timeout-minutes: 15 to the behavior-test CI job (was riding GitHub's 360-minute default).
  • Deliberately NOT weakened (kept as focused matrices/units because an e2e cannot deterministically cover them): fm-teardown unlanded-work safety matrix (all 7 cases), lock-primitive races + watcher singleton/self-evict/restart, wake-queue losslessness and no-duplicate escalation, secondmate path-boundary validation on every entrypoint (active FM_HOME, firstmate repo, symlinks resolving outside, nested registered homes, child worktrees, failed lease return), fast-forward-only update skips (dirty/diverged/wrong-branch/detached/unsafe-home), the captain-relevant status-phrase matrix, and no-mistakes init of newly-cloned projects / origin-URL preservation / never-write-through-a-project.
  • Deliberately kept the watch-arm hup-cleanup, immediate-wake, and peer-beacon-race cases as separate units rather than forcing them into a table: their control flow is heterogeneous (some arm calls return immediately, others block on a forked child), and the constraint to preserve watcher-liveness coverage outweighed a presentational merge.
  • Did NOT touch AGENTS.md or .agents/skills/ because a separate change to those is in flight on another branch (PR docs: restructure firstmate agent guidance #79); the README test-file listing was updated to match the new structure instead.

Every removed or folded case was cross-checked against a new e2e phase or a retained matrix so no assertion was lost (only acceptable losses per the report: exact stdout copy and internal send-keys counts). Full suite is green (156 assertions across 12 files, ~2:00 wall clock) and shellcheck-clean.

What Changed

  • Consolidates the shell behavior suite around shared test helpers, splitting secondmate and wake coverage into lifecycle e2e flows plus focused safety and losslessness matrices.
  • Adds real lifecycle coverage for secondmate routing/recovery/teardown, wake daemon restart and digest behavior, and AFK injection paths while preserving critical negative assertions.
  • Updates CI and test documentation for the new suite layout, including a 15-minute behavior-test timeout.

Risk Assessment

✅ Low: Captain, the remaining diff is confined to tests, README test listings, and a CI timeout/tmux preflight, with prior coverage gaps now explicitly covered.

Testing

Baseline inspection confirmed the change is a test-suite consolidation; the CI-equivalent shell behavior suite passed in 122 seconds, including the secondmate lifecycle e2e, wake-daemon lifecycle e2e, expanded AFK injection e2e, and retained safety matrices; lifecycle transcript artifacts were captured, and git status --short showed no transient working-tree files left behind.

Evidence: Full behavior test transcript
Command: for test_script in tests/*.test.sh; do "$test_script"; done
Started: 2026-06-25T08:35:25Z

## tests/fm-afk-inject-e2e.test.sh
ok - Scenario A: partial input defers injection; digest arrives clean after idle
ok - Scenario B: swallowed Enter produces exactly one clean digest
ok - Scenario C: a normal captain status injects exactly one clean single-line sentinel digest
all e2e injection tests passed

## tests/fm-bootstrap.test.sh
ok - bootstrap reports treehouse lease + tasks-axi compatibility contracts

## tests/fm-composer-ghost.test.sh
ok - fm_tmux_strip_ghost drops dim/faint runs, keeps normal and bold text
ok - fm_tmux_strip_ghost handles combined SGR, ESC[22m, and reset-then-dim
ok - fm_tmux_strip_ghost keeps colored text with 2 payloads
ok - fm_pane_input_pending: a dim ghost-only composer is NOT pending
ok - fm_pane_input_pending: dim ghost inside a bordered composer is NOT pending
ok - fm_pane_input_pending: normal-intensity typed text is still pending
ok - fm_pane_input_pending: colored text with 2 payloads is still pending
ok - fm_pane_input_pending: real text plus a trailing ghost run is still pending
ok - fm-peek output is escape-free (no raw -e bytes reach firstmate context)

## tests/fm-daemon.test.sh
ok - supervise daemon state root is scoped by FM_HOME
ok - routine signal self-handles
ok - captain-relevant status verbs escalate
ok - check + unknown escalate; heartbeat self-handles
ok - transient stale self-handles and records a persistence marker
ok - stale + terminal status escalates immediately
ok - persistent stale escalates after threshold and clears its marker
ok - resumed (busy) stale clears its marker without escalating
ok - multiple escalations flush as a single batched digest
ok - batch flush measures max-delay from the first append, not the last
ok - catch-all scan escalates a missed terminal once, not twice
ok - handle_wake routes routine->self and captain->escalate
ok - INJECT_SKIP forces self-handle, bypassing captain-relevant classification
ok - is_wake_reason distinguishes watcher wake reasons from singleton-status stdout
ok - terminal-stale escalate removes its marker so housekeeping does not re-escalate
ok - captain signal escalate marks seen so the catch-all scan does not re-fire
ok - _collapse_newlines replaces newlines with literal separator
ok - afk flag absent: daemon does not inject, buffer preserved
ok - busy-guard defers injection when supervisor pane is busy
ok - marker detection: marker -> stay afk, no marker -> exit afk
ok - /afk invocation is exempt from afk exit (no self-cancel)
ok - should_exit_afk returns false when afk is not active
ok - strip_injection_marker removes the sentinel marker cleanly
ok - pane_input_pending detects partial input on the cursor line
ok - pane_input_pending: blank cursor line is not pending
ok - pane_input_pending: bare prompts are not pending (idle)
ok - pane_input_pending honors FM_COMPOSER_IDLE_RE after border stripping
ok - classify_signal dedupes against the catch-all scan seen marker
ok - classify_stale dedupes against the signal path seen marker
ok - pane_input_pending: an idle bordered composer is NOT pending (afk-invx-i5)
ok - pane_input_pending: text inside a bordered composer is still pending
ok - submit-ACK confirms a submit when the composer returns to a bordered-empty box
ok - submit-ACK reports pending on a persistently swallowed Enter (type-once)
ok - max-defer on an empty stuck pane types once, alarms, and preserves the buffer
ok - max-defer flushes and clears the buffer on an empty bordered pane
ok - max-defer on a pending composer alarms without typing
ok - normal flush clears a stale wedge marker
ok - below MAX_DEFER: no inject, no alarm, buffer preserved
ok - max-defer does not flush or alarm while afk is inactive
ok - fm-send exits non-zero on a confirmed swallow, zero on a clean submit
ok - fm-send exits non-zero when initial text send fails

## tests/fm-secondmate-lifecycle-e2e.test.sh
ok - seed: registry scope+projects, charter copied, clones+origins, no-mistakes init in subhome only
ok - spawn: launches in the subhome with persistent charter, records routing meta
ok - send: a bare fm-<id> routes to the window recorded in this home's meta
ok - handoff: in-scope items move verbatim, out-of-scope stays, idempotent
ok - recovery: respawns from the durable registry and persistent home
ok - teardown: removes the home, then clears meta and the registry route

## tests/fm-secondmate-safety.test.sh
ok - FM_HOME parameterizes data and state paths
ok - fm-lock status is scoped per home
ok - seed allows overlapping project clone lists and drops the owns/owner routing
ok - home seed validation rejects duplicate home routes
ok - home seed validation rejects duplicate id routes
ok - home seed validation rejects nested home routes
ok - home seeding durably leases treehouse-acquired dash homes under the secondmate id
ok - home seeding returns rejected acquired homes through treehouse
ok - home seed rollback warns when treehouse-acquired return fails
ok - home seeding leaves unsafe acquired active homes untouched
ok - home seeding rolls back failed clone attempts without residue
ok - home seeding refuses direct seed without filled charter text
ok - home seeding refuses unfilled placeholder charters
ok - home seeding refuses empty normalized charter fields
ok - home seeding refuses local-only projects
ok - home seeding refuses registry delimiter home paths
ok - home seeding refuses active home and repo root
ok - home seeding refuses homes marked for another id
ok - home seeding refuses homes registered to another id
ok - home seeding refuses same-id reassignment to a different home
ok - home seeding refuses registered home overlaps
ok - remote-backed subhome seeding requires a source origin
ok - remote-backed subhome seeding validates existing destination origins
ok - home seeding resolves relative source origins against the source project
ok - home seeding skips initialized existing no-mistakes clones
ok - home seeding refuses uninitialized existing no-mistakes clones
ok - home seeding refuses project destinations outside the subhome
ok - home seeding refuses operational directories outside the subhome
ok - home seeding refuses symlinked leaf files
ok - secondmate spawn validates homes before launch
ok - secondmate spawn refuses operational directories outside the subhome
ok - fm-send refuses a bare firstmate window with no metadata in this home
ok - secondmate teardown retires empty homes and releases routing
ok - secondmate teardown refuses to hide failed leased-home return
ok - secondmate teardown raw-removes plain-clone homes
ok - secondmate force teardown discards child work
ok - force teardown allows operational directory symlinks inside the subhome
ok - force teardown refuses operational directory symlinks outside the subhome
ok - secondmate teardown refuses homes containing registered nested homes
ok - secondmate teardown refuses nested homes from the child registry
ok - force teardown validates subhome before child cleanup
ok - force teardown refuses child worktrees inside the active home
ok - force teardown refuses child worktrees inside the firstmate repo
ok - force teardown refuses unregistered child worktree paths
ok - secondmate teardown path-boundary matrix refuses unmarked/ancestor/active-descendant/repo-descendant homes
ok - idle kind=secondmate pane is healthy and not stale
ok - secondmate charter brief is idle by default and does not self-initiate work
ok - fm-backlog-handoff aborts atomically on unmatched, in-flight, and unregistered targets
ok - fm-backlog-handoff creates absent sections and refuses unsafe homes

## tests/fm-spawn-batch.test.sh
ok - batch dispatch re-execs and reports every id=repo pair
ok - batch detection: single pair batches, non-pair rejected, single-task and slash-id stay single
ok - projects/ paths are scoped through the firstmate home for single-task spawn

## tests/fm-teardown.test.sh
ok - local-only worktree with HEAD on a fork remote is torn down (fix holds)
ok - teardown prompts tasks-axi backlog refresh when compatible
ok - local-only worktree with truly unpushed work is refused (safety preserved)
ok - local-only worktree with work merged into local main is torn down (no regression)
ok - no-mistakes worktree with HEAD on origin is torn down (no regression)
ok - no-mistakes worktree with truly unpushed work is refused (no regression)
ok - local-only worktree with unpushed work is torn down under --force (escape hatch)

## tests/fm-update.test.sh
ok - T1 main + secondmate fast-forward (single-parent), reread + nudge signalled
ok - T3 reread gates on instruction surface, nudge on advancement
ok - T4 dirty secondmate skipped, local edit preserved
ok - T5 diverged secondmate skipped, local commit preserved
ok - T6 idempotent: a second run is a no-op
ok - T7 registry backstop resolves, dedups meta+registry, excludes the firstmate repo
ok - T9 firstmate off its default branch is skipped, not forced
ok - T10 firstmate detached HEAD is skipped
ok - T11 unsafe secondmate home is not fast-forwarded
# all fm-update tests passed

## tests/fm-wake-daemon-lifecycle-e2e.test.sh
ok - lifecycle: routine self-handles, terminal survives a watcher restart, buffers once, no dup, injects once
ok - lifecycle: stale pane transient self-handles, persistent escalates once and clears, resumed clears quietly

## tests/fm-wake-queue.test.sh
ok - concurrent append plus drain preserves queue records
ok - signal written while no watcher runs is caught on next run
ok - stale wake is queued before suppressor state is advanced
ok - check output is queued before cadence suppression
ok - two atomic drains cannot consume the same records twice
ok - drain collapses obvious duplicate heartbeat and signal records

## tests/fm-watcher-lock.test.sh
ok - simultaneous watcher starts leave exactly one live process
ok - killed watcher stale lock is reclaimed
ok - live watcher lock with stale heartbeat is actionable
ok - guard banner leads when down with pending wakes (re-arm-after-drain) and stays silent when fresh
ok - concurrent fm_lock_try_acquire yields exactly one winner
ok - dead-pid stale lock is reclaimed by a single acquirer
ok - concurrent stale-lock steal yields exactly one winner
ok - live steal mutex is not reclaimed
ok - live-held lock is not stolen
ok - empty mid-acquire lock keeps a minimum grace
ok - late original claimant cannot claim a recreated lock
ok - paused mid-acquire claimant backs off to active stealer
ok - watch restart refuses to signal a reused pid
ok - watcher self-evicts when the lock pid no longer names it
ok - arm reports a live fresh watcher as healthy and exits zero
ok - arm starts+confirms a fresh watcher on a clean lock and self-heals a dead-pid lock (never healthy off a dead pid)
ok - arm cleans child watcher and temp output on HUP
ok - arm propagates an immediate watcher wake before confirmation
ok - arm waits for a peer watcher beacon after child stands down
ok - arm reports FAILED and exits non-zero when no fresh watcher can be confirmed

Finished: 2026-06-25T08:37:27Z
Elapsed seconds: 122
Evidence: Lifecycle evidence excerpt
## tests/fm-afk-inject-e2e.test.sh
ok - Scenario A: partial input defers injection; digest arrives clean after idle
ok - Scenario B: swallowed Enter produces exactly one clean digest
ok - Scenario C: a normal captain status injects exactly one clean single-line sentinel digest
all e2e injection tests passed

## tests/fm-secondmate-lifecycle-e2e.test.sh
ok - seed: registry scope+projects, charter copied, clones+origins, no-mistakes init in subhome only
ok - spawn: launches in the subhome with persistent charter, records routing meta
ok - send: a bare fm-<id> routes to the window recorded in this home's meta
ok - handoff: in-scope items move verbatim, out-of-scope stays, idempotent
ok - recovery: respawns from the durable registry and persistent home
ok - teardown: removes the home, then clears meta and the registry route

## tests/fm-wake-daemon-lifecycle-e2e.test.sh
ok - lifecycle: routine self-handles, terminal survives a watcher restart, buffers once, no dup, injects once
ok - lifecycle: stale pane transient self-handles, persistent escalates once and clears, resumed clears quietly

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed (3) ✅
  • ⚠️ tests/fm-afk-inject-e2e.test.sh:28 - This e2e exits 0 when tmux is missing, but this branch removes the fake-tmux unit checks for marker, single-line, and no-duplicate injection behavior and moves that operator-visible coverage here. CI does not explicitly install or require tmux, so a runner image change could silently drop that coverage while the job stays green. Make tmux required in CI or keep a small non-skipping unit fallback for those contracts.

🔧 Fix: Require tmux for AFK e2e coverage
1 warning still open:

  • ⚠️ tests/fm-afk-inject-e2e.test.sh:203 - This self-check still exits 0 when real tmux cannot expose typed composer text, but the consolidation now relies on this e2e for the marker, single-line, no-duplicate, and partial-input injection contracts. In CI, that would silently skip the replacement coverage even though tmux is present. Make this fail under CI or otherwise require the e2e coverage instead of treating it as a passing skip.

🔧 Fix: Captain, require AFK e2e self-check coverage
1 warning still open:

  • ⚠️ tests/fm-secondmate-lifecycle-e2e.test.sh:123 - phase_spawn no longer checks that codex secondmate launches omit the parent turn-end hook. The old unit rejected notify= and turn-ended; with only the positive charter/FM_HOME assertions here, a regression that uses the normal codex launch template for secondmates would still pass while causing isolated secondmates to write parent turn-end signals. Add negative assertions for notify= and turn-ended in the launch log.

🔧 Fix: Captain: preserve secondmate launch isolation coverage
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Inspected the test-suite diff with git diff --stat 9e21160a2393850f4a17ece8c473cfc226ef4734..fb499a8ab2fc3f21b9e592a47997d6b07683ca90.
  • Reviewed the CI test entrypoint and relevant consolidated tests: tests/lib.sh, tests/fm-secondmate-lifecycle-e2e.test.sh, tests/fm-wake-daemon-lifecycle-e2e.test.sh, .github/workflows/ci.yml, and the README test list.
  • Ran the CI-equivalent behavior suite without lint/static analysis: for test_script in tests/*.test.sh; do &#34;$test_script&#34;; done.
  • Captured reviewer evidence to /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KVYX4R3BFYR4P8PXZBBJ73PB/behavior-tests-transcript.txt.
  • Extracted the operator-visible e2e phases to /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KVYX4R3BFYR4P8PXZBBJ73PB/lifecycle-evidence-excerpt.txt.
  • Checked cleanup with git status --short.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…elpers

Move operator-visible lifecycle behavior into focused end-to-end tests, table-
drive repetitive cases, and add shared test helpers, without weakening any
safety-critical coverage.

- Add tests/lib.sh (reporters, self-cleaning temp root, fakebin/git/meta
  helpers, common assertions) plus behavior-area helpers tests/secondmate-
  helpers.sh and tests/wake-helpers.sh; refactor every test file onto them.
- Split the two giant files by behavior area: fm-secondmate -> lifecycle e2e +
  safety; fm-wake-queue -> wake-queue losslessness + fm-watcher-lock +
  fm-daemon.
- Add fm-secondmate-lifecycle-e2e (seed -> spawn -> routed send -> backlog
  handoff -> recovery respawn -> teardown) and fm-wake-daemon-lifecycle-e2e
  (routine/terminal routing across a watcher restart, one buffered digest, no
  duplicate, stale transient/persistent/resume).
- Expand fm-afk-inject-e2e with a normal single-digest scenario and delete the
  five overlapping fake-tmux injection cases (persistent-swallow kept as a unit).
- Table-drive the secondmate teardown path-boundary matrix, watch-arm
  started/self-heal, guard warnings, spawn-batch and bootstrap parsers, and the
  fm-update worlds.
- Add an explicit timeout-minutes (15) to the behavior-test CI job.

Preserved as focused matrices/units: teardown unlanded-work safety, lock-
primitive races and watcher singleton, wake-queue losslessness and no-duplicate
escalation, secondmate path-boundary validation on every entrypoint, fast-
forward-only update skips, the captain-relevant status-phrase matrix, and
no-mistakes init / origin preservation / never-write-through-a-project.
@kunchenguid
kunchenguid merged commit ff353de into main Jun 25, 2026
4 checks passed
@kunchenguid
kunchenguid deleted the fm/tests-consolidate-c6 branch June 25, 2026 08:57
stoneevenson-biz added a commit to stoneevenson-biz/firstmate that referenced this pull request Aug 27, 2026
Post-rebase reconciliation after upstream restructured the test suite (kunchenguid#80)
and the brief contract (kunchenguid#73):

- bin/fm-brief.sh: collapse the gate-check definition-of-done clause, which had
  landed once per delivery-mode heredoc (3x), into a single GATE_CHECK variable
  appended once after the mode DOD. Identical brief output, no duplication.
- tests/fm-secondmate-lifecycle-e2e.test.sh: re-land the scoped-watch coverage
  on the relocated spawn phase — stub the watch start via FM_CTX_WATCH_START_CMD
  (no leaked daemon) and assert a secondmate spawn starts a context-watch scoped
  to its own home; stub the recovery respawn's watch start too.
- tests/fm-tangle-guard.test.sh: assert the crew-launch FM_HOME pin on the
  existing genuine-isolated-worktree success path (the post-kunchenguid#83 harness that can
  actually reach a successful ship launch), proving a crew launch pins FM_HOME to
  the spawning home for context-sentinel routing; teach its fake tmux to log
  send-keys so the launch env is observable.

Full suite green (24 files), shellcheck clean, zero leaked daemons.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 2, 2026
…unchenguid#80)

* fix(tests): make jobs scheduler and Pi hung-successor checks deterministic

Replace the jobs=2 0.5s/0.05s race with marker handshakes, and start the Pi
ready-timeout only after first successor stdout so spawn latency is not treated
as a hung watcher.

Co-authored-by: Cursor <[email protected]>

* no-mistakes(document): Document Pi watcher spawn grace semantics

---------

Co-authored-by: Cursor <[email protected]>
@witt3rd

witt3rd commented Nov 4, 2026

Copy link
Copy Markdown

Rebased onto main b955568 (stack #80 <- #84 <- #87 <- #93), tier1 green. Current numbers (supersede the first-push tables): handler mass 109,157 -> 107,680 (-1,477), spec 59,544 -> 61,396, share 34.76% -> 35.76%

@nclsndr

nclsndr commented Nov 11, 2026

Copy link
Copy Markdown

Recorded agent runs

Two fresh agents were given only the two built-in skills (and their linked references) plus a wrapper tack bound to an isolated HOME and state directory, with the operator's request verbatim. Each reported every command it ran and every file it wrote. Records are kept with the task data; the key facts:

Add a second skills folder (operator: "pick up the skills in its vendor/skills folder"; the source's maintainers was only the operator, and vendor/skills/review clashed with skills/review).

  • Read manage-tack-sources, ran tack --json source (saw maintainers: [nico], one declaration) and tack --json catalog (clean) before editing.
  • Edited in place, adding only - path: vendor/skills under skills. Valid declaration; nothing else changed.
  • Re-ran tack --json catalog (exit 1, partial) and tack --json source, read the two skill-address-duplicate issues and the declarations' problems, and told the operator the clash needed a rename or delete, which it did not choose for them. It ran no sync, pick or state command.

Create a source (operator: new source with one skill meeting-notes, registered).

  • Wrote tack.yaml with version: 1, name, maintainers and skills: [{ path: skills }], then one skill, then source add, then catalog (clean) and source (one declaration, 1 resource, no problems). No sync or pick.

What the runs changed in the skill: they asked what to expect when catalog exits 1 and that source stays healthy while a declaration has problems, so manage-tack-sources now says to read issues and every declaration's problems before reporting success.

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 18, 2026
… cleanup and relaunch (kunchenguid#80)

* fix(bin): stop processes a job left in its copies at cleanup and relaunch

A test loop or server a finished job started in its validation copy kept
running after cleanup, because cleanup only stopped processes whose working
directory was the task's own copy and only while that directory existed.

Cleanup now also stops processes in the validation copies of the task's
finished no-mistakes runs, still matches a copy that was already deleted,
and matches a process running a file from inside a copy. Relaunch stops
the same leftovers in finished validation copies before the replacement
starts. Every stopped process is logged with its command line.

* no-mistakes(review): Scan copies in one lsof pass, narrow arg match

* no-mistakes(document): Document the ship relaunch reap in agent-control

* no-mistakes(lint): Spell out grep flags to pass the leak guard
@wfoxe

wfoxe commented Nov 20, 2026

Copy link
Copy Markdown

E8 scored for the first time: the gate passes, the atlas claim is not supported on readout edits

E8 (edit prediction on the archived pi0.5 atlas capture) had never scored a predictions file. This PR adds the
tooling to score it honestly, and records the first pre-registered reading. The scorer, the [E8] thresholds, the
known-answer gates and every other eval are unchanged.

The claim, predicted against measured

Claim (C-1): predictions made with the published atlas, before the run, pass E8's rule on a frozen pool. C-2: they
beat predictions made without the atlas, through the same scorer.

Every number is about checkpoint b796bba016ee084b71b6f465c9a0ce09d5d55d34a09ac64ac4ecb2caa49cdde4. Measured on
the 48 held-out episodes (712,623 rows) in scoring run gke:weight-forge/gct-c2e71bcc8679928e (commit
3d92613), pool d578f4c4a7307ab2c1dac68b95f0f40c53c763d0ef05735b978fa2f822ca7bda:

predictor predicted sign / Spearman / coverage measured sign / Spearman / coverage E8
posctrl (training mean, from run gct-bd12135b33ecd639) 0.80 / 0.82 / 0.75 (revised from 0.98 on a training-only dry run, before scoring) 0.785 / 0.868 / 0.822 supported
posctrl A/A copy identical identical supported
shuffled x5 0.47 / 0.10 / 0.25 0.35-0.43 / -0.15-0.01 / 0.21-0.28 all fail
gaming per pair / per unit 0.48 / 0.50 0.521 / 0.473 fail
no-change 0.06 0.109 fail
atlas agents x4 (mean) 0.64 / 0.45 / 0.70 0.545 / 0.469 / 0.839 (0.532, 0.580, 0.572, 0.497) 0 of 4 pass
no-atlas agents x4 (mean) 0.62 / 0.45 / 0.70 0.513 / 0.486 / 0.694 (0.481, 0.497, 0.524, 0.548) 0 of 4 pass
  • Gap atlas - no-atlas: predicted +0.02, measured +0.033.
  • Mean A/A spread: predicted 0.06, measured 0.043 (noise floor 0.043).
  • Unit-level exact sign test: 17 / 16 / 13 ties, p = 1.0.
  • Agent-level exact permutation test: p = 0.26.
  • Resolution: 4 agents per arm and one model can only see a gap of about 0.086 or more. "Adds nothing
    measurable" excludes a gap that large, not a smaller one.
  • The agents are not independent draws. The no-atlas agents agree on 75-91 % of sign pairs, and atlas-1r agrees
    with noatlas-4 on 97.3 %.
  • Sensitivity (scored after the fact): swapping in the two void files (0.559, 0.489) for their reruns gives a gap
    of +0.037.

Predictions sha256 (all hashed into one status line before the scoring run):

file sha256
atlas-1r ca159ecc…
atlas-2 88d2e909…
atlas-3 09db24e3…
atlas-4 f6a92124…
noatlas-1r adb0528d…
noatlas-2 bf3f17cb…
noatlas-3 050552c4…
noatlas-4 0ab56b7f…
posctrl / posctrl_aa 8a5ea84b…
gaming 8b09cb47…
gaming_unit 75267ca5…
nochange e47a5b64…
shuffled s0-s4 b9b78e2b…, 775d84ed…, 1c6f2119…, 737b6af4…, e90b1213…

The full hashes are in docs/experiments/e8-predict-2026-11-20/predictions/SHA256SUMS.

The E8 verdict and what the eval can and cannot see

  • Verdict on this pool: evaluable (the gate passes); the claim is not_supported. With the atlas, agents
    fail the rule; without it they do no worse in any way the noise can resolve. Per prereg kill line K3, the atlas
    arm's input set lacked any statistic of the readout input.
  • Can see: whether a predictor holds the held-out mean mu of the readout input along each edit's rows. A patch
    to action_out_proj has effect exactly dW @ mu + db. The training-split mean holds enough to pass. It is not
    exact: it gets 21.5 % of held-out signs wrong, against 16 % inside training in the dry run. Whether sessions, bin
    positions or episode mix cause that was not separated.
  • Cannot see: any understanding of the policy beyond that one vector.
    • On the 24 random-direction edits (192 of the signs) the agents scored 0.479-0.578, around a coin flip, against
      0.807 for the positive control.
    • Six of the eight rebuilt the action expert in numpy without the vision-language prefix.
    • atlas-3 and atlas-4 wrote no forward pass. They estimated the mean from the atlas's probe biases plus the time
      conditioning, relying on atlas content alone, and scored 0.572 and 0.497.
    • Atlas agents recognised the 13 probe-direction edits and used the probe biases: 0.558 against 0.462, descriptive
      only.
    • So the finding is that E8 on readout edits could not exercise the atlas, not that the atlas cannot predict
      edits.
  • Offline only: nothing here says anything about closed-loop behaviour (AGENTS.md rule 7).
  • The recurring eval build still reads inconclusive: it runs E8 without a pool. Wiring a pool in is not part
    of this PR.

My answer to the open problem

  • Positive control, not evidence: computing dW @ mean(F_train) + db is a legitimate use of the atlas's
    recorded data. But it is multiplication, so it serves as the positive control and is not counted as evidence.
  • The claim is tested only by agents holding no capture rows. Both arms got the action-expert weights (a
    byte-identical 208-tensor slice, sha256 2d50b621…), the pool and the same task. The atlas arm also got
    references/pi05.md, the L1 diff JSONs and the L2 probe runs.
  • Edits that are not a closed form of recorded inputs (upstream tensors, the integrated chunk) need the live model
    on a GPU. That is written up as a proposal in docs/experiments/e8-predict-2026-11-20/results.md, not built.

Method, blinding and integrity

  • Prereg docs/experiments/e8-predict-2026-11-20/prereg.md. Fable reviewed it at checkpoint 1 ("go with changes"). Three amendments
    were logged before any scoring:
    1. the blinding fence, 4 agents per arm, a 0.03 noise floor and an agent-level test, and the bad-file rule;
    2. the frozen pool, the training-only dry run and its one-time interval width;
    3. two void agents.
  • Pool: drawn by python -m evals.e8_study pool from a written recipe (seed 20261120) and frozen before any
    agent saw it. 47 edits, 376 pairs, 218 independent signs. The prereg said 219, but two probe-direction edits
    (e16, e45) are the mirror-image columns of the two-class gripper probe, so they share one sign. A per-unit coin
    flipper would pass with probability 5.2e-6. Bias share: 0 in four families. In the two fine-tune-revert edits the
    bias is 4.2 % of the measured effect, and its sign agrees with the effect's on 75 % of pairs.
  • Agents: fresh claude -p --safe-mode Opus sessions, each in its own folder, under a scrubbed environment (no
    credentials: gcloud, gsutil and gct are checked to fail). The answer-bearing files were mode 000 until every file
    was hashed, and the controls were built after that. Prompts, transcripts, audits and notes are saved beside the
    prereg; I read every transcript by eye.
  • Voids: two, caused by my harness. A ./python symlink lost its venv.
    • atlas-1 reached outside its folder, so it is void under the prereg's written rule.
    • noatlas-1 worked without numpy. It is void under a rule I added in amendment 3, not the written one.
    • Both were rerun, and neither counts.
  • A deviation from the written void rule, decided before scoring: atlas-2 and atlas-4 each read one harness spill
    file of their own earlier output, outside the folder. The letter of the prereg makes them void. I kept them, and
    dropping both leaves C-1 at 0 of 2.
  • Also declared in results.md:
    • one empty /tmp write;
    • top and two system-python3 edits of an agent's own script;
    • the shared Claude config directory (…/claude-02/projects/, other sessions' transcripts), outside the fence and
      readable. No agent read anything there but its own spill file.
  • Compute: two CPU gct runs (train stats 4.5 min on 1 pod; scoring 7.5 min on 18 pods), 10 agent sessions
    ($11.0, none near the 90 min / $40 limits) and no GPU.

Changes

  • evals/e8_study.py (new). Subcommands slice, train-stats, pool, dry-run, controls,
    check-predictions, audit and paired. It never changes the scorer.
  • docs/07-evals.md §2 E8: the first scored reading from one named run, what E8 can and cannot see, the closed-form
    caveat, and that the recurring build still reads inconclusive. §3: the e8_study commands.
  • .agents/skills/weight-forge/references/pi05.md: the finding, with its src tag.
  • The packaged mirrors under src/weight_forge/_agent_docs/.
  • docs/experiments/e8-predict-2026-11-20/ (added by the pipeline's document fix, on the operator's decision), and
    its row in docs/experiments/README.md. It is the public bench record: prereg with amendments, results, prompts,
    agent notes, the 18 frozen predictions files with SHA256SUMS, the pool manifest (no tensors) and the summary
    JSONs; 727 KB of text. Agent transcripts (about 3 MB), the raw E8 records and the training statistics are kept
    privately. Nothing in it is derived from robot frames.
  • changes/e8-first-scored-reading.md.
  • Tests: none added. The tooling is study code. Its one contract with the scorer, sign accuracy, is cross-checked
    at run time against each E8 record (paired --check, matched for all 18 files). The mirror test passes.

Dead ends and what is left unproven

  • My first positive-control prediction (0.98) assumed the training mean would be almost exact. The training-only dry
    run got 16 % of signs wrong and caught that before scoring; on held-out data it got 21.5 % wrong.
  • The broken interpreter cost one rerun pair ($2.36).
  • Unproven:
    • whether the atlas helps on edits upstream of the readout;
    • whether publishing a train-split F_post_norm summary would let atlas agents pass (expected, not tested);
    • anything closed-loop.

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.

4 participants