Skip to content

bug(run): orchestrated 'sequant run --phases qa' re-run computes a fresh verdict but never posts it, contradicting the stale comment left visible #964

Closed

Description

@admarble

Summary

qa/SKILL.md's Orchestration Context documents, under SEQUANT_ORCHESTRATOR mode:

Behavior when orchestrated (SEQUANT_ORCHESTRATOR is set):
...

  • Skip posting GitHub comment (orchestrator handles aggregated summary)

But batch-executor.ts — the engine behind the bare sequant run CLI — has no code that posts an aggregated QA summary comment. Only sequant ready's ready-gate.ts posts a report, and only at a terminal gate state (postReport, added in #937 AC-4) — not after every mid-run QA pass.

Net effect: under sequant run --phases qa, when /qa re-runs and produces a different verdict than the last-posted comment, nothing updates GitHub. The stale, contradicted verdict is the only thing a human reviewer sees.

Repro (observed live in a downstream project, admarble/ad-motion issue #226)

  1. sequant run <issue> --phases qa --force while a gating CI check is pending → posts a QA comment, verdict NEEDS_VERIFICATION (correctly gated on pending CI).
  2. CI resolves to green (same commit, no new commits).
  3. sequant run <issue> --phases qa --force again → CLI reports success (✔ #226 qa 3m 23s), and the run's own JSON log (.sequant/logs/run-*.json) records a genuinely fresh verdict — different from step 1's (AC_MET_BUT_NOT_A_PLUS vs. the prior NEEDS_VERIFICATION) — but no new comment lands anywhere: gh issue view <N> --json comments still shows only the original comment set; gh pr view <PR> --json comments,reviews is empty.

The only externally-visible verdict is the stale, now-contradicted one from step 1.

(For contrast, sequant ready <issue> --policy a-plus run against the same issue afterward did post its own fresh report at its terminal state — confirming the gap is specific to the bare sequant run --phases qa re-run path, not sequant ready.)

Why this is worth fixing

A human trusting the GitHub comment as the source of truth for an orchestrated sequant run QA pass can be shown a verdict that no longer matches the code's actual current state, with no signal that a newer, different assessment exists. This is the same shape of problem #937 solved for the gap-finding channel (lossy, could silently drop findings) — here it's the verdict-visibility channel that can go silently stale.

Suggested fix

Either:

  • Have batch-executor.ts's orchestrated sequant run --phases qa path post an aggregated summary per phase completion, honoring the skill doc's existing promise, or
  • Have /qa itself always post when the computed verdict differs from the last-posted one, even under orchestration (narrower fix, doesn't require new orchestrator-level posting code).

Discovery context

Found while dogfooding #960's /loop fix against real downstream projects. Originally mis-filed as project-local at ad-motion#230 before confirming the doc/runtime mismatch is in sequant's own qa/SKILL.md + batch-executor.ts, not project-local behavior.

Activity

  1. added
    bug
    on Aug 24, 2026
  2. admarble commented on Aug 24, 2026

    @admarble
    ContributorAuthor

    Spec / Plan (Phase 1)

    Complexity: Standard (5 derived ACs — issue body has no formal AC checklist; derived from Summary/Repro/Suggested fix)

    Key findings

    Decision: fix Option A (runtime posting in batch-executor)

    Always post one compact issue comment per successful, verdict-bearing qa phase from the bare sequant run path, following the #937 postReport pattern (injectable postComment, best-effort, machine marker). Option B (/qa posts on verdict-diff) rejected: LLM-enforced, and diffing against the last-posted comment requires the GitHub fetch orchestrated mode deliberately skips.

    Acceptance Criteria

    • AC-1: After a completed qa phase in bare sequant run, batch-executor.ts posts an issue comment containing the parsed verdict, AC coverage (acMet/acTotal), and a machine marker <!-- SEQUANT_QA_VERDICT: {"verdict":"...","commit":"...","iteration":N} --> (Unit Test, injected postComment)
    • AC-2: The motivating repro is a regression test — two sequential qa runs producing different verdicts (NEEDS_VERIFICATION then AC_MET_BUT_NOT_A_PLUS) each post, so the fresh verdict is externally visible (Unit Test)
    • AC-3: A comment-post failure is non-fatal — the run still reports success and logs a warning (Unit Test)
    • AC-4: No comment is posted when the qa phase fails, is turn-capped, or yields no parseable verdict (Unit Test)
    • AC-5: qa/SKILL.md §9 orchestrated-mode wording names the real mechanism, synced across all three mirrored skill dirs (Manual doc review; any gate test must be mutation-verified per CLAUDE.md)

    Implementation Plan

    Phase 1 — runtime posting:

    1. Extract postQaVerdictComment(issueNumber, result, postComment) building the comment from result.verdict + result.summary + SEQUANT_QA_VERDICT marker (reuse the injectable postComment shape from ReadyGateForIssueArgs).
    2. Call it in the qa-phase completion path when result.success && result.verdict, try/catch → warn-only. Standard phase loop only — ready-gate loop internals untouched (terminal-only posting there is feat(qa/loop/ready): structured gap findings — finite taxonomy with required evidence, replacing the lossy prose-scrape gap channel #937's deliberate design).
    3. Thread the injectable through existing test seams.

    Phase 2 — doc truth-up + tests:
    4. Update qa/SKILL.md §9 in all three mirrors (read each independently first).
    5. Add the four unit tests to batch-executor.test.ts, with the verbatim issue repro as the AC-2 regression case.

    Non-Goals

    • sequant ready mid-loop QA passes (terminal-only report is by design)
    • /fullsolve (skill-level orchestration posts its own summaries)
    • exec/test sibling promises → recommended follow-up issue

    Open Questions

    1. Dedup identical verdicts across re-runs? Recommendation: no (v1) — one duplicate comment matches standalone /qa behavior; the marker's commit hash makes later dedup cheap.
    2. Fix sibling exec/test promises here? Recommendation: follow-up issue — same mismatch shape, lower-stakes channel, and widening scope triples the test surface.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: bug-labeled fix with unit-test ACs; bug-label-only skips testgen; no UI surface; SCOPE_OK.

  3. added
    planned
    on Aug 24, 2026
  4. admarble commented on Aug 24, 2026

    @admarble
    ContributorAuthor

    /fullsolve Complete

    Issue: #964
    Status: AC_MET_BUT_NOT_A_PLUS

    Summary

    • qa/SKILL.md §9 promised "the orchestrator handles aggregated summary" under SEQUANT_ORCHESTRATOR, but batch-executor.ts never posted anything after a standard qa phase — a re-run computing a fresh, different verdict left the stale prior comment as the only externally-visible signal.
    • runIssueWithLogging's phase loop now posts a compact comment (verdict, AC coverage, gaps/suggestions, SEQUANT_QA_VERDICT marker) right after a standard qa phase succeeds with a parseable verdict — best-effort/non-fatal, mirroring the feat(qa/loop/ready): structured gap findings — finite taxonomy with required evidence, replacing the lossy prose-scrape gap channel #937 ready-gate postReport contract. sequant ready's own terminal-only reporting is untouched.
    • qa/SKILL.md §9 updated (all three mirrors, verified byte-identical) to name the real mechanism.

    AC Coverage

    • AC-1 (posts verdict + AC coverage + marker): ✅ MET
    • AC-2 (regression: two different verdicts each post): ✅ MET
    • AC-3 (post failure non-fatal): ✅ MET
    • AC-4 (no post on failed/capped/no-verdict): ✅ MET
    • AC-5 (SKILL.md §9 synced across 3 mirrors): ✅ MET (5/5 met)

    Quality

    • Build: ✅ | Lint: ✅ 0 errors | Tests: ✅ full suite green (273 files, 5633 passed, 1 expected fail, 2 skipped)
    • Type safety: ✅ 0 new any | Deleted tests: ✅ 0 | Security: ✅ PASS, 0 critical/warning
    • Skill sync: ✅ 44/44 files synced across .claude/skills/, skills/, templates/skills/

    Risk Assessment

    • Likely failure mode: None identified for the shipped code path — the one gap (below) is a documentation-verification process gap, not a runtime behavior gap.
    • Not tested: buildQaVerdictComment/postQaVerdictComment aren't unit-tested standalone, only via runIssueWithLogging integration (matches this file's existing pattern for runReadyGateForIssue).

    Known Gap (why not READY_FOR_MERGE)

    AC-5 was scoped as "Manual doc review" (not an automated test) but is classified as a gate-test AC by isGateTestEvidence's "skill section is present" pattern — CLAUDE.md's mutation-verification gate therefore floors the verdict at AC_MET_BUT_NOT_A_PLUS for lack of a recorded SEQUANT_MUTATION marker. There is no automated test asserting the SKILL.md wording to mutation-verify against; the sync check (check-skill-sync.ts, 44/44 passing) verifies the three mirrors match each other, not the specific prose. Recommend either writing a small content-assertion test for future SKILL.md wording changes of this kind, or treating this as an accepted limitation of Manual-Test-verified doc ACs.

    Also noted (deliberately out of scope, see spec's Non-Goals): exec/SKILL.md:1958 and test/SKILL.md:585 carry the identical unbacked "orchestrator handles summary" promise for their own comment channels — same gap shape, lower stakes, recommended as a separate follow-up issue.

    Iterations

    • Spec: 1/1 | Exec: 1/1 | QA: 1/2 (no loop needed — AC_MET_BUT_NOT_A_PLUS breaks to PR)

    PR: #965


    PR created and left open for human review (no --auto-merge requested).

  5. added a commit that references this issue on Aug 25, 2026
  6. admarble commented on Aug 25, 2026

    @admarble
    ContributorAuthor

    Gap Closure (follow-up to the /fullsolve summary above)

    Both known gaps are now fixed on PR #965 (commit dc3f54a):

    1. AC-5 mutation verification — added src/lib/__tests__/qa-verdict-comment-skill.test.ts, a gate test scoped to §9's delimited region (per the feat(#819): shared trust-model block — issue/PR text is data, not agent instructions #830 rule) asserting all three mirrors name batch-executor.ts + the SEQUANT_QA_VERDICT marker and that the old "orchestrator handles aggregated summary" promise stays gone. Mutation-verified: reverted the §9 bullet to the old wording → exactly that test failed (1 failed / 5 passed, on toContain("batch-executor.ts")) → restored. SEQUANT_MUTATION marker recorded in the PR body; parses as valid via parseMutationMarkers.

    2. Sibling promises — exec/SKILL.md §6 and test/SKILL.md §3.2 (all three mirrors each) reworded to say what actually happens under sequant run — no per-phase comment; progress/results surface through the run summary and PR body — instead of promising orchestrator posting that doesn't exist. Doc truth-up rather than new runtime posting: unlike QA verdicts, those channels have no staleness hazard. No separate follow-up issue needed.

    Skill sync: 44/44 clean. Lint/build green; gate test 6/6.

    The mutation-verification cap that produced AC_MET_BUT_NOT_A_PLUS is now lifted — verdict rises to NEEDS_VERIFICATION pending the in-progress build (22.x) CI check, and to READY_FOR_MERGE once it reports green.

  7. added a commit that references this issue on Aug 25, 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