Skip to content

fix(#853): classify a deferred QA turn as no-verdict, not unparseable - #858

Merged
admarble merged 7 commits into
mainfrom
feature/853-qa-phase-agent-that-defers-to-a-later-turn-is-misr
Jul 30, 2026
Merged

admarble merged 7 commits into
mainfrom
feature/853-qa-phase-agent-that-defers-to-a-later-turn-is-misr

Conversation

@admarble

@admarble admarble commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Splits mapAgentSuccessToPhaseResult's null-verdict branch so a QA agent that ended its turn without emitting a verdict (empty output, or a tail with deferral language) is reported distinctly from genuinely garbled/unparseable output. Both remain hard failures; only the message differs.
  • Hardens the qa skill (all 3 mirrors) and qa.promptTemplate to tell the agent its turn is one-shot — no deferring to a later turn or a background CI poll — and that an unreviewable tree is itself a verdict, never silence.

Why

A -Q dogfood run saw qa run 9m32s, post no comment, and fail with QA completed without a parseable verdict. The regex was never at fault: the agent did exec-style repair, started a background CI poll, and ended its turn planning to invoke /qa on a later turn — but a phase is one-shot, so it emitted no verdict. The misleading message sends debuggers to inspect the regex, and -Q burned an empty /loop iteration before the second QA attempt produced a real verdict.

AC Verification

AC Description Status Evidence
AC-1 No-verdict class reported distinctly from unparseable; message states no verdict was produced ✅ phase-executor.ts null-verdict branch split; endedWithoutVerdict helper
AC-2 Phase prompt states the turn is one-shot (no defer / background poll) ✅ qa/SKILL.md ×3 "One-Shot Turn" block + phase-registry.ts qa.promptTemplate (+ aider override)
AC-3 Unreviewable tree emits a real verdict (AC_NOT_MET / NEEDS_VERIFICATION), never silence ✅ qa/SKILL.md one-shot block verdict table (reuses existing verdicts, §CI mapping)
AC-4 Regression test on a deferral transcript asserting the distinct classification ✅ phase-executor.test.ts — verbatim #853 transcript fixture

Mutation verification (AC-4 gate test)

Per CLAUDE.md gate-test discipline. Neutralized the detector (endedWithoutVerdict → return false):

  • Exactly 2 tests failed, both deferral-detection assertions:
    • endedWithoutVerdict (#853) > returns true for the verbatim #853 deferral transcript
    • mapAgentSuccessToPhaseResult > qa phase > classifies a deferral transcript distinctly from unparseable output (#853)
  • The empty-output, garbled-unparseable, and tail-scope tests correctly stayed green (they don't depend on the marker scan), confirming the gate is scoped to the deferral detector.
  • Restored → 150/150 pass.

Test plan

  • npm run build — clean
  • npm run lint + npm run lint:skill-calls — clean
  • npx tsx scripts/check-skill-sync.ts — 44 synced, 0 diverged (3-dir mirror in sync)
  • Workflow suite — 1232 passed, 2 skipped

Notes

  • No new verdict value, no phase-lifetime change — a phase stays one-shot.
  • Deferral detection is a conservative literal tail-scan; it only refines the message inside an already-failing branch, so a false positive is harmless.

Second pass: corpus-driven hardening (QA follow-up on this PR)

Running the detector against every qa phase output in 99 real .sequant/logs runs surfaced gaps the single-fixture version missed; all fixed here:

  1. Deferral-to-user markers — a real turn ended "this needs a decision from you … Tell me which one and I'll execute it" (run-2026-06-06) with no verdict: same one-shot violation, wait pointed at a human. Marker set extended; verbatim corpus transcript added as a regression test. Structural alternatives (gating on a Verdict-labelled line) were tried against the same corpus and rejected — 19/45 outputs with a parseable verdict have no such line.
  2. One-Shot gate test (src/lib/__tests__/qa-oneshot-skill.test.ts) — lint:skill-sync only asserts the three mirrors match each other, so deleting the One-Shot block from all three stayed green (feat(#819): shared trust-model block — issue/PR text is data, not agent instructions #830 class). Gate pins the block in all 3 mirrors (region-scoped) + the promptTemplate/aider sentences.
  3. NO_VERDICT ready-gate reason — ready-gate.ts mapped any null QA verdict to NO_IMPLEMENTATION, the same misleading-label class this PR fixes, in a second consumer. Exit code 1 (re-run case), not 2.
  4. §6c precondition anchor — the unanchored /[^/]+/ alternative fired on 10 of 12 real skill-md commits from main (~70% pattern-free: file paths, /plugin commands, slash-command prose pairs). Anchored to /^…/ and (?…) forms; re-run fires 3/12, all genuinely command-bearing, all 7 flipped commits conclusively prose.

Recorded mutation results (per CLAUDE.md gate-test rule)

Mutation Expected Observed
Remove the 4 deferral-to-user markers corpus test fails, others green ✅ exactly 1 failed (deferral-to-user transcript), 150 passed
Neutralize marker scan (&& false, first pass) 2 deferral tests fail; empty/garbled/tail-scope stay green ✅ exactly 2 failed, 148 passed
Delete One-Shot block from all 3 mirrors check-skill-sync stays green (the hole); gate test fails ✅ sync: 44 synced, 0 diverged; gate: 6 assertions failed
Strip one-shot sentence from qa.promptTemplate promptTemplate gate test fails alone ✅ exactly 1 failed, 7 passed
Revert finish("NO_VERDICT") → finish("NO_IMPLEMENTATION") updated null-verdict test fails; zero-diff test green ✅ exactly 1 failed, 25 passed

All mutations restored; final tree verified green (build, eslint, lint:skill-calls, lint:skill-gates, check-skill-sync 44/44, 245 tests across 7 affected suites).

Closes #853

🤖 Generated with Claude Code

A phase is one-shot. A QA agent that ended its turn planning to continue
on a later turn (or a background CI poll) emitted no verdict, but was
reported as 'QA completed without a parseable verdict' — sending debuggers
to inspect a verdict regex that was never at fault and burning a full
quality-loop iteration.

- phase-executor.ts: split the null-verdict branch. Empty/whitespace
  output or a deferral-language tail (endedWithoutVerdict helper) now
  reports a distinct no-verdict message; genuinely garbled output keeps
  the 'unparseable' message. Both remain hard failures.
- qa/SKILL.md (x3 mirrors) + phase-registry.ts qa.promptTemplate: tell
  the agent its turn is one-shot — no deferring to a later turn or a
  background poll — and that an unreviewable tree is itself a verdict
  (AC_NOT_MET for code-caused red CI, NEEDS_VERIFICATION for pending/
  infra-blocked), never silence.
- Regression tests incl. the verbatim #853 deferral transcript.

Closes #853

Entire-Checkpoint: 96634811c611
admarble added 6 commits July 29, 2026 21:19
…agent-that-defers-to-a-later-turn-is-misr

# Conflicts:
#	CHANGELOG.md
Running endedWithoutVerdict against every qa phase output in 99 real
.sequant/logs runs surfaced a marker-set false negative: a turn that
ended 'this needs a decision from you … Tell me which one and I'll
execute it' (run-2026-06-06) is the same one-shot violation with the
wait pointed at a human instead of a background poll, and none of the
original markers (seeded only from the #853 transcript) matched it.

Adds the deferral-to-user marker group and a regression test using the
corpus transcript verbatim. Structural alternatives were tried against
the same corpus and rejected: 19/45 outputs with a parseable verdict
have no Verdict-labelled line at all, so label-presence cannot
discriminate — the literal marker list is the shape that works.

Claude-Session: https://claude.ai/code/session_01NxgiyMQXysFnXQzyHuEYTq
lint:skill-sync only asserts the three qa/SKILL.md mirrors match each
other, so deleting the One-Shot Turn block from all three would keep
every existing gate green — the #830 hole. This gate pins:

- the One-Shot section heading in all three mirrors
- its content, scoped to the delimited region (heading → next ##) so
  unrelated prose elsewhere in the file cannot satisfy the assertions
- the one-shot sentence in the qa promptTemplate and aider override

Mutation results recorded in the PR body per CLAUDE.md.

Claude-Session: https://claude.ai/code/session_01NxgiyMQXysFnXQzyHuEYTq
…ATION

The #534 guard folded two conditions into one label: a zero-diff
worktree (nothing was built) and a null QA verdict (QA said nothing).
A deferred or unparseable QA turn on a complete implementation
therefore reported 'no implementation detected' — the ready-gate twin
of the phase-executor misreport #853 fixes, surviving in a second
consumer of the same condition.

New NO_VERDICT terminal reason with its own headline and report text
naming the real condition and remedy (re-run once QA emits a verdict).
Exit code 1 (needs-human / re-run), not the nothing-there 2 — the
implementation may well exist. NO_IMPLEMENTATION remains for the
zero-diff case, unchanged.

Claude-Session: https://claude.ai/code/session_01NxgiyMQXysFnXQzyHuEYTq
The gate deciding whether Detection Pattern Verification loads greps a
diff's added lines for pattern literals, but its regex-literal
alternative was the unanchored /[^/]+/[gim]? — which matches ANY two
slashes: file paths, /plugin commands, prose slash-command pairs like
/exec / /loop. Sampled against the last 12 skill-md commits on main it
fired on 10, ~70% of them pattern-free, re-inflating the ~1,800-token
section #609 extracted the gate to avoid.

Anchored to real regex shapes (/^…/ and (?…) forms, matching §6c
Step 1's own detection block). Re-run on the same 12 commits: fires on
3, each genuinely containing command tokens; all 7 flipped commits are
conclusively prose. Also drops a stray double blank line the One-Shot
block left before ## Behavior. All three mirrors byte-identical.

Claude-Session: https://claude.ai/code/session_01NxgiyMQXysFnXQzyHuEYTq
Extends the #853 entry with the corpus-check hardening and adds entries
for the NO_VERDICT ready-gate reason and the §6c precondition anchor.

Claude-Session: https://claude.ai/code/session_01NxgiyMQXysFnXQzyHuEYTq
@admarble
admarble merged commit af1ce78 into main Jul 30, 2026
8 checks passed
admarble added a commit that referenced this pull request Jul 30, 2026
Only CHANGELOG.md conflicted, and only additively: #858 prepended three #853
entries to the same [Unreleased] → Fixed block this PR appends to. Resolved as
a union — verified programmatically that all 20 of main's Fixed entries survive
and this PR adds exactly one.

No source-file overlap: #858 touches phase-executor / ready-gate / ready /
qa SKILL.md, none of which this PR goes near. Main's stray blank line inside
the Fixed list (an artifact of #858's own entry, which splits the bullet list
in rendered Markdown) is preserved verbatim rather than silently cleaned up
here — it belongs to that PR, not this one.

Verified on the merged tree: tsc clean, lint clean, tautology detector exit 0,
full suite 227 files / 4668 passed.
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.

QA phase agent that defers to a later turn is misreported as 'unparseable verdict' — burns a quality-loop iteration

1 participant