Repository navigation
Description
Summary
The quality loop (--quality-loop) never triggers because QA phase success is determined by whether the SDK query completed, not whether the QA verdict passed.
Related Issues
| Issue | Status | What it addressed | Why insufficient |
|---|---|---|---|
| #143 | CLOSED | Made QA skill require execution evidence | Skill outputs better verdicts, but CLI doesn't parse them |
| #171 | CLOSED | Made QA skill stricter about verdict criteria | Same - skill is stricter, but CLI ignores the verdict |
Root cause: Those fixes made the QA skill stricter, but run.ts never parses the verdict. Even if QA correctly outputs "AC_NOT_MET", the CLI marks it as success because the SDK query completed.
Design Assumption
The workflow assumes:
- exec either completes or errors out
- QA is the gate that catches incomplete/poor work
- loop fixes issues QA finds
The broken link is between QA and loop - QA finds issues but loop never triggers.
Root Cause
In src/commands/run.ts line ~1012:
if (resultMessage.subtype === "success") {
return {
phase,
success: true, // Always true if SDK query completed
...
};
}The SDK's subtype: "success" means "the query finished without errors" - it says nothing about whether QA found gaps or the verdict was passing.
Current Behavior
| QA Output | SDK Status | Phase Result | Loop Triggers? |
|---|---|---|---|
| "READY_FOR_MERGE" | success | success | No (correct) |
| "AC_MET_BUT_NOT_A_PLUS" | success | success ❌ | No ❌ |
| "AC_NOT_MET" | success | success ❌ | No ❌ |
Evidence
From logs (.sequant/logs/run-2026-01-31*.json):
qualityLoop: trueis enabled- All phases show
status: "success" - No loop phase ever appears
- User reports always finding gaps when running
/qamanually aftersequant run
This matches the evidence from #143: "34 run logs: zero show /loop triggered"
Expected Behavior
For QA phase specifically, parse the output for verdict and only mark as success if READY_FOR_MERGE:
| QA Verdict | Phase Result | Loop Triggers? |
|---|---|---|
| "READY_FOR_MERGE" | success | No |
| "AC_MET_BUT_NOT_A_PLUS" | failure | Yes |
| "AC_NOT_MET" | failure | Yes |
Proposed Fix
Add verdict parsing after QA phase in executePhase or the calling code:
// After executePhase for QA
if (phase === "qa" && phaseResult.success && phaseResult.output) {
const verdict = parseQaVerdict(phaseResult.output);
if (verdict && verdict !== "READY_FOR_MERGE") {
phaseResult.success = false;
phaseResult.error = `QA verdict: ${verdict}`;
}
}Parse function:
function parseQaVerdict(output: string): string | null {
// Look for "### Verdict: X" or "**Verdict:** X" or "Verdict: X"
const verdictMatch = output.match(
/(?:###?\s*)?(?:\*\*)?Verdict(?:\*\*)?:?\s*\**\s*(READY_FOR_MERGE|AC_MET_BUT_NOT_A_PLUS|AC_NOT_MET)/i
);
return verdictMatch?.[1]?.toUpperCase().replace(/_/g, '_') || null;
}Acceptance Criteria
- AC-1: Add
parseQaVerdict()function to parse QA output for verdict - AC-2: QA phase only marked as success if verdict is
READY_FOR_MERGE - AC-3: Non-passing verdict triggers quality loop when
--quality-loopis enabled - AC-4: Add unit tests for verdict parsing (various formats)
- AC-5: Log files show
loopphase when QA verdict is notREADY_FOR_MERGE - AC-6: Logs include the parsed verdict in phase metadata
Test Cases for Verdict Parsing
// Should parse
"### Verdict: READY_FOR_MERGE" → "READY_FOR_MERGE"
"**Verdict:** AC_NOT_MET" → "AC_NOT_MET"
"Verdict: AC_MET_BUT_NOT_A_PLUS" → "AC_MET_BUT_NOT_A_PLUS"
// Edge cases
"verdict: ready_for_merge" → "READY_FOR_MERGE" (case insensitive)
"No verdict found" → null (don't fail, just don't trigger loop)Priority
High - This is a fundamental feature that has never worked. Users expect quality loop to catch gaps but it never does. Previous fixes (#143, #171) addressed the symptom in the skill but not the root cause in the CLI.
Activity
admarble commentedon Jan 31, 2026
📋 Implementation Plan for #218
Acceptance Criteria
parseQaVerdict()function to parse QA output for verdictREADY_FOR_MERGE--quality-loopis enabledloopphase when QA verdict is notREADY_FOR_MERGEVerification Methods
"### Verdict: X"→ returns verdict stringAC_NOT_METverdict →success: false--quality-loop→/loopexecutes"phase": "loop"entryPhaseLog.verdictfield populatedImplementation Steps
Phase 1: Verdict Parser
parseQaVerdict()insrc/commands/run.tsPhase 2: Integration
3. Modify
executePhase()to parse verdict for QA phase4. Mark QA as failure when verdict ≠
READY_FOR_MERGEPhase 3: Logging
5. Extend
PhaseLogSchemawithverdictfield6. Update
createPhaseLogFromTiming()to include verdict7. Pass verdict through logging calls
Phase 4: Verification
8. Integration test: verify loop triggers on non-passing verdict
Files to Modify
src/commands/run.ts- Add parser, modify executePhasesrc/commands/run.test.ts- Add verdict parsing testssrc/lib/workflow/run-log-schema.ts- Add verdict fieldsrc/lib/workflow/log-writer.ts- Pass verdict to logsAssumptions
NEEDS_VERIFICATIONverdict treated as success (no loop trigger)Plan generated by /spec
fix(#218): Parse QA verdict to properly trigger quality loop
admarble commentedon Jan 31, 2026
QA Review Complete ✅
Verdict: READY_FOR_MERGE
All 6 acceptance criteria are met. The implementation correctly fixes the root cause by parsing the QA verdict from output rather than relying on SDK completion status.
AC Coverage
parseQaVerdict()functionQuality Metrics
CI Status
5/6 checks passed, 1 pending (build 18.x)
Highlights
parseQaVerdict()with comprehensive regexPR: #221
QA generated by /qa
admarble commentedon Jan 31, 2026
/fullsolve Complete ✅
Issue: #218
Status: READY_FOR_MERGE
Summary
Iterations
Key Changes
parseQaVerdict()function to parse verdict from QA outputexecutePhase()to check verdict for QA phasePhaseResult,PhaseLogSchemawithverdictfieldPR: #221
Ready for human review and merge.
admarble commentedon Feb 1, 2026
Merged & Verified ✅
PR #221 merged and smoke tested.
Post-Merge Verification
npm run buildsucceedsparseQaVerdict()workssequant doctorpassesWhat's Fixed
When running
sequant run --quality-loop, the CLI now:### Verdict: AC_NOT_MET)READY_FOR_MERGEorNEEDS_VERIFICATION/loopphase to fix issues (was never triggering before).sequant/logs/*.jsonfor debuggingBreaking Change?
No. Backwards compatible:
READY_FOR_MERGE/NEEDS_VERIFICATION→ successAC_NOT_MET/AC_MET_BUT_NOT_A_PLUS→ failure (triggers loop)Closing issue.
docs: Add #218 quality loop fix to changelog