Skip to content

fix(#921): spec recommendation handoff — resolve via structured comment marker - #925

Merged
admarble merged 2 commits into
mainfrom
feature/921-fix-run-spec-recommendation-handoff-parses-eph
Aug 9, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/921-fix-run-spec-recommendation-handoff-parses-eph

Conversation

@admarble

@admarble admarble commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a comment-marker → comment-prose → chat-text → label-fallback resolution chain (spec-recommendation.ts) so sequant run reads the spec agent's durable GitHub comment first, instead of only ever regexing its ephemeral chat text.
  • Fixes the proven fix(sync): plain sync overwrites CUSTOMIZABLE_FILES (constitution) — copyDir ignores force and never consults isCustomizableFile #814 failure mode: when the spec agent posts its plan via gh issue comment --body-file, chat text has no ## Recommended Workflow section to match, and the run silently fell back to label-based detection — which can never produce testgen or security-review.
  • Records the resolution source (marker/comment-prose/chat/label-fallback) per issue in the run log (specRecommendation field), making fallback frequency auditable instead of invisible.
  • /spec's Output Template now emits the <!-- SEQUANT_SPEC: {json} --> marker alongside the existing prose section, mirrored byte-identical across all 3 skill copies.

AC Coverage

AC Description Status Evidence
AC-1 Output Template emits SEQUANT_SPEC marker, mirrored 3-dir ✅ .claude/skills/spec/SKILL.md + 2 mirrors; check-skill-sync.ts reports 44/44 synced
AC-2 Zod schema + registry validation, invalid marker falls through loudly ✅ spec-recommendation.ts:parseSpecMarker (SpecMarkerJsonSchema, phaseRegistry.has(), chalk.yellow warnings)
AC-3 Ordered resolution chain, reuses stripMarkdownCode ✅ spec-recommendation.ts:resolveSpecRecommendation; stripMarkdownCode exported from phase-detection.ts
AC-4 Run log records resolution source + phases ✅ run-log-schema.ts:SpecRecommendationSchema on IssueLogSchema; LogWriter.setSpecRecommendation
AC-5 #814 motivating fixture resolves testgen via comment path ✅ __tests__/fixtures/spec-recommendation-814.json (real captured #814 comment) + spec-recommendation.test.ts; mutation-verified (see Test plan)
AC-6 Legacy no-marker comments resolve via comment-prose ✅ spec-recommendation.test.ts "legacy comments without a marker"
AC-7 CHANGELOG entry ✅ CHANGELOG.md Unreleased → Fixed

Mutation verification (CLAUDE.md gate-test rule)

Test plan

  • npm run build — clean
  • npm run lint — clean (0 errors, 0 warnings)
  • Targeted npx vitest run src/lib/workflow/ __tests__/integration/spec-marker-skill-sync.integration.test.ts __tests__/integration/skill-sync.integration.test.ts — 1408 passed, 2 skipped, 73 files
  • npx tsx scripts/check-skill-sync.ts — 44 synced, 0 diverged, 0 missing
  • Both new gate tests mutation-verified per CLAUDE.md (see above)

Closes #921

…ent marker

Adds a comment-marker → comment-prose → chat-text → label-fallback
resolution chain (spec-recommendation.ts) so the durable SEQUANT_SPEC
marker in the spec agent's GitHub comment is the primary source of
truth, instead of only ever regexing ephemeral chat text. Fixes the
#814 failure mode where a body-file-posted plan silently dropped the
recommended testgen phase.

- AC-1: spec Output Template emits SEQUANT_SPEC marker, synced 3 dirs
- AC-2: Zod schema + registry validation, invalid markers fall through
- AC-3: resolution chain reuses stripMarkdownCode from phase-detection
- AC-4: IssueLogSchema.specRecommendation + LogWriter.setSpecRecommendation
- AC-5: #814 motivating fixture (real captured comment + chat text)
- AC-6: legacy no-marker comments resolve via comment-prose fallback
…mport (AC-7)

Lint caught the unused import left over when resolveSpecRecommendation
replaced the old two-branch fallback in batch-executor.ts.
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