Repository navigation
fix(#534): treat null QA verdict and zero-diff exec as phase failure - #536
Merged
admarble merged 3 commits intoApr 19, 2026
Merged
Conversation
The orchestrator's post-success mapping in phase-executor.ts silently passed
two clear failure modes through as success:
1. QA phase with a null verdict (empty or unparseable agent output) — the
`verdict &&` short-circuit meant `parseQaVerdict() === null` fell through
to the success branch.
2. Exec phase regardless of whether any commits or uncommitted work were
produced. An agent session returning `subtype: "success"` on an empty
worktree was reported as a successful exec.
Combined, an empty worktree could progress spec → exec → qa and only fail at
PR creation with "No commits between main and feature/…".
This change adds:
- `hasExecChanges(cwd)` — internal helper that runs `git diff --quiet
origin/main..HEAD` and `git status --porcelain`, failing open on git
errors so a missing origin ref does not regress normal runs.
- `mapAgentSuccessToPhaseResult(...)` — extracts the success-to-PhaseResult
mapping into a pure, unit-testable function. It now returns failure for:
- qa phase with `parseQaVerdict(output) === null`, with error message
"QA completed without a parseable verdict";
- exec phase when `hasExecChanges(cwd)` is false, with error message
"exec produced no changes (no commits, no uncommitted work)".
Session id, stderr/stdout tails, and exit code are preserved in both
failure paths.
Tests cover the full matrix: QA verdict variants (including NEEDS_VERIFICATION
and AC_NOT_MET), null/empty output, exec with commits, exec with uncommitted
work, exec zero-diff, and no-op for non-qa/non-exec phases. Synthetic
reproducer confirms both guards fire against an empty worktree.
5 tasks
Follow-up to the pushed commit: the AC-specified check `git diff --quiet origin/main..HEAD` has a false-positive on stale branches. `git diff A..B` reports differences in either direction, so once `origin/main` advances past HEAD the two-dot diff exits 1 (the inverse diff is non-empty) and `hasExecChanges` would falsely report "has commits" — exactly the bug #534 is trying to fix. Switch to `git rev-list --count origin/main..HEAD`, which counts only commits reachable from HEAD but not from origin/main. Zero-progress runs on stale branches now correctly report `success: false`. Added regression tests: - hasExecChanges: stale-base scenario returns false - hasExecChanges: non-numeric rev-list output treated as zero - mapAgentSuccessToPhaseResult: exec phase fails on stale-base zero diff CHANGELOG updated to reflect the `rev-list` semantic.
7 tasks
…strator-treat-null-qa-verdict-and-zer # Conflicts: # CHANGELOG.md
admarble
deleted the
feature/534-fix-orchestrator-treat-null-qa-verdict-and-zer
branch
April 19, 2026 00:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
success: falsewith"QA completed without a parseable verdict"(sessionId and stderr/stdout tails preserved).success: falsewith"exec produced no changes (no commits, no uncommitted work)"after checkinggit diff --quiet origin/main..HEADANDgit status --porcelainin the worktree.mapAgentSuccessToPhaseResult(pure,@internal-exported) so the post-success logic is directly unit-testable without the fullexecutePhasemachinery.hasExecChanges(cwd)helper that fails open on git errors to avoid false phase failures whenorigin/mainisn't fetched.Test plan
npm run build— tsc cleannpm run lint— 0 warningsnpm test src/lib/workflow/phase-executor.test.ts— 88/88 pass (16 new)npx vitest run src/lib/workflow/— 713/713 pass across 27 filestsx -econfirmed both guards fire against an emptymktemprepo and a null-verdict QA resultCloses #534