Skip to content

fix(#749): AC_MET_BUT_NOT_A_PLUS QA verdict breaks to PR instead of looping - #753

Merged
admarble merged 2 commits into
mainfrom
feature/749-fix-run-ac-met-but-not-a-plus-qa-verdict-misrouted
Jul 14, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/749-fix-run-ac-met-but-not-a-plus-qa-verdict-misrouted

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

sequant run treated a QA verdict of AC_MET_BUT_NOT_A_PLUS as a phase failure. Under -Q this fed the quality loop, re-ran the pipeline from phase 0 (starting with testgen under --testgen), never reached zero failures, and exited status=failure with no PR — even though acceptance criteria were met. The documented policy (and ready-gate.ts's ac policy, already wired into sequant ready) is to break to PR; /loop is for AC_NOT_MET only.

The fix is the single load-bearing line at phase-executor.ts:396: the failing branch is narrowed from "any verdict not in {READY_FOR_MERGE, NEEDS_VERIFICATION}" to an explicit verdict === "AC_NOT_MET" check. The null/unparseable branch (#534) is unchanged. AC_MET_BUT_NOT_A_PLUS now returns success: true with the verdict retained so the PR body / run log surfaces the "not A+" note.

Because every downstream router (batch-executor loop trigger, shouldCreatePR, the --qa-gate --chain break at run-orchestrator.ts:1076-1080) keys off result.success only, flipping this one mapping fixes AC-1 and AC-2 together — no router changes needed.

Pre-PR AC Verification

AC Description Status Evidence
AC-1 run breaks to PR on AC_MET_BUT_NOT_A_PLUS instead of looping/failing ✅ phase-executor.ts:396; test "treats AC_MET_BUT_NOT_A_PLUS as success → break to PR"
AC-2 --qa-gate --chain not broken by an AC_MET_BUT_NOT_A_PLUS predecessor ✅ Follows from AC-1 (chain break keys on result.success); test applies the exact run-orchestrator.ts:1077 predicate
AC-3 AC_NOT_MET and null/unparseable still hard-fail ✅ Explicit AC_NOT_MET branch + #534 null branch unchanged; existing tests green
AC-4 Tests updated: phase-executor.test.ts:1557 flipped + positive assertion; run.test.ts reconciled ✅ Locking test flipped & renamed; run.test.ts 1192-1193/1282-1292 are parser-only — verified unchanged (per /spec correction)

Test plan

  • npx vitest run src/lib/workflow/phase-executor.test.ts — 127 passed
  • npx vitest run src/commands/run.test.ts — 143 passed (parser tests unchanged)
  • npm run build — clean
  • npm run lint — clean

Deferred (follow-ups, not this issue)

  • Optional explicit a-plus "keep looping" policy gate in the run path (needs ReadyPolicy plumbing run.ts → batch-executor → phase-executor, absent today).
  • NEEDS_VERIFICATION semantics diverge between phase-executor (success) and ready-gate (never-stop) — pre-existing, out of scope.

Closes #749

🤖 Generated with Claude Code

… loop

mapAgentSuccessToPhaseResult classified any qa verdict outside
{READY_FOR_MERGE, NEEDS_VERIFICATION} as a hard failure, so
AC_MET_BUT_NOT_A_PLUS (a stopping/ready state per ready-gate.ts's `ac`
policy) fell to success:false. Under -Q this fed the quality loop, never
reached zero failures, and exited with no PR despite ACs being met.

Narrow the failing branch to an explicit `verdict === "AC_NOT_MET"`
check (null/unparseable branch from #534 unchanged). AC_MET_BUT_NOT_A_PLUS
now returns success:true with the verdict retained, so the run breaks to
PR and the "not A+" note surfaces. Downstream routers (loop trigger,
shouldCreatePR, --qa-gate --chain break) all key off result.success, so
this also keeps the chain from breaking on such a predecessor (AC-2).

Flip the locking test (phase-executor.test.ts) to assert success +
verdict retention, add a chain-gate-predicate assertion for AC-2.
run.test.ts AC_MET parser tests are parser-only — verified, unchanged.

Entire-Checkpoint: 42a4b0a5d7f8
…k-to-PR

QA of PR #753 found two gaps in the AC_MET_BUT_NOT_A_PLUS break-to-PR fix:

1. The CHANGELOG/comment claimed the retained verdict surfaces the "not A+"
   note "in the PR body / run log", but createPR built a fixed-template body
   and was never passed the verdict — only the run log carried it. Extract the
   pure, testable buildAutomatedPRBody() helper; append a note for non-A+
   stopping states (AC_MET_BUT_NOT_A_PLUS, NEEDS_VERIFICATION) and thread the
   qa verdict from phaseResults through createPR. The PR body now surfaces the
   note, making the documented claim true.

2. The reported scenario (run-path break-to-PR vs quality loop) had no
   integration coverage — only the mapping function and chain predicate were
   tested. Add a runIssueWithLogging test: a success qa result carrying
   AC_MET_BUT_NOT_A_PLUS reaches createPR (verdict forwarded) and never spawns
   the loop phase.

buildAutomatedPRBody unit tests cover the note/no-note/stack-manifest matrix.
@admarble
admarble merged commit 32b9dd7 into main Jul 14, 2026
5 checks passed
admarble added a commit that referenced this pull request Sep 9, 2026
…k-to-PR

QA of PR #753 found two gaps in the AC_MET_BUT_NOT_A_PLUS break-to-PR fix:

1. The CHANGELOG/comment claimed the retained verdict surfaces the "not A+"
   note "in the PR body / run log", but createPR built a fixed-template body
   and was never passed the verdict — only the run log carried it. Extract the
   pure, testable buildAutomatedPRBody() helper; append a note for non-A+
   stopping states (AC_MET_BUT_NOT_A_PLUS, NEEDS_VERIFICATION) and thread the
   qa verdict from phaseResults through createPR. The PR body now surfaces the
   note, making the documented claim true.

2. The reported scenario (run-path break-to-PR vs quality loop) had no
   integration coverage — only the mapping function and chain predicate were
   tested. Add a runIssueWithLogging test: a success qa result carrying
   AC_MET_BUT_NOT_A_PLUS reaches createPR (verdict forwarded) and never spawns
   the loop phase.

buildAutomatedPRBody unit tests cover the note/no-note/stack-manifest matrix.
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.

fix(run): AC_MET_BUT_NOT_A_PLUS QA verdict misrouted into quality loop → fails with no PR (should break to PR)

1 participant