Skip to content

fix(bin): resolve capped run inventories for worker copies - #5268

Closed
mremond wants to merge 2 commits into
kunchenguid:mainfrom
mremond:fm/fm-capped-overview-worker-copy-unknown
Closed

mremond wants to merge 2 commits into
kunchenguid:mainfrom
mremond:fm/fm-capped-overview-worker-copy-unknown

Conversation

@mremond

@mremond mremond commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Intent

Issue #5211.

Once a repository has more than ten recorded validation runs, current-state reads report every ship task running in a pooled worker copy as unknown with an unreadable run inventory, and the fleet view and heartbeat reviews inherit that verdict.

The cause is a lookup, not missing data. On a capped overview the run selector resolves the inventory by the worker copy path, but no-mistakes init registered the primary clone, so no row exists under that path and the whole inventory reads unreadable. The overview itself names the repository it resolved on its repo: line.

Two cases that should read correctly come back unknown: a branch whose newest run completed but falls outside the ten rows shown, and a branch with no run at all, such as a task that has not started validation or a direct-PR task that never validates.

The consequence is that a finished validation, a task that never validated, and a genuinely unreadable inventory become indistinguishable. Every ship task in a busy repository reads unknown, which buries real problems among false ones and prompts recovery checks that are not needed.

Expected: with a capped overview, a worker copy of a registered repository reads the same as the primary clone - a completed run outside the shown rows is selected as completed, and a branch with no recorded run reads as having no run - while a missing, mismatched, truncated or ambiguous inventory still reads unknown.

What Changed

  • Resolve capped run inventories using the overview’s repo: path alongside the worker-copy path, so completed runs beyond the ten-row window and branches with no runs are identified correctly.
  • Require exact path matches to identify one repository, retaining unknown for unresolved or conflicting identity and unreadable inventories.
  • Add worker-copy regression cases for absent and completed runs, and clarify that the captured overview excerpt omits the repo: field.

Risk Assessment

✅ Low: The change is a bounded, read-only lookup correction; review found no material correctness, intent-conformance, or simplification issues.

Testing

The live CLI probe was blocked by the unregistered checkout. Focused automated regressions, primary/worker comparisons, and inventory guards passed; both reported failures reproduced against the base. A broader test-file run was stopped to narrow scope, and a temporary harness quoting error was corrected before rerunning. CLI evidence was retained; this change has no rendered UI requiring screenshots.

  • Live validation: ⚠️ inconclusive - 0 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Read a worker-copy branch whose completed run falls outside the ten displayed rows; report completed, matching the primary. ⏸️ untested no No registered live repository is accessible within scope. Provide an isolated registered repository with a genuine completed run outside its latest ten rows.
Read a worker-copy branch with no recorded run; use worker activity instead of reporting an unreadable inventory. ⏸️ untested no The permitted checkout is unregistered. Provide an isolated registered repository with capped history and a branch that has never validated.
Read current state when the complete inventory cannot be read; retain unknown and available run identities. ⏸️ untested no A registered disposable live environment is unavailable. Provide one for controlled inventory failure injection without modifying production state.
Read a mismatched or truncated inventory; reject a confident state. ⏸️ untested no Only simulated inventory faults could be exercised. Provide a registered disposable live environment supporting controlled fault injection.
Read a worker copy when its path and the overview path identify different repositories; report unknown. ⏸️ untested no No disposable live repository registrations are available within scope. Provide an isolated environment containing the conflicting registrations.
Read capped history containing competing active runs for the branch; report unknown and identify both runs. ⏸️ untested no Creating or controlling validation runs is forbidden in this phase. Provide an isolated registered repository with genuine competing run records.
Evidence: Live CLI probe blocked

Source: Live CLI probe blocked

error: repo not initialized (run 'no-mistakes init' first)

error: repo not initialized (run 'no-mistakes init' first)
help[1]: Run `no-mistakes init` to set up the gate in this repository
Evidence: Automated base-to-target reproduction and primary/worker parity

Source: Automated base-to-target reproduction and primary/worker parity

AUTOMATED BEHAVIORAL EVIDENCE; NO-MISTAKES AND PANE DEPENDENCIES ARE FAKES

BASE: no-run worker

CASE test_capped_overview_worker_copy_repo_line_reports_absent (baseline=1)
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: 
not ok - the worker-copy repo: line must resolve the inventory (unexpected: 'unreadable')
--- output ---
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: 

