You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(mcp): sequant_run result carries each issue's QA summary and findings #1200
Problem. The per-issue result (src/mcp/tools/run.ts:38-44, built at :234-250) has status, phase names/statuses/durations and verdict, but never gaps or findings, whatever the verdict. #391 set that shape; #434 added summary to sequant_logs only. An MCP caller that gets NEEDS_VERIFICATION or AC_NOT_MET needs a second tool call to learn why, and gets nothing at all when D2 fires.
AC-1: Each issue in sequant_run's result includes the qa phase's summary (acMet, acTotal, gaps, findings) when one exists, for every verdict. Evidence: npx vitest run src/mcp/tools/run.test.ts
AC-2: Findings are capped (count and length) so the result stays under the MCP response size limit, with a truncated flag. Evidence: npx vitest run src/mcp/tools/run.test.ts
Context before wave 3 (main @ 1b0fa9a). The blocker #1194 has merged (PR #1214). parseQaSummary now handles bold and emoji-less status cells, and keeps the SEQUANT_QA_GAPS marker even when the AC table is unparseable. The run log's qa PhaseLog.summary is the source this issue reads. Line refs: RunToolIssueSummary is at src/mcp/tools/run.ts:38-45, and the per-issue map is at :234.
Run rules for the phase agents (spec, exec and qa):
exec and qa: do not run the full npm test. Run the targeted npx vitest run <files> named in the ACs, in the foreground with a timeout. Every MCP-dispatched phase has a hard 30-minute wall, and in wave 2 an exec ran up to 27 minutes. This applies to the qa phase too, not only exec.
Commit WIP early, and commit again before any mutation test. Work that is committed survives a phase timeout.
For a mutation record, failedTest must start with the test file path (src/…test.ts > <describe> > <case>). If it starts with a describe name, §6i floors the verdict to AC_NOT_MET.
In the PR body, put Closes #<this issue> for this issue and Refs #1203 for the tracker. Never Closes #1203.
A skill snippet that reads .sequant/settings.json must handle JSONC (comments and trailing commas), not bare JSON.parse/jq.
Both ACs declare Evidence: npx vitest run src/mcp/tools/run.test.ts — measurable, non-vacuous (verified: that file's 85 tests pass on main today; AC-1/AC-2 only go green once new assertions land in the same file).
⚠️Format gap: AC lines use - AC-1: … (no checkbox). extractAcceptanceCriteria requires - [ ] AC-1: … and parses 0 ACs from this body as-written — confirmed by running the parser. Human-readable, but /testgen stub generation and /qa's AC-table/mutation-gate parsing won't see these ACs unless fixed first. See Open Question 2.
Scope Assessment
Non-Goals:⚠️ Not found in issue body.
Metric
Value
Status
Feature count
1
✅
AC items
2
✅
Directory spread
1 (src/mcp/tools/)
✅
Verdict: ✅ SCOPE_OK (manual — performScopeAssessment auto-skips as "trivial" here because the checkbox gap above makes it see 0 ACs)
Acceptance Criteria
AC-1: Each issue's result includes the qa summary for every verdict
Verification: Unit Test Scenario: Given a RunLog whose qa PhaseLog.summary has acMet/acTotal/gaps/findings → When buildStructuredResponse runs, for each of READY_FOR_MERGE / AC_MET_BUT_NOT_A_PLUS / AC_NOT_MET / NEEDS_VERIFICATION → Then the per-issue response includes those four fields only (not suggestions/pendingAcIds — AC names exactly four). Assumptions:PhaseLog.summary is already populated for qa today (run-log-schema.ts:211-233); this is a read-through previously dropped in buildStructuredResponse.
AC-2: Findings capped (count + length), with a truncated flag
Verification: Unit Test Scenario: Given >N findings or long description/evidence strings → When response is built → Then findings is sliced, oversized fields truncated, truncated: true set; given a normal-sized summary → no truncation. Assumptions: Existing 64KB enforceResponseSizeLimit (run.ts:279-310) stays as outer backstop; this adds a narrower per-issue cap.
Implementation Plan
Phase 1: Extend the response shape
Add an optional field to RunToolIssueSummary (run.ts:38-44) with acMet/acTotal/gaps/findings (reuse GapFinding/QaSummary types from run-log-schema.js — no schema change) plus optional truncated.
In buildStructuredResponse (run.ts:234-250), read qaPhase?.summary alongside the existing verdict lookup, unconditional on verdict.
Phase 2: Cap findings (AC-2)
Add a helper beside enforceResponseSizeLimit capping findings by count and per-field length, following run-reflect.ts's existing truncate-with-flag pattern (MAX_OUTPUT_LINES/truncated). Suggest: 10 findings, 300 chars/field; set truncated: true if either fires.
Leave enforceResponseSizeLimit's rawOutput/error trimming as the aggregate backstop (Open Question 1).
Phase 3: Tests
Extend run.test.ts fixtures: one qa summary per verdict, asserting the four fields surface.
Add an oversized-findings fixture (count/length capping + truncated: true) and a normal-sized case (no truncation).
Design Review
Where does this belong?src/mcp/tools/run.ts, next to enforceResponseSizeLimit.
Simplest correct approach? Read-through of the existing QaSummary/GapFinding types already on PhaseLog.summary — no new schema. Rejected: exposing full QaSummary (adds suggestions/pendingAcIds the AC doesn't ask for).
Existing pattern?run-reflect.ts's truncate+flag pattern for the cap; enforceResponseSizeLimit's post-hoc trim for the outer guard — this adds a second, narrower layer.
No ADR needed — additive field from an existing schema, not a design choice.
Feature Quality Planning
All standard checks pass. Notable: additive/optional field, no backcompat break; aggregate multi-issue size risk noted but out of this issue's scope.
Open Questions
Are cap constants (10 findings / 300 chars) right for a hard 64KB MCP ceiling? Recommendation: start conservative. Impact if wrong: too loose risks the aggregate response exceeding 64KB on many-issue runs; too tight loses debugging signal on exactly the verdicts this issue targets.
AC-1/AC-2 aren't checkbox-formatted, so extractAcceptanceCriteria parses 0 ACs. Recommendation: edit to - [ ] AC-1: … / - [ ] AC-2: … before /exec//qa. Impact if left as-is: /qa §6i's AC-table parser and mutation-record classification have nothing to anchor to.
Recommended Workflow
Phases: exec → qa Quality Loop: disabled Reasoning: Mechanical, single-file, two-AC additive change to an already-well-tested function (85 existing tests, established describe("buildStructuredResponse") pattern from #391/#434 the exec agent extends directly). Testgen's declared-evidence rule would normally trigger (both ACs' evidence is a vitest command → Unit Test), but overriding: a separate testgen phase would only restate stubs the exec agent writes directly from the existing pattern. No complexity/scope-warning signal for the quality loop.
Label Review
Current: enhancement, graph-2026-09-field Recommended: no change Reason: Small, single-file, non-complex; manual scope read is SCOPE_OK. Quality Loop: Won't auto-enable.
--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
Plan: #1200 — sequant_run result carries each issue's QA summary and findings
AC-1 (Unit Test): Add acMet/acTotal/gaps/findings to each issue's response in buildStructuredResponse (run.ts:234-250), sourced from the existing qa PhaseLog.summary (no schema change), for every verdict.
AC-2 (Unit Test): Cap findings by count and per-field length with a truncated flag, following run-reflect.ts's truncate-with-flag pattern; keep the current 64KB enforceResponseSizeLimit as the outer backstop.
Plan:
Extend RunToolIssueSummary (run.ts:38-44) with the four fields + optional truncated.
Wire the read-through in buildStructuredResponse, unconditional on verdict.
Add a capping helper (count + length caps) beside enforceResponseSizeLimit.
Extend run.test.ts: one summary per verdict, plus oversized and normal-sized cases.
Open questions:
Cap constants (proposing 10 findings / 300 chars/field) — flag if you want different limits.
⚠️ AC-1/AC-2 aren't checkbox-formatted, so the AC parser reads 0 ACs from this body. Recommend editing to - [ ] AC-1: … / - [ ] AC-2: … before /exec//qa so AC-table parsing and the mutation-gate can anchor to them.
AC-2 cap is bypassed: gaps duplicates every finding description uncapped, so the result can exceed the 64KB MCP limit and truncated:true misreports
No test asserts the response stays under the MCP size limit with realistic gaps derived from findings
CI test check still pending at review time
gaps gets around the cap. It is built from the full descriptions of all findings, so the 300-character and 10-entry limits apply to findings but not to the text that repeats it. truncated: true then tells the caller something was cut when all of it is still in gaps.
Suggestions:
Cap gaps with the same count and length limits, and let that set truncated too.
Add one test that asserts Buffer.byteLength(JSON.stringify(response)) <= 64*1024 for an issue with many long findings. That checks what AC-2 promises, not just how the cap works.
Runner fix for QA's AC_NOT_MET (PR #1218, now at e3136c7)
QA's gap was real. gaps is built from each finding's full description, so capping only findings let the full text through in gaps, and truncated: true misreported. The fix, in src/mcp/tools/run.ts:
capGaps gives gaps the same caps as findings: 10 entries, 300 characters each. Either cap sets truncated.
enforceResponseSizeLimit now handles a response that is still over 64KB after the rawOutput/error trims. It drops findings, then gaps, from the last issue backward until the response fits, and sets truncated. acMet/acTotal/verdict always stay. Without this, per-issue caps bound one issue but not a many-issue run.
Verification (runner):
npx tsc --noEmit: clean. npx vitest run src/mcp/tools/run.test.ts: 95 passed, with 2 new tests.
New test: a 12-issue run with 15 long findings and 15 long gaps per issue, plus 5 KB of raw output, asserts Buffer.byteLength(JSON.stringify(response)) <= 64*1024, as QA suggested.
Mutations: making capGaps a passthrough failed only the gaps-cap test, and emptying the drop loop failed only the 64KB test. Each was restored. The records are in the PR body.
CI on e3136c7 is green. closingIssuesReferences is [1200].
Activity
admarble commentedon Sep 29, 2026
Context before wave 3 (main @ 1b0fa9a). The blocker #1194 has merged (PR #1214).
parseQaSummarynow handles bold and emoji-less status cells, and keeps theSEQUANT_QA_GAPSmarker even when the AC table is unparseable. The run log's qaPhaseLog.summaryis the source this issue reads. Line refs:RunToolIssueSummaryis atsrc/mcp/tools/run.ts:38-45, and the per-issue map is at:234.Run rules for the phase agents (spec, exec and qa):
npm test. Run the targetednpx vitest run <files>named in the ACs, in the foreground with atimeout. Every MCP-dispatched phase has a hard 30-minute wall, and in wave 2 an exec ran up to 27 minutes. This applies to the qa phase too, not only exec.failedTestmust start with the test file path (src/…test.ts > <describe> > <case>). If it starts with a describe name, §6i floors the verdict to AC_NOT_MET.Closes #<this issue>for this issue andRefs #1203for the tracker. NeverCloses #1203..sequant/settings.jsonmust handle JSONC (comments and trailing commas), not bareJSON.parse/jq.admarble commentedon Sep 29, 2026
Complexity: Standard (2 ACs, 1 directory)
AC Quality Check
Both ACs declare
Evidence: npx vitest run src/mcp/tools/run.test.ts— measurable, non-vacuous (verified: that file's 85 tests pass onmaintoday; AC-1/AC-2 only go green once new assertions land in the same file).- AC-1: …(no checkbox).extractAcceptanceCriteriarequires- [ ] AC-1: …and parses 0 ACs from this body as-written — confirmed by running the parser. Human-readable, but/testgenstub generation and/qa's AC-table/mutation-gate parsing won't see these ACs unless fixed first. See Open Question 2.Scope Assessment
Non-Goals:⚠️ Not found in issue body.
src/mcp/tools/)Verdict: ✅ SCOPE_OK (manual —
performScopeAssessmentauto-skips as "trivial" here because the checkbox gap above makes it see 0 ACs)Acceptance Criteria
AC-1: Each issue's result includes the qa summary for every verdict
Verification: Unit Test
Scenario: Given a
RunLogwhose qaPhaseLog.summaryhasacMet/acTotal/gaps/findings→ WhenbuildStructuredResponseruns, for each of READY_FOR_MERGE / AC_MET_BUT_NOT_A_PLUS / AC_NOT_MET / NEEDS_VERIFICATION → Then the per-issue response includes those four fields only (notsuggestions/pendingAcIds— AC names exactly four).Assumptions:
PhaseLog.summaryis already populated for qa today (run-log-schema.ts:211-233); this is a read-through previously dropped inbuildStructuredResponse.AC-2: Findings capped (count + length), with a
truncatedflagVerification: Unit Test
Scenario: Given >N findings or long
description/evidencestrings → When response is built → Thenfindingsis sliced, oversized fields truncated,truncated: trueset; given a normal-sized summary → no truncation.Assumptions: Existing 64KB
enforceResponseSizeLimit(run.ts:279-310) stays as outer backstop; this adds a narrower per-issue cap.Implementation Plan
Phase 1: Extend the response shape
RunToolIssueSummary(run.ts:38-44) withacMet/acTotal/gaps/findings(reuseGapFinding/QaSummarytypes fromrun-log-schema.js— no schema change) plus optionaltruncated.buildStructuredResponse(run.ts:234-250), readqaPhase?.summaryalongside the existing verdict lookup, unconditional on verdict.Phase 2: Cap findings (AC-2)
enforceResponseSizeLimitcappingfindingsby count and per-field length, followingrun-reflect.ts's existing truncate-with-flag pattern (MAX_OUTPUT_LINES/truncated). Suggest: 10 findings, 300 chars/field; settruncated: trueif either fires.enforceResponseSizeLimit'srawOutput/errortrimming as the aggregate backstop (Open Question 1).Phase 3: Tests
run.test.tsfixtures: one qa summary per verdict, asserting the four fields surface.truncated: true) and a normal-sized case (no truncation).Design Review
src/mcp/tools/run.ts, next toenforceResponseSizeLimit.QaSummary/GapFindingtypes already onPhaseLog.summary— no new schema. Rejected: exposing fullQaSummary(addssuggestions/pendingAcIdsthe AC doesn't ask for).run-reflect.ts's truncate+flag pattern for the cap;enforceResponseSizeLimit's post-hoc trim for the outer guard — this adds a second, narrower layer.findingsnotgaps?" —gapsis already a short deduped union (feat(qa/loop/ready): structured gap findings — finite taxonomy with required evidence, replacing the lossy prose-scrape gap channel #937);findingsis the unbounded structured array. "Many issues, each capped but present?" — could still approach 64KB in aggregate; not solved here (Open Question 1) since this issue targets the single-issue NEEDS_VERIFICATION/AC_NOT_MET case.No ADR needed — additive field from an existing schema, not a design choice.
Feature Quality Planning
All standard checks pass. Notable: additive/optional field, no backcompat break; aggregate multi-issue size risk noted but out of this issue's scope.
Open Questions
extractAcceptanceCriteriaparses 0 ACs. Recommendation: edit to- [ ] AC-1: …/- [ ] AC-2: …before/exec//qa. Impact if left as-is:/qa§6i's AC-table parser and mutation-record classification have nothing to anchor to.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: Mechanical, single-file, two-AC additive change to an already-well-tested function (85 existing tests, established
describe("buildStructuredResponse")pattern from #391/#434 the exec agent extends directly). Testgen's declared-evidence rule would normally trigger (both ACs' evidence is a vitest command → Unit Test), but overriding: a separate testgen phase would only restate stubs the exec agent writes directly from the existing pattern. No complexity/scope-warning signal for the quality loop.Label Review
Current: enhancement, graph-2026-09-field
Recommended: no change
Reason: Small, single-file, non-complex; manual scope read is SCOPE_OK.
Quality Loop: Won't auto-enable.
--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
Plan: #1200 — sequant_run result carries each issue's QA summary and findings
AC-1 (Unit Test): Add
acMet/acTotal/gaps/findingsto each issue's response inbuildStructuredResponse(run.ts:234-250), sourced from the existing qaPhaseLog.summary(no schema change), for every verdict.AC-2 (Unit Test): Cap
findingsby count and per-field length with atruncatedflag, followingrun-reflect.ts's truncate-with-flag pattern; keep the current 64KBenforceResponseSizeLimitas the outer backstop.Plan:
RunToolIssueSummary(run.ts:38-44) with the four fields + optionaltruncated.buildStructuredResponse, unconditional on verdict.enforceResponseSizeLimit.run.test.ts: one summary per verdict, plus oversized and normal-sized cases.Open questions:
- [ ] AC-1: …/- [ ] AC-2: …before/exec//qaso AC-table parsing and the mutation-gate can anchor to them.Workflow: exec → qa, quality loop disabled (mechanical, well-precedented single-file change).
admarble commentedon Sep 29, 2026
QA Verdict: AC_NOT_MET
AC coverage: 1/2 met
Gaps:
gapsgets around the cap. It is built from the full descriptions of all findings, so the 300-character and 10-entry limits apply tofindingsbut not to the text that repeats it.truncated: truethen tells the caller something was cut when all of it is still ingaps.Suggestions:
gapswith the same count and length limits, and let that settruncatedtoo.Buffer.byteLength(JSON.stringify(response)) <= 64*1024for an issue with many long findings. That checks what AC-2 promises, not just how the cap works.fix(#1200): cap gaps like findings; drop findings/gaps to keep a many…
docs(#1200): CHANGELOG notes gaps caps and the many-issue drop
admarble commentedon Sep 29, 2026
Runner fix for QA's AC_NOT_MET (PR #1218, now at e3136c7)
QA's gap was real.
gapsis built from each finding's full description, so capping onlyfindingslet the full text through ingaps, andtruncated: truemisreported. The fix, insrc/mcp/tools/run.ts:capGapsgivesgapsthe same caps as findings: 10 entries, 300 characters each. Either cap setstruncated.enforceResponseSizeLimitnow handles a response that is still over 64KB after therawOutput/errortrims. It dropsfindings, thengaps, from the last issue backward until the response fits, and setstruncated.acMet/acTotal/verdictalways stay. Without this, per-issue caps bound one issue but not a many-issue run.Verification (runner):
npx tsc --noEmit: clean.npx vitest run src/mcp/tools/run.test.ts: 95 passed, with 2 new tests.Buffer.byteLength(JSON.stringify(response)) <= 64*1024, as QA suggested.capGapsa passthrough failed only the gaps-cap test, and emptying the drop loop failed only the 64KB test. Each was restored. The records are in the PR body.closingIssuesReferencesis [1200].QA is being re-dispatched on the new head.
admarble commentedon Sep 29, 2026
QA Verdict: READY_FOR_MERGE
AC coverage: 2/2 met
feat(#1200): mcp sequant_run result carries each issue's qa summary a…