Skip to content

fix(#1193): run checks the main checkout spec runs in; spec without a SEQUANT_SPEC marker fails - #1211

Merged
admarble merged 1 commit into
mainfrom
feature/1193-fix-run-spec-runs-in-the-main-checkout-which-the-s
Sep 29, 2026
Merged

admarble merged 1 commit into
mainfrom
feature/1193-fix-run-spec-runs-in-the-main-checkout-which-the-s

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

Spec is requiresWorktree: false, so it runs in the main checkout. Since #933 the skills pre-flight has checked only the worktrees, so a main checkout behind origin/<base> and missing .claude/skills/spec/SKILL.md passed. Spec then planned without its skill and was recorded as success. This PR adds options (a) and (c) from the issue. ADR-0002 records why (b), running spec in the worktree, was rejected.

  • Main-checkout pre-flight (AC-1). runSkillsPreflight takes scope: "main-checkout", which checks only the resolved phases with requiresWorktree: false (spec, verify, merger). The result now carries missingPaths. The orchestrator runs this check against process.cwd() before provisioning, so a failure leaves no worktree to clean up. The remedy is git pull / sequant sync in the main checkout, not "commit .claude/skills". With isolation off, the existing per-cwd check already covers the main checkout, so it isn't checked twice.
  • Spec output guard (AC-2). mapAgentSuccessCore fails a spec phase that produced no SEQUANT_SPEC marker, parsed with parseSpecMarker so no second regex is added. It checks the agent output first. If the output has no marker, it checks issue comments created during the phase (60 s clock-skew allowance), so a plan posted through a body file (fix(sync): plain sync overwrites CUSTOMIZABLE_FILES (constitution) — copyDir ignores force and never consults isCustomizableFile #814) passes and a marker left by an earlier spec does not (OQ-1). Drivers with resolvesSkills: false (aider) are exempt (OQ-2). The error names .claude/skills/spec/SKILL.md and the checkout.
  • Behind-base warning (AC-3). countCommitsBehind(cwd, base) is a non-fetching helper extracted from checkWorktreeFreshness, which now calls it. After provisioning, which has already fetched, the run prints ⚠ main checkout is N commits behind origin/<base> — spec runs there before any phase. It is a warning only and is skipped on --dry-run.
  • Docs: docs/reference/run-command.md (Phase Isolation), docs/troubleshooting.md, ADR-0002, CHANGELOG.

Pre-PR AC Verification

AC Description Status Evidence
AC-1 Main checkout lacking .claude/skills/spec/SKILL.md fails pre-flight before spec, naming the path ✅ run-orchestrator.ts main-checkout block; skills-preflight.ts scope / missingPaths; test 1193 AC-1: …
AC-2 Spec with no SEQUANT_SPEC marker recorded as failed ✅ phase-executor.ts specProducedMarker + spec branch in mapAgentSuccessCore; spec phase (#1193) tests
AC-3 Warning naming the commit count when the main checkout is behind origin/<base> ✅ run-orchestrator.ts freshness block; worktree-manager.ts countCommitsBehind; #1193 describe in run-orchestrator.test.ts

Mutation records

Mutation-verified: AC-1 — made the main-checkout pre-flight unreachable; 1193 AC-1 failed (along with 933 AC-2 and the #813 integration test, which also assert the new check); restored.
Mutation-verified: AC-2 — flipped the spec guard's default off; fails a spec that produced no SEQUANT_SPEC marker… failed (and does not accept a marker left by an earlier spec); restored.
Mutation-verified: AC-3 — raised the behind-count threshold from 0 to 99; prints a warning naming the commit count before spec starts failed (only that test); restored.

Existing tests changed

  • skills-preflight.integration.test.ts: a run with no skills now stops before ensureWorktrees, because the main checkout lacks the spec skill. The test now asserts zero provisioning calls and that the abort names the path.
  • skills-preflight.test.ts 933 AC-2: the main checkout is now checked once, scoped to main-checkout. The full phase set is still checked only in the worktree.
  • phase-executor.test.ts "other phases": the passthrough case moved from spec, which is now guarded, to verify.

Test plan

  • npm run build: passes
  • npm run lint: passes
  • npx vitest run src/lib/workflow/skills-preflight.test.ts src/lib/workflow/skills-preflight.integration.test.ts: 32/32
  • npx vitest run src/lib/workflow/phase-executor.test.ts: 186/186
  • npx vitest run src/lib/workflow/run-orchestrator.test.ts: 7/7
  • Broader targeted set (phase-executor*, skills-preflight*, run-orchestrator*, spec-retry, spec-recommendation, batch-executor*, ready-gate*, model-ladder, worktree-manager*, src/commands/run*.test.ts, platforms, adr-convention, tautology-detector-cli): 767/767 across 34 files
  • __tests__/integration/{multi-issue-reliability,run-pipeline}.integration.test.ts: 15/15
  • Mutation records above validated with parseMutationMarkers: all three valid
  • Full npm test: not run in this phase (runner instruction); the runner runs it before merge

Closes #1193

🤖 Generated with Claude Code

… SEQUANT_SPEC marker fails

The skills pre-flight also checks the main checkout for the phases that run there (requiresWorktree: false), before any worktree is provisioned, naming the missing .claude/skills/<skill>/SKILL.md. The run warns when the main checkout is behind origin/<base>. mapAgentSuccessCore fails a spec that produced no SEQUANT_SPEC marker in its output or in an issue comment posted during the phase; drivers that do not resolve skills are exempt. ADR-0002 records why spec stays in the main checkout.

Entire-Checkpoint: 69e643afcee5
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.

fix(run): spec runs in the main checkout, which the skills pre-flight never checks — a stale checkout silently degrades spec (#933 regression)

1 participant