BASE: hidden completed run

CASE test_capped_overview_worker_copy_repo_line_reports_completed_outside_window (baseline=1)
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: 
not ok - the worker-copy repo: line must resolve the completed run (unexpected: 'unreadable')
--- output ---
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: 

TARGET: worker/primary parity

CASE phase_primary_worker_parity (baseline=0)
state: working · source: pane · harness busy (claude-hook)
ok - a worker copy with no recorded run of its own reads absent via the overview repo: line
state: working · source: pane · harness busy (claude-hook)
state: working · source: pane · harness busy (claude-hook)

PARITY absent
worker: state: working · source: pane · harness busy (claude-hook)
primary: state: working · source: pane · harness busy (claude-hook)
ok - absent primary and worker copies report the same current state
state: done · source: run-step · run passed: PR state unknown (no PR identity) · run: 01COMPLETED
ok - a worker copy reads a completed run outside the shown rows via the overview repo: line
state: done · source: run-step · run passed: PR state unknown (no PR identity) · run: 01COMPLETED
state: done · source: run-step · run passed: PR state unknown (no PR identity) · run: 01COMPLETED

PARITY completed
worker: state: done · source: run-step · run passed: PR state unknown (no PR identity) · run: 01COMPLETED
primary: state: done · source: run-step · run passed: PR state unknown (no PR identity) · run: 01COMPLETED
ok - completed primary and worker copies report the same current state
Evidence: Focused automated regression results

Source: Focused automated regression results


CASE test_capped_overview_worker_copy_repo_line_reports_absent (baseline=0)
state: working · source: pane · harness busy (claude-hook)
ok - a worker copy with no recorded run of its own reads absent via the overview repo: line

CASE test_capped_overview_worker_copy_repo_line_reports_completed_outside_window (baseline=0)
state: done · source: run-step · run passed: PR state unknown (no PR identity) · run: 01COMPLETED
ok - a worker copy reads a completed run outside the shown rows via the overview repo: line

CASE test_capped_overview_without_repo_line_and_no_runs_reports_absent (baseline=0)
state: working · source: pane · harness busy (claude-hook)
ok - a capped overview with no repo: line and zero same-branch rows reports absent, not unreadable

CASE test_no_branch_run_beside_a_live_run_elsewhere_reads_absent (baseline=0)
state: working · source: pane · harness busy (claude-hook)
ok - no run for this branch beside a live run elsewhere reads absent, not unreadable

CASE test_capped_competing_live_runs_report_both_ids (baseline=0)
state: unknown · source: run-step · competing live runs; run ids: 01NEW, 01OLD; last reported run id: 01NEW
ok - capped overview retains both competing same-branch run ids

CASE test_capped_overview_without_branch_rows_reports_both_ids (baseline=0)
state: unknown · source: run-step · competing live runs; run ids: 01NEW, 01OLD; last reported run id: 01NEW
ok - same-branch identity survives both runs falling outside the overview

CASE test_capped_inventory_reader_is_time_bounded (baseline=0)
state: unknown · source: run-step · complete same-branch run inventory reader unavailable; run ids: ; last reported run id: 01NEW
ok - the capped inventory reader is bounded by the crew read budget

CASE test_capped_inventory_requires_exact_worktree_path (baseline=0)
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: ; last reported run id: 01NEW
ok - a worktree spelling the inventory does not record reads unreadable without a repo: line

CASE test_capped_replacement_keeps_gate_and_inventory_unchanged (baseline=0)
state: parked · source: run-step · parked at review: 2 finding(s) · ask-user: authority decision · run: 01NEW
state: parked · source: run-step · parked at review: 2 finding(s) · ask-user: authority decision · run: 01NEW
ok - complete inventory preserves the replacement gate without writes

CASE test_capped_inventory_failures_report_unknown (baseline=0)
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: 01NEW; last reported run id: 01NEW
ok - missing complete-inventory failure reports unknown
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: 01NEW; last reported run id: 01NEW
ok - corrupt complete-inventory failure reports unknown
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: 01NEW; last reported run id: 01NEW
ok - schema complete-inventory failure reports unknown
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: 01NEW; last reported run id: 01NEW
ok - repo complete-inventory failure reports unknown
state: unknown · source: run-step · unreadable runs table; run ids: 01NEW; last reported run id: 01NEW
ok - count complete-inventory failure reports unknown

