Skip to content

fix(doctor): stamp CURRENT_SCHEMA_VERSION at seed; add stalled-bundle check - #24

Merged
rasatpetabit merged 7 commits into
mainfrom
fix/seed-schema-version-and-stalled-bundle-check
Aug 5, 2026
Merged

fix(doctor): stamp CURRENT_SCHEMA_VERSION at seed; add stalled-bundle check#24
rasatpetabit merged 7 commits into
mainfrom
fix/seed-schema-version-and-stalled-bundle-check

Conversation

@rasatpetabit

Copy link
Copy Markdown
Owner

Closes #22. Closes #23.

Found while diagnosing a real failure: a /masterplan brainstorm run on another repo seeded a bundle, then spent a whole session fixing a production outage, auditing three hosts, landing a 36-file branch reconciliation and writing a full spec.md — and made exactly one state-writing mp call (seed). The bundle ended at phase: brainstorm, goals: [], with no events.jsonl at all. doctor reported zero findings for it.

1 — seed stamped a version below the doctor's own floor (#23)

bin/masterplan.mjs hardcoded the literal at the seed call site:

schemaVersion: flags['schema-version'] !== undefined ? Number(flags['schema-version']) : 8,

That silently overrode buildSeedState's schemaVersion = CURRENT_SCHEMA_VERSION (9) default, so every freshly-seeded bundle landed below the floor version-scoped checks gate on:

// lib/doctor/spec-assumptions.mjs:50
if (Number.isNaN(sv) || sv < CURRENT_SCHEMA_VERSION) continue;

Net effect: spec-assumptions skipped 100% of bundles, reporting SKIP no in-scope bundle spec.md to check against a repo holding 11 current bundles with specs. The ## Assumptions section it enforces is documented as a hard pre-approval gate; its only automated enforcement has been inert. It fails open, degrading to SKIP rather than erroring, which is exactly why nobody caught it.

Now symbolic. The pre-existing seed test asserted the buggy literal 8, so it's updated to assert the constant — worth a reviewer's eye, since that's a test change accompanying a behavior change.

Left alone deliberately: migrate-bundle still lands at 8. Grandfathering a genuinely legacy bundle is defensible; stamping a brand-new one below the floor is not. Happy to fold migrate in if you'd rather they converge.

2 — nothing detected a seeded-then-abandoned bundle (#22)

dangling-run covers a run that started a wave and crashed (stranded active_run). Nothing covered a bundle that never started one. That gap is load-bearing: on resume, mp continue sees phase: brainstorm + tasks: [] + active_run: null and offers "continue / restart / stop" — indistinguishable from a bundle seeded thirty seconds ago. Every unrecorded decision is lost at the next compaction.

stalled-bundle WARNs when a pre-execute bundle (brainstorm/plan, non-archived) has a spec.md but no parseable event. A spec proves design work happened; zero events prove none of it was recorded.

Signal choice is deliberately the cheap robust one — no git inspection, no mtime comparison (mtimes reset on fresh checkouts and would flap in CI). Phases past plan are exempt because wave machinery writes its own events and record-result surfaces that gap louder.

Not version-scoped, with a test pinning that. CD-7 is a universal invariant, not a v9 feature — and version-scoping is the precise mechanism that made spec-assumptions dead. A legacy schema-3 bundle must still WARN.

Verification

Full suite: 1578 pass, 0 fail.

New coverage: four severity-prefixed fixtures (warn/pass/skip/skip), plus explicit tests for the non-version-scoped contract, empty-but-present events.jsonl, archived exemption, no-bundles-dir SKIP, seed stamping the constant, and --schema-version still overriding. The registry test moves 17 → 18.

rasatpetabit and others added 7 commits July 21, 2026 16:54
Maps each masterplan agent to a canonical preset in the agent-dispatch
D40 frozen roster so the Pi spawn guard can resolve their class/effort:
  mp-planner -> builder (agentic-loop, writes plan.md + plan.index.json)
  mp-explorer -> tracer (deep-investigation, read-only recon)
  mp-goal-assessor -> tracer (deep-investigation, read-only assessment)
  mp-plan-reviewer -> breaker (adversary, plan review)
  mp-spec-decomposer -> judge (architecture, decomposition)
  mp-subsystem-planner -> judge (architecture, fragment drafting)
  mp-adversarial-reviewer -> prover (tester, review verification)

Requires agent-dispatch preset-alias mechanism (commits eb0e5be, 5f88067).
The register-pi-agents.mjs resync propagates these into ~/.pi/agent/agents/.
… check

Two defects that together let an entire brainstorm session go unrecorded with
zero doctor findings.

1. bin/masterplan.mjs hardcoded `schemaVersion: 8` at the seed call site,
   overriding buildSeedState's CURRENT_SCHEMA_VERSION (9) default. Every freshly
   seeded bundle therefore landed BELOW the floor that version-scoped checks gate
   on, so spec-assumptions grandfathered 100% of bundles and reported
   'no in-scope bundle spec.md to check' against repos full of them. It degrades
   to SKIP rather than failing, which is why it went unnoticed. Now symbolic, with
   a regression test asserting the constant rather than a literal. The existing
   seed test asserted the buggy literal and is updated to match.

2. No check detected a bundle that was seeded, did real work, and recorded none
   of it. dangling-run only covers a run that STARTED a wave and crashed; a
   bundle that never started one was structurally invisible. stalled-bundle
   WARNs when a pre-execute bundle has a spec.md but no parseable event.

stalled-bundle is deliberately NOT version-scoped, with a test pinning that:
CD-7 is a universal invariant, and version-scoping is precisely what made
spec-assumptions inert.

Full suite: 1578 pass, 0 fail.

Closes #22, closes #23

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Grafted from mattpocock/skills triage skill during the behavior-skills
adoption; wired into the brainstorm verb doc.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Disambiguate .out-of-scope/ (rejected ideas) from D6 path-scope and
run-bundle Out of Scope. Add template, doctor check rejected-idea-kb,
and unit tests. Wired into brainstorm verb doc.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Align AGENTS.md and cd-rules.md titles with CD-11 (identify-the-task).
Remove a stale dead owner-lock artifact under simplify-dedup-2.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Plan tasks that build images must use Tasks Summary + artifact paths
(not enqueue receipts); goals must cover boot/smoke when founding ask
says the image runs.
Managed routing pointer no longer enumerates gated model names.
Source: agent-dispatch e4beff2.
@rasatpetabit
rasatpetabit merged commit f32d893 into main Aug 5, 2026
1 of 2 checks passed
@rasatpetabit
rasatpetabit deleted the fix/seed-schema-version-and-stalled-bundle-check branch August 7, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant