Repository navigation
Description
Epic: graph-2026-11-simplify (found executing #1688) Tier: mechanical Execution: sequant_run Blocked by: #1688 (both edit phase-executor.ts)
Problem
A spec phase that declares SPEC_DIVERGENCE never halts the run. parseSpecDivergence (src/lib/workflow/phase-executor.ts:1142) reads markers through parsePhaseMarkers (phase-detection.ts:72). That function validates each one against PhaseMarkerSchema (state-schema.ts:74), which requires timestamp: z.string().datetime(), and drops a marker that fails validation without a word.
The spec skill tells the agent to end with a bare marker carrying "status":"failed", "outcome":"SPEC_DIVERGENCE", "divergenceAcs":"AC-N" and an "error" (.claude/skills/spec/SKILL.md:311). It doesn't mention timestamp. So a spec agent that follows its skill emits a marker the parser discards.
Observed: sequant #1688's spec (2026-11-16, run log in the owner's graph-run folder) ended with:
<!-- SEQUANT_PHASE: {"phase":"spec","status":"failed","outcome":"SPEC_DIVERGENCE","divergenceAcs":"AC-3","error":"AC-3 pins the per-site qa wrap …; owner must amend AC-3 or choose option B."} -->
The run printed ✔ #1688 spec and went on to exec, which picked one of the two options the spec had left to the owner. With npx tsx against main, parseSpecDivergence(<that line>) returns undefined. Add "timestamp":"2026-11-16T03:33:00Z" and the same line returns {"acs":"AC-3", …}.
Prior fixes / producers
- Prior fixes:
parseSpecDivergencewas introduced in 70f2846 (feat(run): SPEC_DIVERGENCE escape hatch, ladder halts with evidence bundles, docs, rigged real run (#971 part B) #995);git log -Sshows no later change. - Marker producers: the eight skills that emit
SEQUANT_PHASE(spec, exec, qa, loop, fullsolve, assess, test, verify), all frozen. - Marker consumers:
parsePhaseMarkersserves phase detection (phase-detection.ts:111,141,262, which orders markers bytimestamp) and the escape hatch. - So the fix belongs in the reader. The escape hatch must not depend on a field it never reads.
Acceptance Criteria
- AC-1: A
SPEC_DIVERGENCEmarker with notimestampis returned byparseSpecDivergence, while a marker in a fenced code block still is not. Evidence:npx vitest run src/lib/workflow/phase-executor.test.ts -t "divergence without timestamp"→≥ 2 passed, 0 failed - AC-2: A spec phase whose output ends with a marker shaped like the one above stops the run before exec. Evidence:
npx vitest run src/lib/workflow/batch-executor.test.ts -t "spec divergence without timestamp"→≥ 1 passed, 0 failed - AC-3: Phase detection still orders markers by timestamp. Evidence:
npx vitest run src/lib/workflow/phase-detection.test.ts→0 failed(constraint)
Non-Goals
- Skill text (frozen).
- What happens after the halt (ladder-halt bundle, resume).
Done when
A spec or exec agent that declares the spec impossible, in the shape its skill describes, stops the run.
Activity
admarble commentedon Nov 16, 2026
Runner context, 2026-11-16
mainis at1de9dd5ef, with feat(run): every phase dispatch gets the needs-human Evidence block — exec ran the env-file command in the #1655 smoke #1688 merged.parseSpecDivergence(phase-executor.ts) still reads markers throughparsePhaseMarkers, which validates againstPhaseMarkerSchema, and itstimestampis required.main:parseSpecDivergencereturnsundefinedfor feat(run): every phase dispatch gets the needs-human Evidence block — exec ran the env-file command in the #1655 smoke #1688's spec line,<!-- SEQUANT_PHASE: {"phase":"spec","status":"failed","outcome":"SPEC_DIVERGENCE","divergenceAcs":"AC-3","error":"…"} -->. With"timestamp":"2026-11-16T03:33:00Z"added, it returns{"acs":"AC-3",…}.phase-detection.ts:111,141,262) orders markers bytimestamp. If the fix makestimestampoptional in the shared schema, say in the spec comment how detection handles a marker without one; AC-3 holds detection's tests. A lenient parse used only for the escape hatch is the other route. The spec picks.mainbuild on two notes-fixture smoke issues, after #S-01 to #S-07 merge; the owner reads the report #1655 smoke did halt, presumably because its marker had a timestamp. Cover both phases' shapes in AC-1's tests.vitest.global-setup.tsrebuildsdist/, and spec runs in the main checkout.admarble commentedon Nov 16, 2026
Complexity: Simple (3 ACs, 2 directories)
AC Quality Check
All three ACs are single-line with
Evidence:. The-tfilters match no test today, so AC-1 and AC-2 fail onmainand cannot be vacuous. AC-2 needs care: batch-executor tests mockspecDivergencedirectly (batch-executor.test.ts:3778), so a test that only sets that field would skip the parser and pass without the fix. See Plan step 3.Scope Assessment
Non-Goals: present (skill text, post-halt behaviour). Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: Timestamp-less
SPEC_DIVERGENCEmarker is read; fenced one is notVerification: Unit Test
Scenario: Given output ending with the #1688 line (no
timestamp) → WhenparseSpecDivergenceruns → Then{acs:"AC-3", message}. Same marker in a fenced block →undefined.Assumptions: exec's shape (with timestamp) keeps working.
AC-2: Spec output ending in that marker halts before exec
Verification: Integration Test
Scenario: Given a spec phase whose raw output ends with the timestamp-less marker, run through
mapAgentSuccessToPhaseResultand the batch loop → Then exec never runs and the #995 bundle prints.AC-3: Phase detection still orders by timestamp
Verification: Unit Test (constraint, existing suite)
Implementation Plan
Decision (the issue asks the spec to pick): lenient reader used only by the escape hatch; the shared schema stays unchanged. Making
timestampoptional would leakundefinedintonew Date(b.timestamp)atphase-detection.ts:111,141,262. Those would sort asNaN, and a timestamp-less marker could be picked as the "latest" phase, which changes behaviour AC-3 doesn't cover. A separate reader keeps detection untouched.phase-detection.ts: extract the regex scan fromparsePhaseMarkersinto a shared internalscanMarkerJson(body)(same code-block stripping, same regex, JSON.parse).parsePhaseMarkerskeeps schema-validating the result. Behaviour is unchanged.phase-executor.ts:1142parseSpecDivergence: read via the scanner and validate withPhaseMarkerSchema.partial({ timestamp: true }), or the.omit({timestamp:true})equivalent. This accepts markers with or without a timestamp. Last divergence marker still wins. Update the doc comment, which currently saysparsePhaseMarkersis reused verbatim.phase-executor.test.ts"divergence without timestamp" has ≥2 cases (spec shape without timestamp parses; fenced does not; add the exec shape with timestamp).batch-executor.test.ts"spec divergence without timestamp": feed raw output through the realmapAgentSuccessToPhaseResultand not a mockedspecDivergence, then assert exec is not invoked.parsePhaseMarkers, confirm exactly the new tests fail, restore, and recordMutation-verified:markers in the PR body. Run vitest only in the worktree.Design Review
parseSpecDivergence); the eight producing skills are frozen.timestampin the shared schema (the sort hazard above). Also rejected: editing the skill to add a timestamp (frozen, and the agent can't know the time).parsePhaseMarkerspattern from feat(run): SPEC_DIVERGENCE escape hatch, ladder halts with evidence bundles, docs, rigged real run (#971 part B) #995.git log -S parseSpecDivergenceshows no later fixes, so this is the first fix and there is no re-patch class.timestampoptional?" Answer: step 2 above.SKILL.md:311); the exec skill's divergence marker has the same shape. Consumers ofparsePhaseMarkersare the three detection sites plus this hatch. Only the hatch changes.Open Questions
None blocking. Note that the same timestamp-less drop applies to any other consumer that needs a marker the skill emits without a timestamp. None is in scope.
Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: a small, localised reader fix with unit and integration ACs. testgen is skipped because the tests are small enough for exec to write.
Label Review
Current: graph-2026-11-simplify. Recommended: add
planned.admarble commentedon Nov 16, 2026
QA Verdict: NEEDS_VERIFICATION
Needs human review:
Reviewed in a separate session by claude-code (claude-opus-5-5); the change was written by claude-code (claude-sonnet-5-5).