CASE test_inventory_structure_and_requested_semantics_remain_checked (baseline=0)
state: unknown · source: run-step · unreadable runs table; run ids: 01NEW, 01OLD; last reported run id: 01NEW
state: unknown · source: run-step · unreadable runs table; run ids: 01NEW, 01OLD; last reported run id: 01NEW
state: unknown · source: run-step · unreadable runs table; run ids: 01NEW, 01OLD; last reported run id: 01NEW
state: unknown · source: run-step · unreadable runs table; run ids: 01NEW, 01OLD; last reported run id: 01NEW
ok - R6 structural completeness and requested-run validation remain enforced

CASE test_capped_without_python_preserves_available_ids (baseline=0)
ok - R5 capped lookup without Python preserves available ids

CASE test_capped_without_sqlite_preserves_available_ids (baseline=0)
state: unknown · source: run-step · complete same-branch run inventory reader unavailable; run ids: 01NEW; last reported run id: 01NEW
ok - R5 capped lookup without SQLite support preserves available ids

CASE test_live_to_terminal_inventory_disagreement_is_unknown (baseline=0)
state: unknown · source: run-step · selected run status disagrees with inventory; run ids: 01NEW, 01OLD
state: unknown · source: run-step · selected run status disagrees with inventory; run ids: 01NEW, 01OLD
ok - R1 both directions of inventory liveness disagreement read unknown
Evidence: Automated worker-copy inventory guards

Source: Automated worker-copy inventory guards


CASE phase_worker_inventory_guards (baseline=0)

WORKER INVENTORY GUARD missing
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: 01NEW; last reported run id: 01NEW
ok - worker-copy missing inventory remains unknown without modifying the database

WORKER INVENTORY GUARD mismatched
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: 01NEW, 01OLD; last reported run id: 01NEW
ok - worker-copy mismatched inventory remains unknown without modifying the database

WORKER INVENTORY GUARD truncated
state: unknown · source: run-step · unreadable runs table; run ids: 01NEW; last reported run id: 01NEW
ok - worker-copy truncated inventory remains unknown without modifying the database

WORKER INVENTORY GUARD ambiguous
state: unknown · source: run-step · complete same-branch run inventory unreadable; run ids: 01NEW; last reported run id: 01NEW
ok - worker-copy ambiguous inventory remains unknown without modifying the database

WORKER INVENTORY GUARD competing
state: unknown · source: run-step · competing live runs; run ids: 01NEW, 01OLD; last reported run id: 01NEW
ok - worker-copy competing inventory remains unknown without modifying the database
Evidence: Test scope, reproduction method, and limitations

Source: Test scope, reproduction method, and limitations

Target: e47d387ee4b1ede354c67078a135788cac8bac47
Tree: cc80422c695839b6a89a8f0bee9474a41411af4d
Base: f9f74a1d91cc7e105ec3df2249eda4e07f9ba540

All successful acceptance checks here use fake no-mistakes and pane dependencies and temporary SQLite databases. They are automated behavioral evidence, not live validation.

The focused harness executes definitions from tests/fm-crew-state.test.sh before its main invocation list (before the standalone test_captured_axi_status_shapes call), then appends focused-harness-fragment.sh. It is temporarily written beside the original test so the existing test helpers retain their normal root resolution. It wraps run_crew_state to retain the actual CLI verdict. Selected functions are passed as positional arguments and are listed in the CASE lines of the logs.

For RED, PHASE_BASE=1 substitutes only bin/fm-nm-run-lib.sh from the base commit using .test-phase-tmp/base-bin: all other bin entries link to target files. Both new worker-copy cases exited 1 with the expected unknown/unreadable verdict. For GREEN, the unmodified target library was used; all selected cases exited 0. Additional worker-copy inventory guards and primary/worker parity checks also exited 0.

The initial full tests/fm-crew-state.test.sh file run through bin/fm-test-run.sh was intentionally terminated with SIGTERM after 150 seconds to narrow scope; exit 143 is not an observed product failure and the full file is not claimed to pass. The focused run replaced it. An initial supplemental harness attempt had a macOS sed quoting error, retained in worker-guards-setup-error.log; the harness was fixed and rerun successfully.

