Skip to content

fix(#218): Parse QA verdict to properly trigger quality loop - #221

Merged
admarble merged 3 commits into
mainfrom
feature/218-bug-quality-loop-never-triggers-qa-verdict-not
Feb 1, 2026
Merged

admarble merged 3 commits into
mainfrom
feature/218-bug-quality-loop-never-triggers-qa-verdict-not

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Fixes the broken quality loop that never triggered despite --quality-loop flag
  • Root cause: SDK subtype: "success" means query completed, not that QA passed
  • Now parses actual QA verdict from output to determine phase success

Changes

  • Add parseQaVerdict() function to extract verdict from QA output
  • Modify executePhase() to check verdict for QA phase
  • Add verdict field to PhaseResult, PhaseLog, and schema
  • Pass verdict through to run logs for debugging visibility
  • Add 15 unit tests for verdict parsing (various formats)

Test plan

  • Unit tests for verdict parsing (all formats from issue)
  • Build succeeds with npm run build
  • All related tests pass (run.test.ts, log-writer.test.ts, run-log-schema.test.ts)

Acceptance Criteria

AC Status Evidence
AC-1: Add parseQaVerdict() function ✅ src/commands/run.ts:84-101
AC-2: QA phase success based on verdict ✅ src/commands/run.ts:1054-1079
AC-3: Non-passing verdict triggers loop ✅ Existing loop logic at line 2408+ handles success: false
AC-4: Unit tests for parsing ✅ src/commands/run.test.ts:593-701 (15 tests)
AC-5: Log files show loop phase ✅ Loop logged via existing logWriter.logPhase() call
AC-6: Logs include verdict metadata ✅ src/lib/workflow/run-log-schema.ts:82 + log-writer update

Fixes #218

🤖 Generated with Claude Code

admarble and others added 2 commits January 31, 2026 13:00
The quality loop (`--quality-loop`) never triggered because QA phase
success was determined by SDK query completion, not the actual QA verdict.

Changes:
- Add `parseQaVerdict()` function to parse verdict from QA output
- Modify `executePhase()` to check verdict for QA phase:
  - READY_FOR_MERGE and NEEDS_VERIFICATION → success
  - AC_NOT_MET and AC_MET_BUT_NOT_A_PLUS → failure (triggers loop)
- Add `verdict` field to PhaseResult, PhaseLog, and PhaseLogSchema
- Pass verdict through logging for visibility in run logs
- Add comprehensive unit tests for verdict parsing (15 test cases)

Fixes #218

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The QaVerdict type is used via PhaseLog["verdict"], so the direct
import was unnecessary and triggered an ESLint warning.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove duplicate QaVerdict definitions from run.ts and types.ts
- Single source of truth is now run-log-schema.ts (Zod schema)
- types.ts imports and re-exports for consumer convenience
- run.ts imports from types.ts

This prevents maintenance issues when adding new verdict types.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@admarble
admarble merged commit 595e393 into main Feb 1, 2026
4 of 6 checks passed
@admarble
admarble deleted the feature/218-bug-quality-loop-never-triggers-qa-verdict-not branch February 1, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Quality loop never triggers - QA verdict not parsed

1 participant