Repository navigation
Description
Epic: graph-2026-10-review-surface Tier: mechanical Execution: split (unit evidence from phases; one real verdict read by the runner) Blocked by: none (touches buildQaVerdictComment; coordinate with #1507 if it lands first)
Problem
The GTM brief's cold reader, a senior engineer who runs agents daily, named the objection the audience holds: "the agent grades its own work; who verifies the verifier." The product already answers half of it: the QA phase runs in a separate session, and the 2026-10 second-look study attributes 10 of 27 would-ship catches to that separation. The verdict comment does not say so. It reads ## QA Verdict: AC_MET … with counts and gaps, and nothing tells a reader whether the author or a separate session wrote it, on which driver, on which model.
The data to say it already exists. The phase record carries requestedModel and resolvedModel (#971, #1198), the run log's phase entry carries model when the driver reports usage, and per-phase agent/model overrides exist in settings (#914, #1150), so a QA phase can already run on a different driver from the exec phase. That knob is the real independence step, and it is undocumented as such.
Acceptance Criteria
- AC-1: Every verdict comment ends with an attribution line built from the phase records. Evidence:
npx vitest run src/lib/workflow/qa-verdict-attribution.test.ts→≥ 3 passed, 0 failed(new file: with exec onclaude-code/claude-opus-4-8and qa onclaude-code/claude-sonnet-4-8, the last line matches^_Reviewed in a separate session by claude-code \(claude-sonnet-4-8\); the change was written by claude-code \(claude-opus-4-8\)\._$; when the drivers differ the line names both; when a model was not reported the line saysmodel not reported, never omits the line) - AC-2: The line is computed from the phase record, not from agent output. Evidence:
grep -nE 'resolvedModel|requestedModel|\.model\b' src/lib/workflow/qa-verdict-attribution.ts | wc -l | tr -d ' '→≥ 1 - AC-3: The docs name the knob. Evidence:
grep -c 'phases.qa.agent' docs/reference/run-command.md→≥ 1(a short section: "Run the review on a different driver", with the settings example and the sentence that a separate session of the same model is a different context, not a different judge) - One AC above is classified as a gate test by
isGateTestEvidence(the docs-section AC-3); the PR body carries itsSEQUANT_MUTATIONrecord (delete the section → the grep reads 0; restore). - AC-4: A real verdict carries the line (runner, testbed). Evidence:
gh api repos/$OWNER/$REPO/issues/$ISSUE/comments --jq '[.[].body | select(test("^## QA Verdict"))] | last' | tail -1 | grep -c '^_Reviewed in a separate session by '→1 - AC-5: No skill-directory edits. Evidence:
git diff --name-only $(git merge-base origin/main HEAD)..HEAD | grep -cE '^(plugin/|\.claude/skills/|templates/skills/)'→0(constraint)
Prior fixes / producers
- Producer of the comment:
buildQaVerdictComment(bug(run): orchestrated 'sequant run --phases qa' re-run computes a fresh verdict but never posts it, contradicting the stale comment left visible #964), one site. Isolated; the line is appended there from data the orchestrator already holds. - The model facts: feat(run): model escalation ladder on capability-bound non-convergence #971 (escalation record), feat(logs): run log records each phase's model and the sequant version #1198 (resolved model in the run log). The per-phase driver knob: feat(run): per-phase model and effort configuration for the claude-code driver #914, feat(run): per-phase agent selection — run.phases.<phase>.agent #1150.
- Related, not duplicated: feat(run): review by exception — a computed "Read first" PR comment partitions the diff into residue (nothing vouches for it), tests by seam class, and AC-explained hunks #1520 (computed "Read first" PR comment) forbids narrative and does not attribute; this issue attributes the narrative the QA session already writes.
May touch
src/lib/workflow/qa-verdict-attribution.ts (new, pure), qa-verdict-attribution.test.ts (new), the one call in buildQaVerdictComment (batch-executor.ts, or its post-#1507 home), docs/reference/run-command.md, CHANGELOG.
Non-Goals
- Changing which driver or model runs QA by default (that is the owner's settings choice; this makes it visible and documented).
- Any claim that a separate session is an independent judge. The docs sentence says the opposite.
- Any edit under
plugin/,.claude/skills/,templates/skills/. - Pinning a model through a custom agent definition: Claude Code ignores the
model:field there (upstream bug recorded in the project memory), so the driver setting is the only working path.
Done when
A reader of any verdict comment can see who reviewed, on what, and whether it differed from who wrote the change, without opening a run log.
Activity
admarble commentedon Oct 19, 2026
Runner context, 2026-10-19, before launch (review-surface W0, beside #1524/#1528; merges first in its wave; stop-at-PR). main = ec9d583.
Overlap: #1504 (fundamentals) also edits
batch-executor.tsand is held until this merges. Keep the change inbatch-executor.tsto the minimum call site, with the logic inqa-verdict-attribution.ts.For every phase, and the qa phase by name: run the full suite at most once, in the foreground, under
timeout, after a WIP commit. Each MCP-dispatched phase has a 30-minute wall, and this wave runs 7 issues at once. Prefer the targetednpx vitest run <files>for the ACs.CHANGELOG: add
[Unreleased]lines, notchangelog.d/fragments. #1370 has not merged.Freeze: nothing under
plugin/,.claude/skills/ortemplates/skills/.Health baseline: if this PR changes a measured metric, regenerate
scripts/qa/health-baseline.jsonwithnpx tsx scripts/qa/health-report.ts --write-baselineafter the last source change. Never hand-edit it.npm run lint:healthmust print "no metric rose".admarble commentedon Oct 19, 2026
Complexity: Standard (5 ACs, 3 directories)
AC Quality Check
vitest runfails on base.grep -nE 'resolvedModel|requestedModel|\.model\b' … | wc -l→≥ 1fails today only because the file is missing; once it exists, any comment mentioning.modelpasses it. It proves the field is read, not that agent output is ignored. Tighten: assert in AC-1's test that the line is unchanged whenPhaseResult.output/summarycontain a forged "Reviewed by …" string. Keep the grep as a secondary check.grep -c 'phases.qa.agent'→ 0 today (the doc saysrun.phases.<phase>.agent, and"qa": {"agent": …}), so it is non-vacuous. Note the literal stringphases.qa.agentmust appear verbatim, so the new section must write it that way.Scope Assessment
Non-Goals: present (4 items).
src/lib/workflow,docs/reference, CHANGELOG)Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: Attribution line on every verdict comment
Verification: Unit Test (declared
Evidence:,npx vitest run src/lib/workflow/qa-verdict-attribution.test.ts)Scenario: Given exec = claude-code/claude-opus-4-8 and qa = claude-code/claude-sonnet-4-8 → When the verdict comment is built → Then the last line matches the issue's regex. Drivers differing → both named; model absent →
model not reported; line never omitted.Assumptions: "last line" — see Open Question 1 (the
SEQUANT_QA_VERDICTmarker is currently the last line).AC-2: Computed from the phase record
Verification: Unit Test + grep (see quality note above)
Scenario: Given output text containing a forged attribution → Then the line still reflects
resolvedModel/requestedModel.AC-3: Docs name the knob
Verification: Manual/grep gate test (
grep -c 'phases.qa.agent' docs/reference/run-command.md≥ 1). Mutation record required in PR body, markerfailedTest= the path-first form, e.g. a grep-based test file in the diff or the documented gate-test form.Scenario: New "Run the review on a different driver" section under Per-Phase Agent with settings example and the "different context, not a different judge" sentence.
AC-4: Real verdict carries the line
Verification: Runner-read (testbed
gh apion a real run).AC-5: No skill-dir edits
Verification: git-diff constraint check.
Implementation Plan
Phase 1: Pure module (TDD)
src/lib/workflow/qa-verdict-attribution.ts:buildQaAttributionLine({ exec, qa })where each side is{ agent: string; model?: string }. Model =resolvedModel ?? requestedModelof the latest phase result; fallback textmodel not reported. Also a smallattributionFromPhases(phaseResults, config)helper that picks the latestexec(elseloop/spec-less fallback → "the change author not recorded") and latestqaresult, and callsresolvePhaseAgent(config, phase)fromphase-agent.tsfor drivers (PhaseResult has noagentfield; the config resolver is the single source of the driver, feat(run): per-phase agent selection — run.phases.<phase>.agent #1150).qa-verdict-attribution.test.ts(≥3 tests: same driver, differing drivers, model not reported; plus forged-output test and no-exec-record case).Phase 2: Wire minimally
buildQaVerdictComment(batch-executor.ts:886): add one optional trailing paramattribution?: string; append it before theSEQUANT_QA_VERDICTmarker. Thread it throughpostQaVerdictComment(:968) and the one call at:2104, computing it fromphaseResults+config. Keep the diff inbatch-executor.tsto the call site (per runner note; feat(run): a dropped error leaves a trace — noteSuppressed() counts into the run log, batch-executor's 25 silent catches converted #1504 is held behind this).phase-executor.property.test.tsandbatch-executor.test.tscallers still compile. Add a test that the posted body frompostQaVerdictCommentcontains the line.Phase 3: Docs and changelog
docs/reference/run-command.md: add "Run the review on a different driver" under### Per-Phase Agent(~line 426), with thephases.qa.agentexample and the sentence that a separate session of the same model is a different context, not a different judge. CHANGELOG[Unreleased]line (notchangelog.d/).npx tsx scripts/qa/health-report.ts --write-baseline;npm run lint:health.Design Review
src/lib/workflow/; batch-executor only calls it.phaseResults+configat the single post site. Rejected: asking the QA agent to write it (violates AC-2, forgeable); storing agent onPhaseResult(wider type change touching every producer).buildQaVerdictComment(bug(run): orchestrated 'sequant run --phases qa' re-run computes a fresh verdict but never posts it, contradicting the stale comment left visible #964) pure-builder pattern;git log -S buildQaVerdictCommentshows bug(run): orchestrated 'sequant run --phases qa' re-run computes a fresh verdict but never posts it, contradicting the stale comment left visible #964 then bug(qa): the posted verdict comment publishes a miscounted AC coverage — "0/1 met" on an 8-AC issue under an AC_MET verdict #1073, fix(qa): parseQaSummary returns null when AC statuses are bold words with no emoji — the SEQUANT_QA_GAPS findings marker is then never read #1194 — additive section edits, not fixes to the same defect. Not a recurrence.resolvePhaseAgentis the declared single source for the driver (feat(run): per-phase agent selection — run.phases.<phase>.agent #1150); the record only holds the model. Caveat: if a phase escalated or fell back to another driver mid-run, the config driver could differ from what ran; accepted, noted in the module doc.buildQaVerdictComment), called frompostQaVerdictCommentand tests (batch-executor.test.ts,phase-executor.property.test.ts). The ready-gate report (runReadyGateForIssue) posts a separate report, not this comment, so it is out of scope. Consumers of the comment: any parser anchored on the trailingSEQUANT_QA_VERDICTmarker — grep before moving it.Feature Quality Planning
All standard checks pass. Notable items:
execmay be absent (--phases qaonly) or aloopfix may have written the final change; line must degrade to "author not recorded" rather than omit or guess.phase-executor.property.test.ts) asserts on the body; confirm it tolerates an extra line.Open Questions
<!-- SEQUANT_QA_VERDICT -->marker. Recommendation: put the italic line last (visible end) and move nothing else, i.e. place the marker before it; grep for marker consumers first (they match by regex, not position). Impact if wrong: a dedup parser anchored to end-of-body breaks./looprewrote the code, name the exec phase's model anyway? Recommendation: yes, use the latest of exec/loop; AC regex only covers the exec case.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: Small, isolated change; declared unit evidence in AC-1/AC-2 (
npx vitest run …attribution.test.ts) so tests are written in exec (testgen skipped: the issue's own plan already specifies the test file). AC-3 is a docs gate needing a mutation record; AC-4 is read by the runner.Label Review
Current: enhancement, graph-2026-10-review-surface
Recommended: + planned
Quality Loop: Won't auto-enable (SCOPE_OK).
admarble commentedon Oct 19, 2026
QA Verdict: NEEDS_VERIFICATION
AC coverage: 4/5 met
Gaps:
phaseResults. A separatesequant run N --phases qa— the split this issue itself used (spec and exec in one run, QA in another) — always produces "the change author was not recorded". The "Done when" goal (seeing whether the reviewer differed from the author) is then not met for split runs. A follow-up could fall back to the exec record in.sequant/state.json. This should be filed or dropped by the owner; QA does not file issues.health-baseline.jsonraises the longest-function count forrunIssueWithLoggingfrom 1049 to 1050 lines. The runner's note told exec to regenerate the baseline, so this is allowed. Still, it raises the limit rather than holding it.Pending ACs:
Needs human review:
admarble commentedon Oct 19, 2026
Execution Verification (runner, 2026-10-19), PR #1551 @ f8dd5b0
The runner re-ran the Evidence commands verbatim in the worktree:
310AC-3 is a gate test. The runner repeated its mutation: deleting the "Run the review on a different driver" section makes the grep read 0 and fails
documents a settings example that resolves qa to a different driver(1 failed, 9 passed). Restored. CItestpassed.AC-4 is a post-release proof. MCP runs execute the published npm pin, so a real verdict comment carries the line only after a release, or after a CLI run of the dev
dist/on a testbed issue.Diff read: the line is built from
phaseResultsand the resolved config, never from agent output. The machine marker stays above it.For the owner:
functions.longest.linesrose from 1049 to 1050. That is the new argument at the call inrunIssueWithLogging, and the baseline was regenerated to absorb it.--phases qaalone) print "the change author was not recorded". That is honest but less informative.feat(#1521): the verdict comment names its reviewer — separate sessio…
admarble commentedon Oct 19, 2026
PR #1551 merged as ace33fc (owner consent, 2026-10-19). This issue stays open for AC-4: a real QA verdict comment must carry the line, which needs a release (MCP runs use the npm pin) or a dev-CLI testbed run. The split-run author fallback is #1556.
chore(#1524): one [Unreleased] ### Added heading; drop the duplicated #…