You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(spec): self-skip on a re-run must emit a SEQUANT_SPEC marker restating the prior plan — else the #1193 guard fails spec #1213
#1193 (PR #1211) made the orchestrator fail a spec phase that produced no fresh SEQUANT_SPEC marker (src/lib/workflow/phase-executor.ts, the spec branch of mapAgentSuccessCore). Markers from an earlier spec are deliberately ignored.
spec/SKILL.md § phase detection has a self-skip: when spec:completed (or a later phase) is detected, spec "skips with message" and writes no marker. On a re-run of an already-specced issue, the guard then fails spec and halts the run.
Latent today: the detection snippet (--jq '[.comments[].body]' | grep -o '{[^}]*}' | grep '"phase"') never matches, because the JSON-encoded bodies carry escaped quotes, so spec never self-skips. The regression goes live the day that grep is fixed. See the runner verification comment on #1193.
Owner ruling (2026-09-28)
The skip path emits a marker. When spec self-skips, it writes a SEQUANT_SPEC marker restating the prior plan (phases and recommended workflow copied from the most recent spec comment). The guard stays strict and does not accept a bare skip message as success.
Acceptance Criteria
AC-1: The self-skip branch in spec/SKILL.md (all 3 mirrored dirs) tells the agent to emit a SEQUANT_SPEC marker restating the prior spec's recommendation before it exits. Evidence: a scoped assertion on the phase-detection section of the skill file, mutation-verified.
AC-2: A spec transcript that self-skips and emits the restated marker maps to success in mapAgentSuccessCore. A self-skip that emits no marker still fails. Evidence: npx vitest run src/lib/workflow/phase-executor.test.ts, mutation-verified.
Context before wave 3 (main @ 1b0fa9a). The #1193 guard lives in the spec branch of mapAgentSuccessCore at src/lib/workflow/phase-executor.ts:1159, called from :1097. No other wave-3 issue touches phase-executor.ts or the spec SKILL.md copies. Edit all three mirrored copies: .claude/skills/spec/, skills/spec/, templates/skills/spec/.
Run rules for the phase agents (spec, exec and qa):
exec and qa: do not run the full npm test. Run the targeted npx vitest run <files> named in the ACs, in the foreground with a timeout. Every MCP-dispatched phase has a hard 30-minute wall, and in wave 2 an exec ran up to 27 minutes. This applies to the qa phase too, not only exec.
Commit WIP early, and commit again before any mutation test. Work that is committed survives a phase timeout.
For a mutation record, failedTest must start with the test file path (src/…test.ts > <describe> > <case>). If it starts with a describe name, §6i floors the verdict to AC_NOT_MET.
In the PR body, put Closes #<this issue> for this issue and Refs #1203 for the tracker. Never Closes #1203.
A skill snippet that reads .sequant/settings.json must handle JSONC (comments and trailing commas), not bare JSON.parse/jq.
Both AC-1 and AC-2 are single-line, each with a testable Evidence: clause (a mutation-verified scoped assertion; npx vitest run src/lib/workflow/phase-executor.test.ts). No vague/unmeasurable terms. ## Non-Goals is present as ## Out of scope.
Scope Assessment
Non-Goals: Fixing the phase-detection grep itself (tracked separately). Confirmed in the AC context comment: no other wave-3 issue touches phase-executor.ts or the spec SKILL.md copies (verified — the three sibling worktrees for #1198/#1200/#1209 are all still at origin/main, zero diff).
Metric
Value
Status
Feature count
1
✅
AC items
2
✅
Directory spread
3 (.claude/skills/spec + 2 mirrors as one edit; src/lib/workflow; new src/lib/__tests__)
✅
Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: Self-skip branch documents emitting a restated SEQUANT_SPEC marker
Verification: Unit Test Scenario: Given the "Phase Detection" section of .claude/skills/spec/SKILL.md (and its two mirrors) → When a gate test reads that scoped region → Then it asserts the self-skip bullet instructs restating the prior SEQUANT_SPEC marker verbatim before exiting, not just "Skip with message." Assumptions: None — this is a doc-content change, no runtime code path changes (the guard at phase-executor.ts:1235 already accepts a marker found in either the agent's own output or a comment posted during the phase; see AC-2).
AC-2: Self-skip-with-marker maps to success; self-skip-without-marker still fails
Verification: Unit Test Scenario: Given a spec agent result whose output is a realistic self-skip transcript ("⏭️ Spec already completed. Reusing prior plan.\n\n<!-- SEQUANT_SPEC: {...} -->") → When mapAgentSuccessToPhaseResult("spec", ...) runs → Then success: true. Given the same transcript minus the marker line → Then success: false with the existing "no SEQUANT_SPEC marker" error. Assumptions: No production-code change is needed for this AC — specProducedMarker/parseSpecMarker (spec-recommendation.ts) already treat any marker in agentResult.output as sufficient, regardless of surrounding prose. This AC's job is to pin that behavior against the self-skip framing specifically, since #1193's guard was written and tested against a first-run spec, not a skip.
Implementation Plan
Phase 1: Skill instruction (AC-1)
In .claude/skills/spec/SKILL.md "Phase Detection" section (lines 53–69), replace the spec:completed or later phase detected → Skip with message bullet with an instruction to: fetch the latest SEQUANT_SPEC marker from the comments already read for phase detection, restate it verbatim in this turn's response (prefixed with a one-line skip note), and fall through to normal execution if no valid prior marker is found (skipping with nothing to restate would fail the guard anyway).
Apply the identical edit to skills/spec/SKILL.md and templates/skills/spec/SKILL.md (currently byte-identical to the .claude/ copy — keep them that way).
Phase 2: Gate test for AC-1
Add src/lib/__tests__/spec-skill-self-skip-marker.test.ts, modeled on src/lib/__tests__/exec-skill-foreground-rule.test.ts: describe.each over the 3 mirrored SKILL.md paths, extract the "## Phase Detection" region (heading to next ##), assert it names SEQUANT_SPEC, requires restating it verbatim, and states the fallback-to-normal-execution rule when no prior marker exists.
Mutation-verify: delete the new instruction text, confirm exactly this test fails, restore, record per the constitution's marker format.
Phase 3: Regression test for AC-2
In src/lib/workflow/phase-executor.test.ts, inside the existing describe("spec phase (#1193)") block (~line 2642), add two cases using a self-skip-shaped output string: one with the restated marker present (expect success: true), one without (expect success: false, same error text as the existing "no SEQUANT_SPEC marker" case).
Mutation-verify: temporarily strip the marker from the "success" case's fixture, confirm that test (not the neighbor) fails, restore.
Design Review
Where does this logic belong? The instruction lives in the skill prompt (LLM-interpreted), not in phase-executor.ts — the guard's acceptance rule (marker in output or in a same-window comment) is already general-purpose and correct; the only gap is that the skill never told the agent to use that escape hatch on self-skip.
What existing pattern does this follow? Same durable-marker idiom already used for SEQUANT_PHASE completion/failure markers in this same section, and the same doc-content gate-test pattern as exec-skill-foreground-rule.test.ts / exec-skill-marker.test.ts.
Phases: exec → qa Quality Loop: disabled Reasoning:bug label, 2 AC, SCOPE_OK — mechanical doc + test change confined to already-identified files. No UI, no new-feature test scaffolding needed (testgen skipped per bug-only label rule).
Label Review
Current: bug Recommended: bug (no change) Reason: Correctly scoped as a bug fix; no complexity/refactor signal. Quality Loop: Won't auto-enable — SCOPE_OK, no scope warning.
Runner verification of PR #1219 @ 0bfcfe5 (QA verdict: AC_MET_BUT_NOT_A_PLUS, 2/2; QA listed no gaps)
npx tsc --noEmit: clean.
npx vitest run src/lib/__tests__/spec-skill-self-skip-marker.test.ts src/lib/workflow/phase-executor.test.ts: 204 passed.
AC-1 mutation, re-run by the runner: I replaced .claude/skills/spec/SKILL.md with the origin/main copy. All 3 of that copy's gate tests failed (3 failed / 6 passed), the other two copies' tests passed, and I restored the file. The test is scoped to the ## Phase Detection region, so it doesn't read the whole file.
All three SKILL.md copies are byte-identical.
CI is green on 0bfcfe5 (test, canary, typecheck, validate-skills, …). closingIssuesReferences is [1213] only.
AC-2 pins behaviour that already existed (the guard reads a marker anywhere in the output), so no production code changed. The spec comment says so explicitly.
Note: the exec's test plan records a full npm test run, although the context comment said not to run it. The exec still finished in 15 minutes.
Activity
admarble commentedon Sep 29, 2026
Context before wave 3 (main @ 1b0fa9a). The #1193 guard lives in the spec branch of
mapAgentSuccessCoreatsrc/lib/workflow/phase-executor.ts:1159, called from:1097. No other wave-3 issue touchesphase-executor.tsor the spec SKILL.md copies. Edit all three mirrored copies:.claude/skills/spec/,skills/spec/,templates/skills/spec/.Run rules for the phase agents (spec, exec and qa):
npm test. Run the targetednpx vitest run <files>named in the ACs, in the foreground with atimeout. Every MCP-dispatched phase has a hard 30-minute wall, and in wave 2 an exec ran up to 27 minutes. This applies to the qa phase too, not only exec.failedTestmust start with the test file path (src/…test.ts > <describe> > <case>). If it starts with a describe name, §6i floors the verdict to AC_NOT_MET.Closes #<this issue>for this issue andRefs #1203for the tracker. NeverCloses #1203..sequant/settings.jsonmust handle JSONC (comments and trailing commas), not bareJSON.parse/jq.admarble commentedon Sep 29, 2026
Complexity: Simple (2 ACs, 3 directories)
AC Quality Check
Both AC-1 and AC-2 are single-line, each with a testable
Evidence:clause (a mutation-verified scoped assertion;npx vitest run src/lib/workflow/phase-executor.test.ts). No vague/unmeasurable terms.## Non-Goalsis present as## Out of scope.Scope Assessment
Non-Goals: Fixing the phase-detection grep itself (tracked separately). Confirmed in the AC context comment: no other wave-3 issue touches
phase-executor.tsor the specSKILL.mdcopies (verified — the three sibling worktrees for #1198/#1200/#1209 are all still atorigin/main, zero diff)..claude/skills/spec+ 2 mirrors as one edit;src/lib/workflow; newsrc/lib/__tests__)Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: Self-skip branch documents emitting a restated
SEQUANT_SPECmarkerVerification: Unit Test
Scenario: Given the "Phase Detection" section of
.claude/skills/spec/SKILL.md(and its two mirrors) → When a gate test reads that scoped region → Then it asserts the self-skip bullet instructs restating the priorSEQUANT_SPECmarker verbatim before exiting, not just "Skip with message."Assumptions: None — this is a doc-content change, no runtime code path changes (the guard at
phase-executor.ts:1235already accepts a marker found in either the agent's own output or a comment posted during the phase; see AC-2).AC-2: Self-skip-with-marker maps to success; self-skip-without-marker still fails
Verification: Unit Test
Scenario: Given a spec agent result whose output is a realistic self-skip transcript (
"⏭️ Spec already completed. Reusing prior plan.\n\n<!-- SEQUANT_SPEC: {...} -->") → WhenmapAgentSuccessToPhaseResult("spec", ...)runs → Thensuccess: true. Given the same transcript minus the marker line → Thensuccess: falsewith the existing "no SEQUANT_SPEC marker" error.Assumptions: No production-code change is needed for this AC —
specProducedMarker/parseSpecMarker(spec-recommendation.ts) already treat any marker inagentResult.outputas sufficient, regardless of surrounding prose. This AC's job is to pin that behavior against the self-skip framing specifically, since #1193's guard was written and tested against a first-run spec, not a skip.Implementation Plan
Phase 1: Skill instruction (AC-1)
.claude/skills/spec/SKILL.md"Phase Detection" section (lines 53–69), replace thespec:completed or later phase detected → Skip with messagebullet with an instruction to: fetch the latestSEQUANT_SPECmarker from the comments already read for phase detection, restate it verbatim in this turn's response (prefixed with a one-line skip note), and fall through to normal execution if no valid prior marker is found (skipping with nothing to restate would fail the guard anyway).skills/spec/SKILL.mdandtemplates/skills/spec/SKILL.md(currently byte-identical to the.claude/copy — keep them that way).Phase 2: Gate test for AC-1
src/lib/__tests__/spec-skill-self-skip-marker.test.ts, modeled onsrc/lib/__tests__/exec-skill-foreground-rule.test.ts:describe.eachover the 3 mirroredSKILL.mdpaths, extract the "## Phase Detection" region (heading to next##), assert it namesSEQUANT_SPEC, requires restating it verbatim, and states the fallback-to-normal-execution rule when no prior marker exists.Phase 3: Regression test for AC-2
src/lib/workflow/phase-executor.test.ts, inside the existingdescribe("spec phase (#1193)")block (~line 2642), add two cases using a self-skip-shapedoutputstring: one with the restated marker present (expectsuccess: true), one without (expectsuccess: false, same error text as the existing "no SEQUANT_SPEC marker" case).Design Review
phase-executor.ts— the guard's acceptance rule (marker in output or in a same-window comment) is already general-purpose and correct; the only gap is that the skill never told the agent to use that escape hatch on self-skip.SEQUANT_PHASEcompletion/failure markers in this same section, and the same doc-content gate-test pattern asexec-skill-foreground-rule.test.ts/exec-skill-marker.test.ts.Open Questions
SEQUANT_PHASE: completedmarker, or is the restatedSEQUANT_SPECmarker alone sufficient? — Recommendation: restateSEQUANT_SPEConly; the fix(run): spec runs in the main checkout, which the skills pre-flight never checks — a stale checkout silently degrades spec (#933 regression) #1193 guard checks for that marker specifically, and adding a second marker without a clear consumer would be untested surface. Impact if wrong: cosmetic only, doesn't block AC-2's guard behavior.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning:
buglabel, 2 AC, SCOPE_OK — mechanical doc + test change confined to already-identified files. No UI, no new-feature test scaffolding needed (testgen skipped perbug-only label rule).Label Review
Current: bug
Recommended: bug (no change)
Reason: Correctly scoped as a bug fix; no complexity/refactor signal.
Quality Loop: Won't auto-enable — SCOPE_OK, no scope warning.
→ No label change needed.
admarble commentedon Sep 29, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 2/2 met
admarble commentedon Sep 29, 2026
Runner verification of PR #1219 @ 0bfcfe5 (QA verdict: AC_MET_BUT_NOT_A_PLUS, 2/2; QA listed no gaps)
npx tsc --noEmit: clean.npx vitest run src/lib/__tests__/spec-skill-self-skip-marker.test.ts src/lib/workflow/phase-executor.test.ts: 204 passed..claude/skills/spec/SKILL.mdwith the origin/main copy. All 3 of that copy's gate tests failed (3 failed / 6 passed), the other two copies' tests passed, and I restored the file. The test is scoped to the## Phase Detectionregion, so it doesn't read the whole file.closingIssuesReferencesis [1213] only.Note: the exec's test plan records a full
npm testrun, although the context comment said not to run it. The exec still finished in 15 minutes.fix(#1213): spec self-skip on a re-run emits a SEQUANT_SPEC marker re…