Repository navigation
Closed
Labels
backlogDeferred until user traction (100+ WAU)enhancementNew feature or requestplannedImplementation plan approvedroadmapFuture plans and roadmap items
Description
Problem (User Impact)
Users cannot add custom workflow phases (e.g., deploy, perf-test, accessibility-audit, i18n-check) without modifying Sequant's source code. Adding a new phase today requires changes in 5+ locations:
PhaseSchemaZod enum insrc/lib/workflow/types.tsPHASE_PROMPTSinsrc/lib/workflow/phase-executor.tsAIDER_PHASE_PROMPTSin phase-executor.tsISOLATED_PHASESarray in phase-executor.ts- Phase detection logic in
src/lib/workflow/phase-detection.ts - Skill template in
templates/skills/<phase>/SKILL.md
This is a closed system. For a workflow orchestrator, extensibility is a core value proposition — users should be able to define project-specific phases without forking.
Why Now
- feat: add OpenAI Codex CLI agent driver #497 (Codex driver) and Multi-agent support: expand Sequant beyond Claude Code #373 (multi-agent support) both add new execution backends — phases and drivers should follow the same extensibility pattern
- The skill template system already provides the execution mechanism (SKILL.md files). The missing piece is phase registration and discovery
- Phase detection via GitHub labels is hardcoded (
BUG_LABELS,UI_LABELS,DOCS_LABELSin phase-mapper) — users can't add their own label-to-phase mappings
Acceptance Criteria
- AC-1:
PhaseDefinitioninterface that describes a phase:interface PhaseDefinition { name: string; skill: string; // skill template directory name promptTemplate: string; // with {issue}, {worktree}, {base} interpolation requiresWorktree: boolean; retryStrategy?: { maxRetries: number; backoffMs?: number; coldStartThreshold?: number }; detect?: { labels?: string[]; bodyPatterns?: RegExp[] }; // auto-detection rules order?: number; // execution ordering (default 0) }
- AC-2:
PhaseRegistryclass withregister(definition),get(name),list(),has(name)methods - AC-3: All 9 built-in phases (
spec,security-review,exec,testgen,test,verify,qa,loop,merger) registered via the same mechanism — no special-casing - AC-4: User-defined phases discoverable from
.sequant/phases/directory — each subdirectory containing aphase.json(orphase.ts) matchingPhaseDefinitionschema - AC-5:
--phasesCLI flag validates against the registry at runtime (not a compile-time Zod enum). Clear error message if a phase name is unknown:"Unknown phase 'deploy'. Available: spec, exec, qa, deploy-staging, ..." - AC-6: Phase detection (
phase-detection.ts,phase-mapper.ts) uses registry-provideddetectrules instead of hardcoded label arrays - AC-7:
phase-executor.tsreads prompt template and retry config from the registry instead ofPHASE_PROMPTSand inline constants - AC-8: Aider-specific prompts handled via an optional
driverOverridesfield inPhaseDefinition— not a parallel hardcoded map - AC-9: Documentation:
sequant phasescommand lists all registered phases (built-in + user-defined) with their detection rules
Scope & Gaps to Watch
- Gap: Phase ordering in pipelines — The default pipeline is
[spec, exec, qa]. User-defined phases need a way to insert into this pipeline (e.g., "run security-review after exec but before qa"). Theorderfield handles explicit ordering; auto-detection handles label-triggered phases. Document both patterns - Gap: Phase dependencies — Phase A might require phase B to have completed first (e.g.,
testgenneedsexec). This issue covers simple ordering; full dependency resolution is out of scope - Gap: Skill template validation — A registered phase with
skill: "deploy"must have a correspondingtemplates/skills/deploy/SKILL.md. Validate at registration time, not at execution time - Gap: Settings migration — Existing
.sequant/settings.jsonfiles reference phases by string. Ensure backwards compatibility — old configs with"phases": ["spec", "exec", "qa"]must continue working - Risk: Over-abstraction — The registry should be ~150 lines. Don't build a full plugin lifecycle (init/setup/teardown hooks). Phase execution is already handled by skills
Technical Notes
- Best practice from research: Rollup/Vite pattern — plugin is an object with
name+ hook methods. Discovery via filesystem scan +import(). Validation at startup, fail fast - Current
PhaseSchema:z.enum(["spec", "security-review", "exec", ...])in types.ts — becomesz.string().refine(name => registry.has(name)) - Current
PHASE_PROMPTS: Record<Phase, string> with 9 entries in phase-executor.ts:25-81 — migrated to registry - Current
ISOLATED_PHASES: hardcoded array — becomesregistry.list().filter(p => p.requiresWorktree) phase-mapper.tsconstants:BUG_LABELS = ["bug", "fix", ...]etc. — becomesregistry.get("exec").detect.labels
Dependencies
- Depends on: arch: extract RunOrchestrator — decouple execution engine from CLI wiring #503 (RunOrchestrator extraction — phases are resolved by the orchestrator)
- Related: Multi-agent support: expand Sequant beyond Claude Code #373 (multi-agent), feat: add OpenAI Codex CLI agent driver #497 (Codex driver — driver-specific prompt overrides)
- Independent of: Event system, async I/O (no shared code paths)
Batch Group
sequant run batch 2 (parallel with event system and async I/O — all depend only on #503)
Metadata
Metadata
Assignees
Labels
backlogDeferred until user traction (100+ WAU)enhancementNew feature or requestplannedImplementation plan approvedroadmapFuture plans and roadmap items
Activity
admarble commentedon Apr 9, 2026
Architecture Review: Recommended Descoping
After an overcomplexity assessment of the #503-#508 target architecture, this issue should be significantly descoped. The current design is a full plugin framework for 9 hardcoded phases maintained by 1 person. Zero users have asked for custom phases.
What to keep
PhaseDefinitioninterface) — yes, formalize what a phase isPhaseRegistryclass withregister/get/list/has) — yesphase-executor.tsreads from registry instead ofPHASE_PROMPTSdict) — yesPhaseDefinition, not a parallel map) — yesWhat to remove
.sequant/phases/directory) — speculative. No user has asked for this. Add when someone files an issue.sequant phasesCLI command) — only useful with user-defined phasesWhat to simplify
--phasesvalidates against registry) — keep, but registry is only populated with built-ins at startup. No filesystem discovery.PhaseDefinitionobjects instead of hardcoded arrays.Rationale
The real problem today is that phase definitions are scattered across 5+ locations (
PhaseSchema,PHASE_PROMPTS,AIDER_PHASE_PROMPTS,ISOLATED_PHASES,phase-detection.ts). A registry class consolidates these into one source of truth — that's valuable internal cleanup.The plugin framework (filesystem discovery,
phase.jsonschema, skill template validation, CLI listing command) is solving a problem nobody has. The interface will be ready for extensibility later, but don't build the discovery/validation machinery until a second user asks for custom phases.Updated AC checklist
PhaseDefinitioninterface describing a phase (name, skill, prompt, worktree, retry, detect rules, driver overrides)PhaseRegistryclass withregister(),get(),list(),has()phase-executor.tsreads from registry (eliminatesPHASE_PROMPTS,AIDER_PHASE_PROMPTS,ISOLATED_PHASES)phase-detection.tsuses registry-provided detect rules (eliminatesBUG_LABELS,UI_LABELS, etc.)--phasesCLI flag validates against registry at runtimedocs: descope target architecture after overcomplexity review
fix(#494): /assess batch output formatting + label-priority spec-skip (…
admarble commentedon Apr 17, 2026
→ PROCEED — Phase plugin registry (user-extensible workflow phases)
Workflow:
spec → exec → qa· 9 ACsContext: #503 (RunOrchestrator extraction) merged via PR #510, so the stated dependency is resolved. Descoped per roadmap (#504/#505/#506 reduced) — confirm current scope during
/spec.⚠ Explicitly independent of #504 (event system) and #506 (async I/O) — no chaining required
admarble commentedon May 14, 2026
→ PROCEED — Descoped registry + built-in consolidation
Workflow:
spec → exec → qa· -qScope reminder: the 2026-04-09 descoping comment is authoritative — keep AC-1/2/3/7/8 (PhaseDefinition interface, PhaseRegistry class, all 9 built-ins registered uniformly, phase-executor reads from registry, driver overrides field) plus AC-5 runtime
--phasesvalidation and AC-6 registry-provided detect rules. Drop AC-4 (.sequant/phases/filesystem discovery) and AC-9 (sequant phasesCLI) — defer to follow-up when a user asks.Independent of #504 — safe to run in parallel.
admarble commentedon May 14, 2026
Spec — phase plugin registry
Complexity: Standard (6 ACs descoped from 9, 2 directories:
src/lib/workflow/,bin/)AC Quality Check
✅ All 6 descoped ACs pass the linter (no vague/unmeasurable/incomplete/open-ended/title-body-tension flags).
Scope Assessment
Non-Goals (from descoping comment):
.sequant/phases/)phase.json/phase.tsschema validationsequant phasesCLI listing commandsrc/lib/workflow/,bin/)Verdict:⚠️ SCOPE_WARNING — sits at the yellow AC threshold and rewires 5 load-bearing files (
types.ts,phase-executor.ts,phase-mapper.ts,state-schema.ts,run-log-schema.ts). The descoping already removed the speculative ACs, so further splitting is not recommended; quality loop should stay enabled to catch regressions in the typed-enum migration.Acceptance Criteria
AC-1:
PhaseDefinitioninterface describing a phaseVerification: Unit Test (type assertions + Zod shape)
Scenario: Given a TypeScript module importing
PhaseDefinition→ When constructing a definition withname,skill,promptTemplate,requiresWorktree,retryStrategy?,detect?,driverOverrides?,order?→ Then the type-checker accepts it and a Zod validator (if used) parses it.Assumptions:
driverOverridesis aRecord<string, { promptTemplate?: string }>keyed by driver name ("aider", future"codex").detect.labelsisstring[];detect.bodyPatternsdeferred (no current consumer).AC-2:
PhaseRegistryclass withregister(),get(),list(),has()Verification: Unit Test
Scenario: Given a fresh
PhaseRegistry→ Whenregister(def)is called and thenget(def.name)/has(def.name)/list()are queried → Then values round-trip; duplicateregistercalls throw;geton unknown name throws with a "did you mean" message that includes registered names.Assumptions: Registry is mutable internally but only mutated by the built-in bootstrap module at import time (no
unregister).AC-3: All 9 built-in phases registered via the same mechanism
Verification: Unit Test (snapshot equality)
Scenario: Given the built-in bootstrap module is imported → When
registry.list().map(p => p.name)is computed → Then the set equals["spec", "security-review", "exec", "testgen", "test", "verify", "qa", "loop", "merger"]and every phase has the same fields populated (noif (phase === "qa") {...}branches anywhere in the codebase).Assumptions: Existing
WORKFLOW_PHASESconstant instate-schema.tsbecomesregistry.list().map(p => p.name).AC-4 (was AC-7):
phase-executor.tsreads from registryVerification: Unit Test
Scenario: Given a phase name and agent driver → When
getPhasePrompt(phase, issueNumber, agent)is invoked → Then the prompt template comes fromregistry.get(phase).promptTemplate(ordriverOverrides[agent]?.promptTemplateif present) —PHASE_PROMPTS,AIDER_PHASE_PROMPTS, andISOLATED_PHASESconstants are deleted.requiresWorktreeandretryStrategy.coldStartThresholdcome from registry entries.Assumptions: Existing
phase-executor.test.tstests "uses AIDER_PHASE_PROMPTS for non-claude agents" / "uses PHASE_PROMPTS for claude-code agent" continue to pass after refactor (behavioral contract preserved). Aider's full self-contained prompts move into the registry'sdriverOverrides.aider.promptTemplate.AC-5 (was AC-6, simplified):
phase-mapper.tsconsumes registry-provideddetectrulesVerification: Unit Test
Scenario: Given an issue with
["ui"]labels → WhendetectPhasesFromLabels(labels)is called → Then the result derives fromregistry.list().filter(p => p.detect?.labels?.some(l => labels.includes(l)))rather than the hardcodedUI_LABELS/SECURITY_LABELSarrays.UI_LABELSandSECURITY_LABELSconstants are removed.Assumptions:
BUG_LABELS,DOCS_LABELS, andCOMPLEX_LABELSare issue-type metadata (not phase-trigger rules — seephase-mapper.ts:77-80) and stay in a labels module (or move toissue-types.ts) — they are out of scope for the registry.phase-detection.ts(issue body says "phase-detection.ts, phase-mapper.ts") does not use any label arrays — onlyphase-mapper.tsis rewired. Plan note: confirm during exec and update the issue body if the user wantsphase-detection.tsremoved from AC-5's wording.AC-6 (was AC-5, simplified):
--phasesCLI flag validates against registry at runtimeVerification: Integration Test (spawn
bin/cli.ts run 1 --phases foo)Scenario: Given an unknown phase name passed via
--phases deploy,exec→ When the CLI parses the flag → Then it exits non-zero with stderrUnknown phase 'deploy'. Available: spec, security-review, exec, testgen, test, verify, qa, loop, merger.PhaseSchemabecomesz.string().refine(name => registry.has(name), { message: ... })instead of the literalz.enum([...]).Assumptions: Validation occurs after registry bootstrap (top-level import side effect). All Zod consumers —
run-log-schema.ts,state-schema.ts,phase-types.test.ts,run-log-schema.test.ts,assess-skill.test.ts(which readsPhaseSchema.options) — continue working. Risk:PhaseSchema.optionsis an array literal onz.enum; switching toz.string().refineremoves.options. Plan: add a siblinggetPhaseNames()helper and migrate the four call sites that read.options.Implementation Plan
Phase 1: Foundation — interface + registry
src/lib/workflow/phase-registry.tsexporting:PhaseDefinitioninterface (name, skill, promptTemplate, requiresWorktree, retryStrategy?, detect?, driverOverrides?, order?)PhaseRegistryclass (register/get/list/has)phaseRegistryinstancesrc/lib/workflow/built-in-phases.ts— registers all 9 built-ins by callingphaseRegistry.register(...)at module load. Migrate the literal prompts fromPHASE_PROMPTSandAIDER_PHASE_PROMPTS(the latter intodriverOverrides.aider.promptTemplate). SetrequiresWorktree: truefor the 6 ISOLATED_PHASES,falseforspec/verify/merger.getPhaseNames()helper on the registry (or as a sibling export) returningstring[]— replaces the removedPhaseSchema.optionsfor the four current call sites.Phase 2: Rewire the type system
src/lib/workflow/types.ts: changePhaseSchemafromz.enum([...])toz.string().refine(n => phaseRegistry.has(n), { message: ... }). KeepPhase = z.infer<typeof PhaseSchema>(becomesstring). ImportphaseRegistryfromphase-registry.ts. Beware import cycles —built-in-phases.tsmust run before any Zod parse that touchesPhaseSchema; resolve via lazy registration in a barrel module.PhaseSchema.optionscall sites togetPhaseNames():state-schema.ts:27(WORKFLOW_PHASES)phase-types.test.ts:32, 36, 49-51run-log-schema.test.ts:27assess-skill.test.ts:27Phase 3: Rewire phase-executor
phase-executor.ts:PHASE_PROMPTS,AIDER_PHASE_PROMPTS,ISOLATED_PHASESconstants.getPhasePrompt: look upregistry.get(phase).promptTemplate(default) orregistry.get(phase).driverOverrides?.[agent]?.promptTemplate(whenagent !== "claude-code").worktreePath && ISOLATED_PHASES.includes(phase)checks (lines 576, 582) becomeworktreePath && registry.get(phase).requiresWorktree.retryStrategy.coldStartThresholdoverride only for phases that need it (currently none — defer to a separate issue if a phase requires custom retry).phase-executor.test.ts:421-435tests intact — they validate prompt selection by agent. After migration they should still pass because the behavior is preserved, just sourced from the registry.Phase 4: Rewire phase-mapper
phase-mapper.ts:UI_LABELSandSECURITY_LABELSconstants.detectPhasesFromLabels: iterateregistry.list(), filter byp.detect?.labels?.some(...), sort byp.order ?? 0.BUG_LABELS,DOCS_LABELS,COMPLEX_LABELSas-is (they are metadata helpers consumed bybatch-executor.ts:758and the quality-loop trigger — not phase-trigger rules). Add a code comment explaining the distinction.hasUILabels(labels)becomes a thin shim overregistry.get("test").detect?.labelsor is deleted if its callers can use the registry directly.Phase 5: CLI validation
bin/cli.ts(around line 197 —--phases <list>option): add a post-parse validation step that callsphaseRegistry.has()for each comma-separated phase. On miss, logUnknown phase '<name>'. Available: ${phaseRegistry.list().map(p => p.name).join(", ")}to stderr andprocess.exit(1).src/lib/workflow/phase-registry.integration.test.tsthat spawns the CLI with--phases bogus,execand asserts non-zero exit + error message.Step dependencies: 1 → 2 → 3 must be sequential (3 imports the bootstrap from 2). 4–5 (Zod rewire) depend on 3. 6–7 (executor) and 8 (mapper) are independent and can be parallelized. 9–10 (CLI) depend on 4.
Design Review
phase-registry.tsmodule insidesrc/lib/workflow/— the same layer that ownsphase-executor.ts,phase-mapper.ts, andtypes.ts. Co-locates the source of truth with its consumers without adding a new layer.built-in-phases.ts. Rejected alternatives: (a) Factory function returning a frozen object — fine, but harder to extend later when AC-4-deferred ships; (b) Zod-validated registration — premature, no external input today.drivers/index.tsgetDriver(name)pattern — name-keyed lookup over a fixed registry. The PhaseDefinition shape is also analogous to Rollup/Vite's plugin object (per the issue's technical notes), minus the hook lifecycle.z.enumtoz.string().refine— does that break exhaustiveness checking in TSswitchstatements?" — Yes, marginally. ThePhasetype widens from"spec" | "exec" | ...union tostring. We'll lose compile-time exhaustiveness onswitch (phase). Mitigation: there is currently exactly one such switch (mapAgentSuccessToPhaseResultinphase-executor.ts:421) and it only special-casesqaandexec. Keep that as runtime string comparison — explicit comment noting that exhaustiveness moved to runtime.types.ts(PhaseSchema) andphase-registry.tsandbuilt-in-phases.tsform a triangle. Resolve by: (a)phase-registry.tsexports the class but no instance; (b) a barrel/init module constructs the singleton and registers built-ins; (c)types.tsimports the singleton via the barrel.Feature Quality Planning
Notable items:
feedback_full_suite_on_api_breaks.md): This changes the inferredPhasetype from a string-literal union tostring. Run the full test suite locally before pushing — type widening can cascade into unrelated callers that pattern-match on the literal type.spec, security-review, exec, testgen, test, verify, qa, loop, merger). After migration the order comes fromregistry.list()insertion order inbuilt-in-phases.ts. Add a unit test assertingregistry.list().map(p => p.name)equals that exact 9-element array — guards against future reorderings.COMPLEX_LABELSinphase-mapper.tstriggersqualityLoop: true, not a phase. It does not migrate to the registry. Document this in a code comment to prevent a follow-up cleanup from incorrectly folding it in.phase-detection.tsandphase-mapper.ts. Onlyphase-mapper.tsactually uses the label arrays. Plan recommends updating the issue body to dropphase-detection.tsfrom AC-5 — or note in the PR description that it was a no-op for that file.Open Questions
/assesschosespec → exec → qa(no testgen). Recommendation: skip testgen — the existingphase-executor.test.ts/phase-mapper.test.ts/phase-types.test.tsfiles already cover the contract this refactor must preserve, and adding stubs risks the untracked-test cleanup pattern from memory. Impact if wrong: minor — testgen can be added in a follow-up.built-in-phases.tsruns (e.g., a test that importstypes.tsfirst),PhaseSchema.refine()will fail. Recommendation: use eager registration by makingbuilt-in-phases.tsa side-effect-only module that's imported at the top oftypes.ts. Impact if wrong: test flakes in non-deterministic import-order environments.retryStrategyfield — populated for built-ins? AC-1 includesretryStrategyin the interface, but the existingCOLD_START_THRESHOLD_SECONDS/COLD_START_MAX_RETRIES/SPEC_RETRY_BACKOFF_MS/SPEC_EXTRA_RETRIESare top-level constants inphase-executor.ts. Recommendation: keep retry constants global for this PR — populateretryStrategyfield on the spec phase only (whereSPEC_EXTRA_RETRIESis phase-specific) and leaveloopphase'sretryStrategy: { maxRetries: 0 }to encode the "skip cold-start retries for loop" rule atphase-executor.ts:827. Impact if wrong: harmless — can be refined later when more phases need per-phase retry tuning.Conflict Risk Analysis
feature/504-arch-typed-workflow-event-system-for-decoupled-pro. #504 is currently clean (no commits ahead oforigin/main), but its scope also touchessrc/lib/workflow/. Likely overlap:phase-executor.ts(registry consumer here, event emitter there).types.ts(Phase type here, event types there).Mitigation options:
PhaseSchemashape), then arch: typed workflow event system for decoupled progress, logging, and MCP streaming #504 rebases onto it. The/assesscomment explicitly notes arch: phase plugin registry — user-extensible workflow phases #505 is independent of arch: typed workflow event system for decoupled progress, logging, and MCP streaming #504, so this is a soft preference, not a hard dependency.Recommended Workflow
Phases:
spec → exec → qaQuality Loop: enabled
Reasoning: Standard tier with a yellow scope flag. The refactor touches the canonical
PhaseSchematyped enum that downstream Zod schemas (state-schema.ts,run-log-schema.ts) depend on — regression risk is high enough to warrant the quality loop. No UI changes, no security surface, no new unit-test ACs that benefit from stubs — testgen skipped.Label Review
Current:
enhancement,roadmap,backlogRecommended:
enhancement,refactor,roadmap— dropbacklog(active per/assess), addrefactor(so the quality loop auto-enables and the assess heuristic correctly classifies the work).Reason: Issue is actively being worked (multiple
/assessPROCEEDs);backlogis misleading.refactortriggersCOMPLEX_LABELS→qualityLoop: true, which matches the recommendation above.→
gh issue edit 505 --remove-label backlog --add-label refactoradmarble commentedon May 14, 2026
/exec Progress Update — Phase plugin registry implementation
PR: #644 (opened, awaiting QA)
Pre-PR AC Verification
PhaseDefinitioninterface (name, skill, promptTemplate, requiresWorktree, retryStrategy, detect, driverOverrides, order)src/lib/workflow/phase-registry.ts:53-91PhaseRegistryclass withregister/get/list/hassrc/lib/workflow/phase-registry.ts:93-148+ 5 unit testsphase-registry.ts:168-323; snapshot test asserts canonical orderphase-executor.tsreads from registryPHASE_PROMPTS/AIDER_PHASE_PROMPTS/ISOLATED_PHASESphase-mapper.tsconsumes registry-provideddetectrulesUI_LABELS/SECURITY_LABELS; newdetectPhasesFromRegistry()--phasesCLI validates against registry at runtimebin/cli.ts:76-100+ 3-case integration testdriverOverridesfielddriverOverrides.aider.promptTemplateDeferred (per descoping comment):
.sequant/phases/filesystem discoverysequant phasesCLI commandFiles Changed
src/lib/workflow/phase-registry.ts(new)PhaseDefinitioninterface +PhaseRegistryclass + 9 built-in registrationssrc/lib/workflow/phase-registry.test.ts(new)src/lib/workflow/phase-registry.integration.test.ts(new)src/lib/workflow/phase-executor.tsPHASE_PROMPTS/AIDER_PHASE_PROMPTS/ISOLATED_PHASES; reads from registrysrc/lib/workflow/phase-mapper.tsUI_LABELS/SECURITY_LABELS;detectPhasesFromRegistry()+ registry-drivenhasUILabels+parseRecommendedWorkflowsrc/lib/workflow/types.tsPhaseSchemaswitches fromz.enumtoz.string().refine;Phasewidens tostringsrc/lib/workflow/state-schema.tsWORKFLOW_PHASESmigrates fromPhaseSchema.options→getPhaseNames()src/lib/workflow/phase-types.test.ts.optionsreferences togetPhaseNames()src/lib/__tests__/assess-skill.test.tsPhaseSchema.optionstogetPhaseNames()bin/cli.tsvalidatePhasesFlag()+ wires it as the--phasesargument parserCHANGELOG.md[Unreleased] ChangedentryChecks Run
npm run builderror: (issue) => ...form for refine messages)npm run lintnpm test(unit)phase-registry.integration.test.ts,cli.integration.test.ts)--phasesvalidation works end-to-endQuality Plan Alignment
PhaseSchema/ state-schema / run-log-schema still reference the same object;WORKFLOW_PHASESregenerated from registryphase-registry.test.ts:92-110) pins the 9-phase canonical ordergetPhasePrompt/detectPhasesFromLabels/hasUILabelsCOMPLEX_LABELSdeliberately left out of the registry (it's a quality-loop trigger, not a phase trigger); code comment documents the distinctionphase-detection.tsdoes not use label arrays — onlyphase-mapper.tsrewired (matches plan note)Pre-PR Confidence Check
built-in-phases.tsmodule per the plan, but ESM hoisting evaluatedphaseRegistry.register(...)calls before thephaseRegistry = new PhaseRegistry()const was initialized (binding TDZ-like behavior), causing test failures in any test that importedphase-mapper.tswithout going throughtypes.ts. Resolved by colocating built-in registrations at the bottom ofphase-registry.ts— same pattern asdrivers/index.ts. No remaining cycle, all tests green.bin/cli.tsis covered via the integration test that actually spawns the CLI.Quality Plan Items
All applicable items from the spec's Feature Quality Planning section addressed. The "lazy-registration vs. eager" open question (#3) is resolved by the colocation approach — registrations run as part of module load, synchronous with
phaseRegistrycreation.Next Steps
/qa 505docs(#505): rewrite phase-type-definitions for registry pattern
admarble commentedon May 14, 2026
/fullsolve Complete
Issue: #505
Status: READY_FOR_MERGE
PR: #644
Progress
AC Coverage (7/7 in-scope)
Authoritative scope is the 2026-04-09 descoping comment. The PR uses renumbered ACs in its description; mapping shown below.
PhaseDefinitioninterfacephase-registry.ts:56-86PhaseRegistryclass withregister/get/list/hasphase-registry.ts:96-148phase-registry.ts:174-333.sequant/phases/filesystem discovery--phasesvalidates against registry at runtimebin/cli.ts:76-97phase-mapper.tsconsumes registry detect rulesphase-mapper.ts:54-63phase-executor.tsreads from registryrequiresWorktreesourced from registrydriverOverridesfieldsequant phasesCLI commandQuality Metrics
anytypes addedorigin/main: 0(#505)referenceRisk Assessment
driverOverrides.aideris caught by the AC-8 contract test; duplicate registration throws at module load (fail-fast).retryStrategyfield is registered as metadata only —phase-executor.tsstill uses hardcodedSPEC_RETRY_BACKOFF_MS/SPEC_EXTRA_RETRIES/COLD_START_*constants. Acknowledged in code comments atphase-registry.ts:181-184. Per the descoping comment, only thePHASE_PROMPTS dictwas in scope for AC-7 — strictly met. Optional follow-up if telemetry begins consumingretryStrategy.Phaseis nowstring(no longer string-literal union). Switch exhaustiveness traded for extensibility; lone survivingswitch (phase)site only branches on"qa"and"exec"and is protected by runtime equality.Documentation
[Unreleased]/Changeddocs/features/phase-type-definitions.md: rewritten for registry pattern (commit173a26f)Ready for human review and merge.
refactor(#505): consume retryStrategy from registry, idiomatic CLI error
chore(#505): merge origin/main, resolve types.ts + CHANGELOG conflicts
admarble commentedon May 14, 2026
Gap-fix follow-up — complete
Two non-blocking QA observations from the prior review have been addressed, plus a cross-PR merge with #504.
Commits on top of the original PR #644
82d7bb0refactor(#505)retryStrategyconsumption + idiomatic CLI errorf940c53chore(#505)origin/main(resolves cross-PR conflict with #504 / commitb4e8814)What changed in
82d7bb0phase-executor.tsnow consumesretryStrategyfrom the registrySPEC_RETRY_BACKOFF_MS/SPEC_EXTRA_RETRIESare derived fromphaseRegistry.get("spec").retryStrategyat module load (with the prior literals as misconfiguration fallbacks).phaseRegistry.has(phase) && phaseRegistry.get(phase).retryStrategy?.maxRetries === 0instead ofphase === "loop". Any future phase registered withmaxRetries: 0inherits the skip-cold-start-retries behavior without a code change.bin/cli.ts:validatePhasesFlagthrowsInvalidArgumentErrorconsole.error + process.exit(1). Commander wraps the error with the offending flag name, so the user-facing message becomeserror: option '--phases <list>' argument 'deploy' is invalid. Unknown phase 'deploy'. Available: ...— more informative than before. The existing 3-case integration test passes unchanged (assertions match the preserved message substrings).Cross-PR merge in
f940c53PR #504 (typed workflow event system) merged to
mainmid-session and touchedtypes.ts,CHANGELOG.md,phase-executor.ts,phase-mapper.ts, andbin/cli.ts. The merge resolved cleanly:types.tsconflict was import-only — kept both sides (registry import + event-emitter type re-exports are independent).CHANGELOG.mdconflict was both PRs adding[Unreleased]entries — kept both, orderedAdded(arch: typed workflow event system for decoupled progress, logging, and MCP streaming #504) beforeChanged(arch: phase plugin registry — user-extensible workflow phases #505) per Keep-a-Changelog convention. Updated the arch: phase plugin registry — user-extensible workflow phases #505 bullet to mention the newretryStrategyruntime consumption.Verification
npm run buildbuild 20.x,build 22.x,typecheck,validate-skills,validate-plugin)mergeablePR #644 is ready for human merge.
feat(#505): consolidate phase definitions into PhaseRegistry (#644)
docs(#505): complete --phases reference for run-command
admarble commentedon May 14, 2026
Documentation Review Complete
The PR (#644) rewrote
docs/features/phase-type-definitions.mdas part of the implementation — 81 lines covering Prerequisites, registry architecture, "Adding a New Phase", What to Expect, and Troubleshooting. That doc is the authoritative reference for the registry pattern.One reference-doc gap was outside the PR's diff and has been patched on main (
884e4fd):docs/reference/run-command.mdupdates--phasestable row now describes the new runtime validation behavior with the exact error format (error: option '--phases <list>' argument 'X' is invalid. Unknown phase 'X'. Available: ...).spec,testgen,exec,test,qa,loop→ now addssecurity-review,verify,merger).security-review,test) so users know when each gets inserted.docs/features/phase-type-definitions.mdfor the registry pattern and "how to add a new phase" walkthrough.Files
docs/features/phase-type-definitions.md— comprehensive, shipped with PR feat(#505): consolidate phase definitions into PhaseRegistry #644docs/reference/run-command.md— gap-patched on main (commit884e4fd)CHANGELOG.md—[Unreleased] / Changedentry shipped with PR feat(#505): consolidate phase definitions into PhaseRegistry #644Ready for any reader of
sequant run --helpfollowups.fix(#647): AC-3 — route retry/fallback messages through renderer's ap…
fix(#856): surface externally-terminated runs as aborts; stop logging…
fix(#856): surface externally-terminated runs as aborts; stop logging…
fix(#652): renderer bottom-output corruption — column-binding + rende…