The installed CLI v1.75.2 was probed with no-mistakes axi from this exact worktree and returned exit 1: repo not initialized. No init, pipeline lifecycle, Herdr lifecycle, primary-checkout access, linter, formatter, or static analyzer was performed. The assigned phase cannot provision the genuine validation histories needed for live coverage. Evidence is CLI-only because the changed surface is a deterministic CLI reader, with no rendered UI change.

All transient test helpers, linked baseline files, and generated test data were removed from the worktree; tracked source files remain unchanged.
- Outcome: ⚠️ 2 warnings across 1 run (9m46s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 2 warnings
  • ⚠️ Live acceptance remains unproven: the installed CLI reports this worktree as unregistered, while this phase forbids initializing or controlling another pipeline and accessing another project checkout. Supply an isolated, already-registered repository with more than ten genuine validation runs and read access, or explicitly decide whether automated evidence is sufficient.
  • ⚠️ live validation verdict: inconclusive (0 of 6 scenarios were driven live against the product); untested: Read a worker-copy branch whose completed run falls outside the ten displayed rows; report completed, matching the primary., Read a worker-copy branch with no recorded run; use worker activity instead of reporting an unreadable inventory., Read current state when the complete inventory cannot be read; retain unknown and available run identities., Read a mismatched or truncated inventory; reject a confident state., Read a worker copy when its path and the overview path identify different repositories; report unknown., Read capped history containing competing active runs for the branch; report unknown and identify both runs.
  • Live validation: ⚠️ inconclusive - 0 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Read a worker-copy branch whose completed run falls outside the ten displayed rows; report completed, matching the primary. ⏸️ untested no No registered live repository is accessible within scope. Provide an isolated registered repository with a genuine completed run outside its latest ten rows.
Read a worker-copy branch with no recorded run; use worker activity instead of reporting an unreadable inventory. ⏸️ untested no The permitted checkout is unregistered. Provide an isolated registered repository with capped history and a branch that has never validated.
Read current state when the complete inventory cannot be read; retain unknown and available run identities. ⏸️ untested no A registered disposable live environment is unavailable. Provide one for controlled inventory failure injection without modifying production state.
Read a mismatched or truncated inventory; reject a confident state. ⏸️ untested no Only simulated inventory faults could be exercised. Provide a registered disposable live environment supporting controlled fault injection.
Read a worker copy when its path and the overview path identify different repositories; report unknown. ⏸️ untested no No disposable live repository registrations are available within scope. Provide an isolated environment containing the conflicting registrations.
Read capped history containing competing active runs for the branch; report unknown and identify both runs. ⏸️ untested no Creating or controlling validation runs is forbidden in this phase. Provide an isolated registered repository with genuine competing run records.
  • no-mistakes --version, no-mistakes axi --help, and no-mistakes axi from the assigned worktree.
  • TMPDIR="$PWD/.test-phase-tmp" bin/fm-test-run.sh tests/fm-crew-state.test.sh — intentionally stopped after 150 seconds to narrow scope; not claimed as passing.
  • Both test_capped_overview_worker_copy_repo_line_reports_absent and test_capped_overview_worker_copy_repo_line_reports_completed_outside_window executed against the base library and target library: expected failures before, passes after.
  • Temporary focused harness executed 14 existing behavioral selectors covering worker copies, no-run fallback, hidden competing runs, timeout bounds, exact path matching, inventory failures, structural validation, unavailable Python/SQLite, and status disagreement; exact selectors appear in focused-green.log.
  • bash tests/.phase-focused.test.sh phase_worker_inventory_guards — missing, mismatched, truncated, ambiguous, and competing inventories; database hashes unchanged.
  • bash tests/.phase-focused.test.sh phase_primary_worker_parity — identical primary/worker CLI results for absent and completed runs.
  • Removed temporary harness, baseline links, and generated test data; git status --short was clean at target e47d387ee4b1ede354c67078a135788cac8bac47.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…o: line

fm_nm_select_run looked up a capped run inventory's repository strictly by
the task worktree path, but no-mistakes init registers the primary clone,
so a pooled worker copy's own path never matches a repos.working_path row
and the whole inventory read as unreadable. no-mistakes axi already names
the repository it resolved for that exact worktree on its own repo: line;
trust that path (falling back to the raw worktree path when absent) so a
worker copy reads a capped overview the same as the primary clone.
@mremond

mremond commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded: #5327 fixed the capped run inventory lookup on main, which also closed #5211.

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.

1 participant