Repository navigation
Closed
Labels
enhancementNew feature or requestplannedImplementation plan approvedqaQA skill and quality assurance
Description
Summary
Phase agents (exec, qa) run the whole test suite inside one tool call. That call no longer fits the time limits it runs under. Use the test runner's affected-tests mode in phases and keep the full suite in CI.
Current State
npm testruns 337 files in 6–13 min. The Bash tool caps a call at 600 s. Undersequant runthe MCP watchdog kills a phase after 30 min with no progress (PHASE_TIMEOUT,src/mcp/tools/run.ts; feat(mcp): configurable per-phase no-progress wall for sequant_run — judgment-tier exec phases die at the hard-coded 30 minutes #1049).- Observed: 2026-09-20 (guard wave 1), the docs(exec/qa): the SEQUANT_MUTATION failedTest contract (<test file> > <name>) is enforced by the classifier but never told to authors — tripped 2 of 4 gate PRs #1104 qa re-run and test(drivers): conformance suite every agent driver must pass — commit in sandbox, network, typed error mapping, env injection, structured outcome #1096 exec died on
PHASE_TIMEOUTwhile the full suite ran under load. Two more exec kills on 2026-10-01. - Current workaround is manual. The runner posts a "do not run the full suite" note on each issue before dispatch, and the person running it runs suites one at a time.
qa/SKILL.md:479-481already caps the call attimeout 600and skips it when such a note exists. - CI (
ci.ymljobtest) already runs the full suite on every PR and is a required check. So the phase-level full run duplicates CI and blocks nothing on its own.
Proposed Change
In the exec and qa skills, replace "run the full suite" with "run the tests affected by this branch", then a named-files pass:
npx vitest run --changed origin/main(Vitest: "Run tests that are affected by the changed files"; it follows the static import graph).- Plus any test file named in an AC's
Evidence:command. Gate tests that readSKILL.mdor fixtures throughfsare not in the import graph, so--changedmisses them (relates to feat(spec/qa): check that an AC's declared verify command selects that issue's own tests #1074). - Plus every changed test file.
Make this stack-aware, because the skills ship to non-vitest repos. Keep the command in the stack config (src/lib/stack-config.ts): jest --changedSince=origin/main, vitest --changed origin/main. If a stack has no affected mode, use the current full-suite behaviour.
The full suite stays the merge gate in CI. Phases stop duplicating it.
Acceptance Criteria
- AC-1: exec and qa SKILL.md tell the agent to run the stack's affected-tests command plus AC-named test files instead of the full suite — Evidence:
grep -nE -- "--changed( |$)|changedSince" .claude/skills/exec/SKILL.md .claude/skills/qa/SKILL.md - AC-2: the stacks module (
src/lib/stacks.ts,resolveAffectedTestCommand; amended by the owner 2026-10-07 per spec OQ-1 / ADR-0010 —stack-config.tsholds no commands) exposes an affected-tests command for at least the vitest and jest stacks, and falls back to the full-suite command when one is absent — Evidence:npx vitest run src/lib/stacks.test.ts -t affectedTest - AC-3: on a sample branch that changes one
src/libmodule, the affected run finishes in under 120 s and includes that module's test file — Evidence: timed run recorded in the PR body - AC-4: a gate test that reads a skill file through
fsstill runs when only that skill file changes (picked up as an AC-named or changed file) — Evidence: test in the diff, mutation-verified - AC-5: skill mirrors in sync — Evidence:
npm run lint:skill-sync
Context
- Location:
.claude/skills/{exec,qa}/SKILL.md(+ templates/plugin mirrors),src/lib/stack-config.ts - Type: Tests / workflow
- Effort: Medium
- Tool: Vitest CLI
--changed - Identified by:
/improveanalysis (tooling research, 2026-10-07)
Related
- feat(mcp): configurable per-phase no-progress wall for sequant_run — judgment-tier exec phases die at the hard-coded 30 minutes #1049 (configurable no-progress wall), feat(spec/qa): check that an AC's declared verify command selects that issue's own tests #1074 (AC verify command selects the issue's own tests), fix(exec): phase agent that backgrounds the test suite and waits for a notification strands uncommitted work — block Monitor/run_in_background under the orchestrator, WIP-commit on the no-commit guard #1032
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestplannedImplementation plan approvedqaQA skill and quality assurance
Activity
admarble commentedon Oct 7, 2026
Runner note for the phase agents (sequant run, 2026-10-07):
npm testsuite in exec or qa. CI runs it on the PR and it is a required check. Run the test files you add or change, plus each AC's own Evidence command, in the foreground withtimeout 590.run_in_backgroundorMonitor: the phase ends when your turn ends and the result never arrives.SEQUANT_MUTATIONmarkers and AC table in exec's final## Summary. The runner checks the PR body after exec..claude/skills/then runnpm run sync:skillssotemplates/andplugin/stay in sync, and keepnpm run lint:skill-syncgreen.admarble commentedon Oct 7, 2026
Complexity: Standard (5 ACs, 3 directories)
AC Quality Check
greprc=1), so it gates the work. OK.npx vitest run src/lib/stack-config.test.tspasses on unchanged code. Tighten it to a named new test, e.g.npx vitest run src/lib/stacks.test.ts -t "affectedTest". Also,stack-config.tsis only the.sequant/stack.jsonpersistence layer. It holds no commands (see Open Question 1).Scope Assessment
Non-Goals:⚠️ Not found. Suggested: no change to CI
testjob; no change tonpm testscript; no new--changedhandling insequant runTypeScript..claude/skills,src/lib, mirrors)Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: exec and qa tell the agent to run the affected-tests command + AC-named files
Verification: Manual Test (grep), backed by a skill-gate test
Scenario: Given the edited SKILL.md files → When the
Evidence:grep runs → Then both files match--changed/changedSinceAssumptions: Exactly the passages at
exec/SKILL.md:57,1339,1371-1390andqa/SKILL.md:479-483carry the "full suite" instruction.AC-2: stack config exposes an affected-tests command (vitest, jest), falls back to full suite
Verification: Unit Test
Scenario: Given a runner of vitest / jest / unknown → When the resolver is called → Then
vitest run --changed origin/main/jest --changedSince=origin/main/ the stack's fullcommands.testAssumptions: The location is decided in Open Question 1.
AC-3: affected run on a one-module branch finishes <120 s and includes that module's test
Verification: Manual Test (timed run in PR body)
Scenario: Given a branch touching one
src/libmodule → Whennpx vitest run --changed origin/mainruns → Then wall time <120 s and the module's test file is listedAC-4: fs-reading gate test still runs when only its skill file changes
Verification: Unit Test, mutation-verified
Scenario: Given only
.claude/skills/exec/SKILL.mdchanged → When the affected-set builder runs → Then the gate test that reads that file is in the setAssumptions:
--changedmisses fs-read files, so the set is--changedoutput ∪ ACEvidence:test files ∪ changed*.test.ts. A changed SKILL.md is not itself a test file, so rule 3 alone does NOT cover it. The test must define how a changed non-test file maps to its fs-reading gate test (see Open Question 2).AC-5: skill mirrors in sync
Verification:
npm run lint:skill-syncImplementation Plan
Phase 1: Command resolution (src)
affectedTestfield per test runner, next to the existingcommands.testinsrc/lib/stacks.ts(StackConfig.commands). AddresolveAffectedTestCommand(stack, runner)that returns the affected command, orcommands.testwhen none exists.package.jsondevDependencies / config file presence. The JS stacks all usenpm test, so the stack name alone cannot pick the flag.Phase 2: Skills
.claude/skills/exec/SKILL.md(~L57, L1339, L1371-1390) and.claude/skills/qa/SKILL.md(~L479-483, L1965): replace "full suite" with the affected command, plus AC-Evidence:test files, plus changed test files. Keeptimeout 600, the foreground-only rule and the WIP-commit step. State that the full suite is the CI merge gate. Keep the "no affected mode → full suite" fallback.npm run sync:skillsto refreshtemplates/andplugin/; thennpm run lint:skill-sync,npm run lint:skill-gates.Phase 3: Tests
Mutation-verified:markers with the<test file path> > …form.Design Review
src/lib/stacks.ts(it ownscommands.test); the skill prose tells the agent which command to run.STACKS[*].commands). The "don't run the full suite" rule has been patched in prose several times: fix(exec): phase agent that backgrounds the test suite and waits for a notification strands uncommitted work — block Monitor/run_in_background under the orchestrator, WIP-commit on the no-commit guard #1032 (foreground only), feat(mcp): configurable per-phase no-progress wall for sequant_run — judgment-tier exec phases die at the hard-coded 30 minutes #1049 (watchdog), the 2026-09-20 qa cap atqa/SKILL.md:479. Each time it was prose-only, plus a manual runner note. This change moves the default rather than adding another exception, so it addresses the class. Nodeliberately localneeded.--changedmisses fs-read gate tests, so a green affected run can hide a red gate test." Mitigation: AC-named + changed test files, and CI keeps the full run. Also: "doesn't a staleorigin/mainmake the set wrong?" The skill shouldgit fetch origin mainfirst.src/lib/stacks.ts(commands.test,variables.TEST_COMMAND), consumersagents-md.ts:175,init.ts:1204,sync.ts:784,merge-check/combined-branch-test.ts:402(separate${pm.run} test, correctly stays full-suite). Skill consumers: exec, qa (andsolve/looptext mentionnpm test: grep before finishing). Only one producer for the new field. The merge-check path must NOT adopt the affected mode.ADR: The plan chooses between designs (resolver in
stacks.tsvsstack-config.ts; skill prose vs CLI wrapper). The exec PR must include an ADR indocs/adr/(next NNNN, shape perdocs/adr/README.md).Feature Quality Planning
All standard checks pass. Notable items:
origin/mainlocally; fetch first.Bash(npm test:*)allowed-tools grant does not covernpx vitest run --changed …; check each skill'sallowed-toolsfrontmatter and add a narrowBash(npx vitest:*)grant if absent (cf. fix(skills): narrow broad allowed-tools grants — bare Bash, Bash(*), and runner wildcards hold the directory listing for review #1287).npm test" (loop,fullsolve,test) are outside this issue. Recommend a follow-up rather than silent widening.Open Questions
src/lib/stack-config.ts, but that file only persists.sequant/stack.json; all test commands live inStackConfig.commandsinsrc/lib/stacks.ts. Recommendation:stacks.ts, and amend AC-2's location. Impact if wrong: the AC-2 Evidence points at a file with no test of the new behaviour.grep -lthe changed path across**/*.test.tsand add those hits to the run. Impact: without it AC-4 is only met for changed test files.-t "affectedTest"). Recommendation: yes.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: Skill-prose edits plus one small resolver. AC-2 and AC-4 declare unit-test evidence, but exec writes the tests alongside the code; testgen adds little. The new
affectedTestfield is skill-facing, so no browser test.Label Review
Current: enhancement, qa
Recommended: enhancement, qa, planned
Quality Loop: Won't auto-enable (SCOPE_OK).
admarble commentedon Oct 7, 2026
QA Verdict: AC_NOT_MET
AC coverage: 4/5 met
Gaps:
fix(#1349): no step outside the affected-tests section runs the bare …
fix(#1349): count the affected set first and shard a large one under …
fix(#1349): drop the npx vitest/jest grants the allowed-tools gate re…
admarble commentedon Oct 7, 2026
Runner note for QA round 2 (2026-10-07): the runner fixed the round-1 findings and the first CI failures on the PR branch (commits and reasons are in the PR body's "QA round 1 fixes" and "CI round fix" sections). CI is green on the current head, full suite included, so don't re-run
npm test: verify each AC with its own Evidence command and the named test files, foreground,timeout 590.admarble commentedon Oct 7, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 5/5 met
Gaps:
fix(#1349): qa's affected set gets the whole-tree scanners and the co…
feat(#1349): improve(skills): phases run affected tests (vitest --cha…