Skip to content

bug(qa): a failing qa verdict (AC_NOT_MET) is never posted to the issue — posting is gated on phase success #1070

Closed

Description

@admarble

What happens

postQaVerdictComment is called only when the qa phase succeeded:

// src/lib/workflow/batch-executor.ts:1758
if (phase === "qa" && result.success && result.verdict) {

A qa phase that returns AC_NOT_MET is reported as a phase failure (status: "failure", exit 1), so result.success is false and no comment is posted. The verdict and its findings exist only in .sequant/logs/run-*.json.

The blocking reviews are exactly the ones that stay invisible. A passing review announces itself; a review that says "do not merge this" does not.

Observed

Three consecutive qa dispatches on #1059 (2026-09-15/16, sequant 2.15.1, sequant_run over MCP):

Round Verdict Phase status Comment posted
1 AC_NOT_MET failure ❌ none
2 AC_NOT_MET failure ❌ none
3 AC_MET_BUT_NOT_A_PLUS success ✅ full verdict + gaps

Round 3's comment is on #1059 at 01:58:42Z, so the posting path itself works. Rounds 1 and 2 left the issue with no record at all; their findings — including a real Windows defect where createSymlink's failure return was discarded — were recovered by hand from the run log:

jq -r '..|strings|select(length>300)' .sequant/logs/run-<id>.json

Why it matters

.sequant/logs is gitignored and rotates at 100 files, so a blocked review's evidence is perishable and invisible to anyone not on that machine. An issue thread showing "no QA comment" reads identically to "QA never ran", and the one case where a human most needs the findings — the review that blocks a merge — is the case that produces nothing.

Prior art

#964 / PR #965 fixed the adjacent half of this: a re-run computing a fresh verdict left the stale prior comment as the only visible signal. That fix added this call site and its result.success gate, whose comment explains the gate as excluding "turn-capped and unparseable-verdict phases (AC-4)". Excluding AC_NOT_MET looks like collateral damage of that intent rather than a decision — an unparseable verdict has nothing to post, whereas AC_NOT_MET has a complete findings payload.

Suggested fix

Gate on result.verdict alone, or on result.success || result.verdict === "AC_NOT_MET". A verdict that parsed is a verdict worth publishing, whatever the phase's exit status.

Correction

An earlier version of this issue said the phase posted nothing in all three runs. That was wrong: round 3 did post. The bug is narrower and sharper than first reported — failing verdicts are suppressed, passing ones are not.

Acceptance criteria

Release-graph plan — guard-2026-09 (2026-09-20)

Graph: guard-2026-09 Tier: mechanical Wave: 1
May touch: src/lib/workflow/batch-executor.ts (the postQaVerdictComment call-site gate at ~1758 only — #1095 edits buildQaVerdictComment in the same wave), src/lib/workflow/batch-executor.test.ts, CHANGELOG.md

The npm run build && npm test AC is verified by the runner from a clean shell after the PR opens (PLAN I-1); the agent runs only the test files its ACs name. Mutation markers use failedTest starting with the test file path (I-4).

Activity

  1. added
    bug
    on Sep 16, 2026
  2. changed the title [-]bug(qa): the qa phase posts no review comment to the issue — 3/3 runs silent, findings only in .sequant/logs[/-] [+]bug(qa): a failing qa verdict (AC_NOT_MET) is never posted to the issue — posting is gated on phase success[/+] on Sep 16, 2026
  3. admarble commented on Sep 20, 2026

    @admarble
    ContributorAuthor

    Runner context — guard-2026-09 launch, 2026-09-20. Base: origin/main at da9ed6e8 (2.16.0 plus the plan docs). These rules override the exec skill's defaults for this run:

    • No full npm test in the worktree. Run only the test files this issue's ACs name. The runner runs the full suite once per PR from a clean shell. Under sequant run the suite is not hermetic against SEQUANT_* (bug(test): suite isn't hermetic against the SEQUANT_* env phases inject — exec sees red tests it didn't cause and opens no PR #1086), so a full run shows red files you did not cause.
    • A named test file red before your change: re-run it as env -u SEQUANT_ORCHESTRATOR -u SEQUANT_WORKTREE -u SEQUANT_PHASE -u SEQUANT_ISSUE -u SEQUANT_RELAY -u SEQUANT_RELAY_FRAME npx vitest run <file>. If it is still red, the PR body names the issue number and the base-vs-head result for that test.
    • Mutation marker (gate-test ACs): <!-- SEQUANT_MUTATION: {"ac":"AC-N","mutation":"<what you deleted>","failedTest":"<test file path> > <describe> > <case>"} --> in the PR body. failedTest MUST start with the test file path, or the qa classifier reports it Failed. Commit before mutating.
    • 30-minute no-progress wall per phase. Commit a WIP checkpoint before any long command; every command foreground, with timeout.
    • Commits: single-line git commit -m "...", no Co-Authored-By. Never rebase or force-push after pushing. One AC per line in the PR body, ids AC-N only.
    • Stop at the PR. Do not merge.

    Issue-specific: src/lib/workflow/batch-executor.test.ts is one of the files that goes red under the orchestrator env leak (#1086): establish its base state with the env -u re-run above before attributing any failure to your change. Edit only the postQaVerdictComment call-site gate in batch-executor.ts; #1095 edits buildQaVerdictComment in the same file concurrently.

  4. admarble commented on Sep 20, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (3 ACs, 2 directories)

    AC Quality Check

    No vague/unmeasurable/open-ended AC. AC-1 and AC-2 each name a runnable command and a case name. One constraint: -t "1070" filters on the full test name (describe + case), so the new describe must contain 1070 and the cases must be named exactly posts AC_NOT_MET… / no verdict posts nothing… for the Verify commands to select them.


    Scope Assessment

    Non-Goals: none stated in the body. The runner's "May touch" list is the boundary: only the postQaVerdictComment call-site gate in batch-executor.ts (not buildQaVerdictComment, which #1095 edits concurrently), batch-executor.test.ts, CHANGELOG.md.

    Metric Value Status
    Feature count 1 ✅
    AC items 3 ✅
    Directory spread 2 (src/lib/workflow/, root CHANGELOG.md) ✅

    Verdict: ✅ SCOPE_OK


    Acceptance Criteria

    AC-1: AC_NOT_MET verdict is posted despite status: failure

    Verification: Unit Test (npx vitest run src/lib/workflow/batch-executor.test.ts -t "1070", case posts AC_NOT_MET) — gate test, mutation-verified
    Scenario: Given qa returns {success:false, verdict:"AC_NOT_MET", summary:{gaps:[…]}} → When runIssueWithLogging runs the qa phase → Then postComment is called once, body contains AC_NOT_MET, the gap text, and the SEQUANT_QA_VERDICT marker.
    Assumptions: verified in code — phase-executor.ts:1042-1057 is the only place a success:false result carries verdict (AC_NOT_MET). The call site (batch-executor.ts:1758) sits after the if (result.success) … else … progress block, and no break/continue precedes it, so failed phases do reach it.

    AC-2: turn-capped / unparseable-verdict phases still post nothing

    Verification: Unit Test (same command, case no verdict posts nothing)
    Scenario: Given qa returns {success:false, error:"QA completed without a parseable verdict"} and, separately, {success:false, capped:true} (neither has verdict) → Then postComment is not called.
    Assumptions: neither path sets verdict (phase-executor.ts:1060-1078; capped returns before the qa branch). The existing #964 AC-4 test already covers this shape; the new case re-asserts it under the widened gate so the widening can't silently regress it.

    AC-3: npm run build && npm test green

    Verification: Integration (runner, clean shell, after PR opens — per PLAN I-1; the exec agent runs only batch-executor.test.ts)


    Implementation Plan

    Phase 1: Widen the gate (1 line)

    1. src/lib/workflow/batch-executor.ts:1758 — if (phase === "qa" && result.success && result.verdict) → if (phase === "qa" && result.verdict).
    2. Rewrite the comment above it (1750-1757): it currently says the success gate "excludes turn-capped and unparseable-verdict phases"; the true invariant is result.verdict is only set once a verdict parsed, so the verdict check alone excludes them. Keep the comment stating intent (why success is deliberately absent: AC_NOT_MET is success:false but has a full payload).

    Phase 2: Tests (batch-executor.test.ts)

    1. New describe("#1070: failing qa verdict is posted", …) next to the bug(run): orchestrated 'sequant run --phases qa' re-run computes a fresh verdict but never posts it, contradicting the stale comment left visible #964 block (~line 1836), reusing makeCtx + mockPostComment. Cases: posts AC_NOT_MET… (AC-1) and no verdict posts nothing… (AC-2, both sub-shapes).
    2. Fix the fix(cli): renderer pause/resume is dead code — batch-executor never passes spinner argument #656 test at ~line 577 ("forwards the handle to the loop phase when quality loop triggers"): it returns {success:false, verdict:"AC_NOT_MET"} for the first qa and does not inject postComment, so after the widening it would call the real new GitHubProvider().postComment("658", …) — i.e. gh issue comment 658 against the live repo. Add postComment: mockPostComment to its makeCtx (see Feature Quality).

    Phase 3: Mutation verification + changelog

    1. Commit first. Mutation A (AC-1): restore result.success && → posts AC_NOT_MET must fail (and only it, among the bug(qa): a failing qa verdict (AC_NOT_MET) is never posted to the issue — posting is gated on phase success #1070 cases); restore. Mutation B (AC-2, optional but cheap): change gate to phase === "qa" → no verdict posts nothing must fail; restore. Record with <!-- SEQUANT_MUTATION: {"ac":"AC-1","mutation":"restored result.success gate at batch-executor.ts:1758","failedTest":"src/lib/workflow/batch-executor.test.ts > #1070: … > posts AC_NOT_MET…"} --> — failedTest must start with the file path.
    2. CHANGELOG.md under [Unreleased] → ### Fixed.

    Design Review

    1. Where does this logic belong? At the existing call site in batch-executor.ts; postQaVerdictComment itself stays untouched (and buildQaVerdictComment is off-limits this wave).
    2. What's the simplest correct approach? Drop result.success. Rejected: result.success || result.verdict === "AC_NOT_MET" — it encodes today's coincidence that only AC_NOT_MET fails-with-verdict, and would silently suppress any future failing verdict. Recommended per the issue's own "a verdict that parsed is a verdict worth publishing".
    3. What existing pattern does this follow? The bug(run): orchestrated 'sequant run --phases qa' re-run computes a fresh verdict but never posts it, contradicting the stale comment left visible #964 call site and its injected-postComment test seam (ctx.postComment).
    4. What would a senior reviewer challenge? "Won't the quality loop now post one comment per AC_NOT_MET round?" Yes, by design — each round has a distinct iteration/commit in the SEQUANT_QA_VERDICT marker, and round-by-round visibility is the observed need (feat(#497): sequant init --agent codex — .agents/skills symlink, .codex hooks wrapper, doctor, README #1059 rounds 1-2). No dedupe added; not in scope.

    Feature Quality Planning

    Notable items:

    • ⚠️ Live-gh leak in existing tests (the main risk). The gate widening changes behavior for every test that drives runIssueWithLogging with a success:false + verdict:"AC_NOT_MET" qa result and no injected postComment. Confirmed: batch-executor.test.ts:586-600 (fix(cli): renderer pause/resume is dead code — batch-executor never passes spinner argument #656). Also driving the same shape without injecting postComment: model-ladder.test.ts (lines ~305, 343, 378, 496, 896, 1001 → runIssueWithLogging at 1016) and possibly batch-executor.model-ladder.test.ts. None mock platforms/github.js. Exec must grep these before pushing; where a worktree path is set the real resolveDiffBase mock may also be missing an export. Those two files are outside the runner's "May touch" list — see Open Questions.
    • Env leak (bug(test): suite isn't hermetic against the SEQUANT_* env phases inject — exec sees red tests it didn't cause and opens no PR #1086): batch-executor.test.ts goes red under SEQUANT_*; establish base state with the env -u … re-run from the runner comment before attributing failures.
    • Sibling scan: postQaVerdictComment has one call site; the ready-gate path (runReadyGateForIssue) posts its own report and is a different mechanism — no siblings.
    • Security/perf/docs: no concerns. No user docs change; CHANGELOG entry only.

    Open Questions

    1. model-ladder.test.ts (and possibly batch-executor.model-ladder.test.ts) need postComment injection, but are outside "May touch". — Recommendation: extend the boundary by those test files only (test-only, mechanical), or have exec first run them at base vs head to see if they actually reach the call site (worktree/mocks may keep them from it). Impact if ignored: those suites make real gh issue comment calls or throw on missing mock exports.
    2. Gate form: result.verdict alone (recommended) vs success || AC_NOT_MET. Impact if wrong: none today (behaviorally identical); differs only for a future failing verdict.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: one-line production change plus tests, declared bug label; testgen skipped (bug-fix, test cases fully specified by the ACs). No UI, no security surface. QA must confirm the mutation marker (gate-test AC) and check the test-leak sweep from Open Question 1.

    Label Review

    Current: bug
    Recommended: bug, planned
    Reason: correctly labeled; planned marks spec completion.
    Quality Loop: won't auto-enable (SCOPE_OK, simple change).

  5. added
    planned
    on Sep 20, 2026
  6. added 7 commits that reference this issue on Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions