Repository navigation
Description
Epic: graph-2026-11-simplify Tier: judgment Execution: split Blocked by: #1648 (the qa dispatch site in batch-executor.ts and types.ts are edited by #1646 to #1648)
Problem
D-8: an Evidence line that names an env file, a production CLI or a live URL becomes a pending row with the command shown, run by a person (as #1630 proposes for CI). In E2c (15 sequant runs on a private mirror of a repo that reaches production, 2026-11-02 to 11-03), the phase agents tried to use production credentials in 6 of 15 runs because the issues' Evidence lines named --env-file=.env.local and live checks: npx tsx --env-file=.env.local scripts/dev/query.ts …, vercel env ls production, a read of the main checkout's .env.local. A sandbox and absent files stopped every attempt; nothing in sequant did (#1641). The qa skill's §6h runs each Evidence command as written, and the skill is frozen. Founding doc §4, P-8, P-9, OQ-3.
Decisions
| ID | Decision | Rejected |
|---|---|---|
| E-1 | classifyEvidenceReach(evidence: string) in a new src/lib/evidence-reach.ts returns { reach: "worktree" | "needs-human", reasons: ("env-file" | "production-cli" | "live-url")[] } by P-9's rules, applied to the backticked command(s) in the clause |
a configurable list |
| E-2 | The qa dispatch builds a promptContext block listing each needs-human AC with its command and the instruction: do not run it; report the AC as PENDING with the command shown, for a person to run. It joins any existing context in the one sentinel block getPhasePrompt appends |
a second sentinel; a hook (D-5) |
| E-3 | The run log's acs[] entry gains optional reach and reachReasons (I-2: additive, version: 1) |
a new top-level field |
| E-4 | The run summary prints AC-N needs a person: <command> for each needs-human AC, whatever the QA output said |
trusting the QA output alone (OQ-3: whether the agent obeys is unverified) |
Prior fixes / producers
- Consumers of an AC's Evidence:
src/lib/ac-parser.ts(splitEvidenceClause,resolveVerificationMethod,isGateTestEvidence),src/lib/ac-linter.ts, the qa skill's §6h (frozen),scripts/qa/graph-plan/run-evidence.ts(plan-time; out of scope). Producers of per-AC status:src/lib/workflow/ac-status.ts(feat(run): one producer for per-AC status — parse the QA phase output, write the state record through updateACStatus, carry acs[] in the run log; unknown is a status #1525). Sibling class: qa: verdict lands as NEEDS_VERIFICATION with 'CI pending' as the only gap because /qa runs before the PR's checks finish #1630 (CI pending as a pending row). Class: the ACs state the outcome for every AC on every qa dispatch.
Acceptance Criteria
- AC-1: The classifier marks
--env-file, a.envpath, each listed production CLI and a non-local URL as needs-human, and leavesnpx vitest run …, alocalhostURL and agrepwhose pattern containshttps://as worktree. Evidence:npx vitest run src/lib/evidence-reach.test.ts→≥ 8 passed, 0 failed - AC-2: The qa prompt for an issue with one needs-human AC carries exactly one sentinel block naming that AC and its command verbatim, and an issue with none gets no reach block. Evidence:
npx vitest run src/lib/workflow/phase-executor.evidence-reach.test.ts→≥ 2 passed, 0 failed - AC-3: The run log records
reachper AC and an old log without it validates. Evidence:npx vitest run src/lib/workflow/run-log-schema.test.ts -t "reach"→≥ 2 passed, 0 failed - AC-4: The run summary prints one
needs a personline per needs-human AC with its command. Evidence:npx vitest run src/commands/run-display.test.ts -t "needs a person"→≥ 1 passed, 0 failed - 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)
The real-run half (does the agent obey; what verdict results) is #1655 (Execution: split, OQ-3, OQ-6).
May touch
src/lib/evidence-reach.ts and test (new), src/lib/workflow/batch-executor.ts (the qa dispatch's promptContext only), src/lib/workflow/phase-executor.ts (getPhasePrompt context join only) and phase-executor.evidence-reach.test.ts (new), src/lib/workflow/run-log-schema.ts, log-writer.ts, ac-status.ts (the acs[] entry only), src/commands/run-display.ts and test, docs/reference/run-command.md (one paragraph), CHANGELOG.
Non-Goals
- The qa skill's §6h text (frozen; §10), the verdict rules,
buildQaVerdictComment(feat(comments):renderIssueCommentowns comment layout — headline and AC table visible, everything else in one<details>block; adopted by the QA verdict, merge-check and review-residue builders; hiddensequant comment renderfor skills #1605). run.denyPathsand the README security section (docs + run: phase agents look for production credentials wherever the repo's docs name them; document it, and offer a deny list #1641, release+docs(trust): provenance decision applied; Security-model section in README and marketplace copy, banned-phrase gated (#980 P2) #1028).- Blocking the commands in a hook (D-5).
Done when
Every qa dispatch tells the agent which Evidence lines are a person's to run, and the run log and summary name them, for every issue.
Activity
admarble commentedon Nov 11, 2026
Runner context, 2026-11-11: repo state since this issue was written
#1646 to #1648 merged;
mainis atd1eb83be7.promptContexttoday:getPhasePrompt(phase-executor.ts:1465, block at :1493) appends one sentinel block. The only producer is the/loopdispatch (batch-executor.ts:2671,buildLoopContext). The qa dispatch passes none today, so E-2's join usually means the reach block is the whole context. One block, not two.ac-status.ts:222already parses the issue body withextractAcceptanceCriteria, andsplitEvidenceClause(ac-parser.ts:209) separates out the Evidence clause. The run log'sacs[]entry is atrun-log-schema.ts:393(feat(run): one producer for per-AC status — parse the QA phase output, write the state record through updateACStatus, carry acs[] in the run log; unknown is a status #1525).reach/reachReasonsare added there, optional (I-2, E-3).mainbuild on two notes-fixture smoke issues, after #S-01 to #S-07 merge; the owner reads the report #1655 AC-2 greps the summary forneeds a person: .npx tsx --env-file, where the.stands for one character before the command. Print E-4's line asAC-N needs a person: `<command>`, with the command in backticks and verbatim, so the line matches.run-display.tslost--reflectin chore(cli)!: remove--stacked,--reflectand--full-qa— flags,run.fullQa, the MCPfullQaparameter andrun-reflect.ts;--chainkeeps working #1648 (PR chore(#1648)!: remove--stacked,--reflectand--full-qa— flags,run.fullQa, the MCPfullQaparameter andrun-reflect.ts;--chainkeeps working #1674). Read the current file.docs/reference/run-command.md: add your one paragraph somewhere other than### Ready Gate,### Running Multiple Issuesor### Chain Mode, which docs(ready): the ready gate's docs drop the second-look claim — describe the qa → loop → qa mechanism and its policy, cite #1344 for what was measured #1650 and feat(run):--chainand multi-issue runs print an "experimental" warning with their measured success rates — fixed, dated counts; the code stays #1651 edit in the runs just before yours.~/Projects/sequant.vitest.global-setup.tsbuildsdist/, and in the main checkout thatdist/is the binary the harness runs (gate(owner): pin the harness and matcha-maps to sequant 2.20.0 before 3.0 is published #1656).admarble commentedon Nov 11, 2026
Complexity: Standard (5 ACs, 4 directories)
AC Quality Check
Evidence:clause. ✅mainatd1eb83be7:evidence-reach.test.tsandphase-executor.evidence-reach.test.tsdon't exist yet.-t "reach"matches nothing inrun-log-schema.test.ts, and-t "needs a person"matches nothing inrun-display.test.ts. So AC-1 to AC-4 all fail today. AC-5 is a constraint. None of them is vacuous.getPhasePrompt, not the dispatch. A test that passes a prebuilt context togetPhasePromptstays green even if the qa dispatch inbatch-executor.tsnever passes the block. That missing link is exactly what this issue fixes, so derived AC-6 below closes the gap.http(s)URL is needs-human, but AC-1 wantsgrep 'https://…'to stay worktree. The rule needs a first-word exception (see OQ-1).Scope Assessment
Non-Goals: present. They cover §6h text, the verdict rules,
buildQaVerdictComment,run.denyPaths, the README security section, and hook blocking.src/lib,src/lib/workflow,src/commands,docs/reference)Verdict: ✅ SCOPE_OK
Blocker: #1648 is CLOSED (merged as #1674), so this issue is unblocked.
Conflict risk: #1650 and #1651 (open worktrees) both edit
docs/reference/run-command.mdandCHANGELOG.md. Put the paragraph under### Phase agent environment, which neither of them touches, and expect a CHANGELOG merge conflict. The #1351 worktree only touches skill directories, so it doesn't overlap.Acceptance Criteria
AC-1: Classifier rules
Verification: Unit Test (
src/lib/evidence-reach.test.ts, ≥ 8 cases)Scenario: Given an Evidence clause → When
classifyEvidenceReach(clause)runs → Then the result isneeds-humanwith reasons for:--env-file=.env.local.env/.env.productionpathnpx vercel …https://api.example.comURLand
worktreefor:npx vitest run …curl http://localhost:3000grep -c 'https://x' fAssumptions:
worktree, because qa doesn't run prose.`≥ 8 passed`classify as worktree without special handling.AC-2: qa prompt block
Verification: Unit Test (
phase-executor.evidence-reach.test.ts)Scenario:
SEQUANT_PROMPT_CONTEXTsentinel pair is present, and it containsAC-Nand the command byte-for-byte.AC-3: Run-log
reachVerification: Unit Test (
run-log-schema.test.ts -t "reach")Scenario:
acs[]entry withreach: "needs-human", reachReasons: ["env-file"]validates.version: 1log whoseacs[]entries have noreachstill validates.AC-4: Summary line
Verification: Unit Test (
run-display.test.ts -t "needs a person")Scenario: Given a result with one needs-human AC → When
displaySummaryruns → Then stdout hasAC-N needs a person: `<command>`. The command is backticked and verbatim, because #1655 AC-2 grepsneeds a person: .npx tsx --env-file. The line prints whatever the QA verdict or output said.AC-5: No skill edits
Verification: constraint (the git diff grep returns 0).
AC-6 (derived): The qa dispatch passes the block
Verification: Unit Test, mutation-verified.
Scenario: Given an issue with one needs-human AC → When the batch executor dispatches
qa→ Then thepromptContextin theExecutionConfigit hands toexecutePhaseWithRetrycontains the reach block.Mutation: delete the
promptContextline at the qa dispatch; this test must fail while AC-2 stays green.Implementation Plan
Phase 1: Classifier (
src/lib/evidence-reach.ts, new)classifyEvidenceReach(evidence). It returns{ reach, reasons }and applies these rules to each backticked span:&&,||,;and|.VAR=xassignments and a runner prefix (npx,pnpm dlx,bunx,pnpm exec), then take the first word.--env-fileanywhere, or a token matching(^|[\s/'"=])\.env(\.[\w-]+)*\b.vercel,supabase,netlify,fly,heroku,wrangler,railway,aws,gcloud,az).https?://host that isn'tlocalhost,127.0.0.1,0.0.0.0or[::1], unless the segment's first word is a text-search tool (grep,rg,git grep,ag). This is OQ-1.evidenceCommands(evidence): string[], which returns the backticked spans. The needs-human ones are the commands the prompt and summary show.buildEvidenceReachContext(items: {id, evidence?}[]): string | undefined. It returnsundefinedwhen no AC is needs-human. Otherwise it returns a block headed for the qa agent: "Do not run these Evidence commands. Report each AC asPENDINGwith the command shown, for a person to run." It then lists one line per AC:- AC-N: \``.Phase 2: Wiring (
batch-executor.ts,ac-status.ts,types.ts)ac-status.ts, exportacRecordFor(or a thinloadAcRecord) so the dispatch reads the same AC recordrecordAcStatusesuses. That record comes from state, falling back to the issue body.batch-executor.ts:2187,phase === "qa"only), compute the reach once per issue and cache it onIssueRunState. Join the reach block with any existingissueConfig.promptContextusing"\n\n", and pass the result aspromptContext.getPhasePromptkeeps appending one sentinel block, sophase-executor.tslikely needs no change. Pull the config build into a small exported helper so AC-6 can test it directly.recordAcStatuses, accept an optional reach map and addreach/reachReasonsto eachAcStatusEntry. Inrun-log-schema.ts:393, addreach: z.enum(["worktree","needs-human"]).optional()andreachReasons: z.array(z.enum([...])).optional(). The log stays atversion: 1(I-2).log-writer.tsserialisesacswhole, so check that it passes the new fields through.needsHuman?: { id: string; command: string }[]toIssueResult(types.ts). Set it from the cached reach whenever qa was dispatched, whatever the verdict (E-4).Phase 3: Summary and docs
run-display.tsdisplaySummary, after the ready-gate block, print#N AC-N needs a person: `<command>`for each entry. Print one line per command when an AC has more than one needs-human command.docs/reference/run-command.mdunder### Phase agent environmentand a CHANGELOG entry.Design Review
src/lib/evidence-reach.ts, next toac-parser.ts, the other Evidence consumer. The wiring goes in the orchestrator's qa dispatch. Neither change touches skills, which stay frozen.promptContextchannel./loopdispatch'sbuildLoopContext→promptContext(Quality loop retries misclassified as cold-start failures, wasting retry budget #488, bug(loop): orchestrated Step 1A re-fetches QA findings from GitHub instead of trusting the promptContext already embedded in its own prompt #960).git log -S promptContextonbatch-executor.tsshows one introducing commit (fix(#488): prevent loop phase retry misclassification as cold-start #489) and no re-patches.splitEvidenceClause?" The AC record already carriesevidence(ac-parser.ts:211, state schema:249), so there's nothing new to parse.gh api https://api.github.com/…would be needs-human. That's accepted, because it is a live call.acs[]:ac-status.tsrecordAcStatuses→LogWriter.setAcStatuses. There is only one.acs[]:log-writer.ts:349,run-log-schema.ts,scripts/qa/ac-attribution-rate.tsandscripts/qa/ac-status-parse-coverage.ts. Both scripts readid/status, so additive fields are safe.promptContext: the loop dispatch (batch-executor.ts:2671), the ready-gate loop (ready-gate.ts:817), and qa (new).Sibling site (not widened, your call): the ready gate dispatches qa a second time (
ready-gate.ts:724, throughrunReadyGateForIssueandsequant ready), with nopromptContext. "Done when: every qa dispatch" covers it, but May-touch leavesready-gate.tsout. See OQ-2.Feature Quality Planning
All standard checks pass. Notable items:
.envfiles.gh, so no new trust surface is added.Derived ACs
getPhasePrompt)ExecutionConfig.promptContextcarries the reach block. Mutation-verified per CLAUDE.md.Open Questions
grep,rg,git greporag. The alternative, "a quoted URL is a pattern", would misscurl "https://…". Impact if wrong: AC-1's grep case fails, or a livecurlslips through.ready-gate.tsisn't in May-touch, and docs(ready): the ready gate's docs drop the second-look claim — describe the qa → loop → qa mechanism and its policy, cite #1344 for what was measured #1650 is editing the ready-gate docs. Impact: until then,sequant readyand--ready-gateQA passes can still run needs-human Evidence. The run summary still names those ACs.IssueResult.needsHumanlives intypes.ts, which isn't in May-touch. Recommendation: accept it, because it is the only path from the executor todisplaySummary. Reading the run log back from disk is the alternative, and it fails under--no-log.Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: disabled
Reasoning: AC-1 to AC-4 declare unit-test Evidence on new test files, so testgen should stub them first. Scope is OK, and the change is additive behind optional fields.
Label Review
graph-2026-11-simplifyenhancementandplanned.admarble commentedon Nov 11, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 6/6 met
Gaps:
Reviewed in a separate session by claude-code (claude-opus-5-5); the change was written by claude-code (claude-opus-5-5).
feat(#1681): the ready gate's qa passes get #1652's do-not-run block …
refactor(#1688): option A — the needs-human block joins only in execu…