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
bug(state): a successful spec-only run marks the issue ready_for_merge, so a later --phases exec skips it #1233
A successful sequant run N --phases spec, with no exec and no qa, therefore marks #N ready_for_merge. The next sequant run N --phases exec then skips it:
! #1: already ready_for_merge — skipping (use --force to re-run)
All issues already completed. Use --force to re-run.
Observed 2026-09-30 in the #1138 Phase 0 bench, which splits spec, exec and qa into separate invocations so that each can run with different settings. --force works around it, but it also force-acquires the issue lock, and "run spec now, exec later" is an ordinary workflow.
Acceptance criteria
AC-1: A successful run in which no qa phase actually ran (for example --phases spec, --phases exec, or an auto-detected plan without qa) leaves the issue in a non-terminal status (for example in_progress), not ready_for_merge. Evidence: npx vitest run src/lib/workflow/batch-executor.test.ts with a spec-only run fixture
AC-2: After a spec-only run, sequant run N --phases exec runs without --force. Evidence: npx vitest run src/lib/workflow/run-orchestrator.test.ts
AC-3: A run that includes qa and passes still records ready_for_merge or awaiting_verification, as today. Evidence: the existing batch-executor status tests stay green
The skip guard that reads this status is run-orchestrator.ts:927 / :947 ("already ${status} — skipping (use --force to re-run)").
Shape of the fix:
A terminal status (ready_for_merge / awaiting_verification) requires that a qa phase actually ran in this run (it's present in phaseResults) and passed. Read what ran, not what was requested. The body's AC-1 now says so. Otherwise a successful run records in_progress.
Keep the ready-gate branch (readyGateResult) exactly as it is.
finalStatus has other consumers. It's hoisted because "the checkpoint warning also has to name this status" (fix(chain): --chain --ready-gate resume re-executes already-gated links (COMPLETED_STATUSES misses waiting_for_human_merge/blocked) #837). The chain-mode checkpoint commit "after QA passes" follows right after it, and PR creation may also depend on it. grep -n finalStatus src/lib/workflow/batch-executor.ts, and make sure each consumer still behaves correctly for a spec-only run and an exec-only run. In particular, a spec-only run must not create a checkpoint commit or a PR as if QA had passed.
Existing tests at batch-executor.test.ts:838-842 and :2813-2839 pin the status behaviour. Keep them green (AC-3).
Standard block:
No full npm test in exec or in qa. This applies to the qa phase as well as exec. Run targeted suites in the foreground with a timeout: timeout 600 npx vitest run src/lib/workflow/batch-executor.test.ts src/lib/workflow/run-orchestrator.test.ts. Global setup runs npm run build first.
Commit WIP early, and always before any mutation.
A mutation marker's failedTest starts with the test file path.
Before moving or reshaping a code block, grep the tests for a literal from it: some tests regex-scan source files (for example abort-logging.integration.test.ts scans run-orchestrator.ts).
open_ended: "for example" implies other cases exist
False positive — the parenthetical lists concrete illustrations of one well-defined condition ("no qa phase appears in phaseResults"), not an open scope. No AC rewrite needed.
AC-2
none
—
AC-3
none
—
Scope Assessment
Non-Goals:⚠️ Non-Goals section not found. Consider adding scope boundaries.
AC-1: Spec-only / exec-only success leaves the issue in_progress, not ready_for_merge
Verification: Integration Test Scenario: Given a run with phases: ["spec"] (or ["exec"]) and no qa phase in the resolved plan → When runIssueWithLogging completes successfully → Then stateManager.updateIssueStatus is called with "in_progress", never "ready_for_merge" or "awaiting_verification". Assumptions: The signal is "a qaPhaseResult is present in phaseResults," not "qa was in the requested phase list" — matches the issue comment's "read what ran, not what was requested."
AC-2: A spec-only run doesn't cause a later --phases exec to be skipped
Verification: Integration Test Scenario: Given an issue whose persisted status is "in_progress" (post-AC-1 fix) → When sequant run N --phases exec is invoked without --force → Then the non-chain skip guard in run-orchestrator.ts (~line 947) does not log "already … skipping" and the issue proceeds through exec. Assumptions:isCompletedIssueStatus / COMPLETED_ISSUE_STATUSES (src/lib/workflow/completed-status.ts) are unchanged — in_progress was already outside the completed set; this AC is regression coverage for the state write, not the predicate.
AC-3: A run that includes qa and passes still records the current terminal status
Verification: Integration Test Scenario: Given phases: ["qa"] with a NEEDS_VERIFICATION or READY_FOR_MERGE verdict (existing fixtures at batch-executor.test.ts:2813-2839) → When the run completes → Then updateIssueStatus still records "awaiting_verification" / "ready_for_merge" exactly as today. Assumptions: None — pure regression guard, no new fixture needed beyond confirming the existing suite stays green after the AC-1 change.
This is a one-conjunct change (success → success && qaPhaseResult); the readyGateResult branch, the NEEDS_VERIFICATION branch, and the failure (in_progress) branch are untouched.
grep -n finalStatus src/lib/workflow/batch-executor.ts and confirm every consumer (the updateIssueStatus call, the checkpoint-failure warning string) reads the corrected value with no further edits needed. Per the issue comment's own audit: the checkpoint commit (if (success && chainMode && worktreePath)) and PR creation (hasExecChanges-gated since fix(run): phase-restricted runs without an implementing phase must skip PR creation — spec-only batches always report failed #920) already key off chain-mode/commit-evidence rather than finalStatus directly, so a spec-only run already can't produce a spurious checkpoint or PR — verify this holds, don't add new guards there.
The second, independent qaVerdict binding at ~line 2342 (used only for the PR body) is unaffected — leave it as its own const.
Phase 2: Test coverage — batch-executor.test.ts
Add a case beside the existing qa-verdict block (~:2813-2839): phases: ["spec"], qualityLoop: false, mock returns success for spec only → assert updateIssueStatus.mock.calls contains "in_progress" and not "ready_for_merge"/"awaiting_verification" (AC-1).
Add a second case for phases: ["exec"] (no qa) with the same assertion — the AC text names this as an explicit example, not just --phases spec.
Re-run the existing NEEDS_VERIFICATION/READY_FOR_MERGE cases unmodified to confirm AC-3 (no new fixture, just a regression run).
Phase 3: Test coverage — run-orchestrator.test.ts
Add a case exercising the non-chain skip guard (~line 947-960): seed the mocked stateManager.getIssueState to return { status: "in_progress" }, run with --phases exec and no --force, assert the issue is not logged as skipped and is included in the phases actually executed (AC-2). This file currently has zero coverage of the skip guard — it's new, not modified, coverage.
Phase 4: PR & housekeeping
CHANGELOG.md: add a ### Fixed entry under [Unreleased], per the issue comment's explicit instruction.
What's the simplest correct approach? Gate on phaseResults.find(p => p.phase === "qa") (what ran) rather than inferring "qa was requested" from config.phases / options.autoDetectPhases (what was asked for). Rejected: threading a new ranQa flag through the function signature — the phase-result list already carries this signal, no new state needed.
What would a senior reviewer challenge? "Why not fix isCompletedIssueStatus/COMPLETED_ISSUE_STATUSES instead?" — because the skip predicate is correct (ready_for_mergeshould mean skip); the bug is that a spec-only run wrote ready_for_merge when it never validated anything. Fixing the predicate would leave the state file recording a false claim that other consumers (e.g. state-cleanup.ts's merge-detection sweep) also read.
Feature Quality Planning
All standard checks pass. Notable items:
No ## Non-Goals section in the issue (flagged above) — low risk given the tightly scoped 3-file "May touch" list; not blocking.
The issue comment already pins the exact existing-test line ranges (:838-842, :2813-2839) new cases should sit beside — exec should follow that placement rather than appending at file end, to keep the qa-verdict scenarios grouped.
Open Questions
Should AC-2 test the orchestrator's skip guard directly, or just the isCompletedIssueStatus predicate in isolation? Recommendation: the real skip-guard code path in run-orchestrator.test.ts (per Phase 3 above) — the AC's own wording is behavioral ("sequant run N --phases exec runs without --force"), and a predicate-only unit test wouldn't prove the orchestrator path works. Impact if wrong: coverage looks satisfied but doesn't match the AC's Evidence: clause.
Phases: exec → qa Quality Loop: disabled Reasoning: Issue is explicitly tagged Tier: mechanical — a single-conjunct ternary fix in one function, with the exact test placement already specified in the issue comment. testgen is deliberately not recommended despite AC-1/AC-2 declaring npx vitest run <file> evidence (which would normally trigger it per the declared-evidence rule): both evidence commands point at test files that already exist with an established, pinned pattern for this exact scenario family (qa-verdict branching at :2813-2839) — exec should hand-write the two new cases beside that pattern directly rather than going through stub generation for already-patterned code.
Label Review
Current:bug, graph-2026-09-prerelease Recommended: no changes to domain labels (no UI/frontend surface, not complex/refactor/breaking — single ternary fix) Reason: Current labels already match the mechanical/bug shape of this fix. Quality Loop: Won't auto-enable — SCOPE_OK, mechanical tier, no scope warning.
AC-2: Spec-only run doesn't block a later --phases exec — Integration Test, run-orchestrator.test.ts
AC-3: A passing qa run still records today's terminal status — Integration Test, existing batch-executor.test.ts fixtures stay green
Fix:batch-executor.ts:2234-2241 — gate the ready_for_merge/awaiting_verification branch on a qaPhaseResult actually being present in phaseResults, not just on success. One-conjunct change (success → success && qaPhaseResult); readyGateResult, checkpoint-commit, and PR-creation logic are all unaffected (already evidence-gated per #920).
Tests: two new cases in batch-executor.test.ts (spec-only, exec-only) beside the existing qa-verdict block at :2813-2839; one new case in run-orchestrator.test.ts exercising the non-chain skip guard with a seeded "in_progress" status (currently zero coverage there).
Key decision:testgen skipped despite declared vitest evidence — both target files already have the exact pattern to extend; stub generation would add ceremony, not value, for a mechanical-tier fix.
Open questions: test the orchestrator skip-guard path directly (recommended) vs. the predicate in isolation; #1223 coordination noted, not blocking.
In the new tests, toContain("in_progress") passes trivially if status is set to in_progress at the start of the run. The not.toContain("ready_for_merge") assertions are the ones that actually tell the fixed and broken code apart.
AC-1 mutation record not yet in the PR body (the mutation itself passes when run by hand)
Checkpoint comment block is stale for runs without qa, which now record in_progress
The --resume case where qa completed earlier is untested
Suggestions:
The comment block at batch-executor.ts:~2261-2273 still says that "a completed status was already written above … so a re-run reads this link as a completed prefix". After this change that's only true when qa ran. The comment should mention the in_progress case.
The new warning says "a re-run resumes the chain at this link". Chain resume actually starts at the first unfinished link (chain-resume.ts:112-123), so if an earlier link is also in_progress it resumes there. This is a wording nit.
A --resume run that skips an earlier, completed qa now records in_progress. That's the safe direction and it's documented in the CHANGELOG and the code comment, but no test covers it.
Checkpoint comment's 'therefore absent from the branch tip ... computeChainResumePlan detects' now follows the in_progress sentence, though fail-fast only applies to the completed-prefix case; line also overlong
batch-executor.ts:2268: the reflowed comment line runs past about 150 characters. Its next sentence, "Its uncommitted work is therefore absent … which computeChainResumePlan detects", now follows the in_progress sentence. But the dirty-worktree fail-fast only applies to the completed-prefix case, so "therefore" now points at the wrong status. Only the comment is affected; the code is correct.
Activity
admarble commentedon Sep 30, 2026
Context for the run (graph tracker #1236, wave 2; re-checked against
mainafter wave 1 merged)Current code:
src/lib/workflow/batch-executor.ts:2234-2241The skip guard that reads this status is
run-orchestrator.ts:927/:947("already ${status} — skipping (use --force to re-run)").Shape of the fix:
ready_for_merge/awaiting_verification) requires that aqaphase actually ran in this run (it's present inphaseResults) and passed. Read what ran, not what was requested. The body's AC-1 now says so. Otherwise a successful run recordsin_progress.readyGateResult) exactly as it is.finalStatushas other consumers. It's hoisted because "the checkpoint warning also has to name this status" (fix(chain): --chain --ready-gate resume re-executes already-gated links (COMPLETED_STATUSES misses waiting_for_human_merge/blocked) #837). The chain-mode checkpoint commit "after QA passes" follows right after it, and PR creation may also depend on it.grep -n finalStatus src/lib/workflow/batch-executor.ts, and make sure each consumer still behaves correctly for a spec-only run and an exec-only run. In particular, a spec-only run must not create a checkpoint commit or a PR as if QA had passed.batch-executor.test.ts:838-842and:2813-2839pin the status behaviour. Keep them green (AC-3).Standard block:
npm testin exec or in qa. This applies to the qa phase as well as exec. Run targeted suites in the foreground with a timeout:timeout 600 npx vitest run src/lib/workflow/batch-executor.test.ts src/lib/workflow/run-orchestrator.test.ts. Global setup runsnpm run buildfirst.failedTeststarts with the test file path.abort-logging.integration.test.tsscansrun-orchestrator.ts).Closes #1233. UseRefsonly for the tracker, tracker(graph): pre-release fixes before the next release after 2.18.0 (4 nodes) #1236.### Fixedentry under[Unreleased].admarble commentedon Sep 30, 2026
Complexity: Standard (3 ACs, 1 directory)
AC Quality Check
open_ended: "for example" implies other cases existqaphase appears inphaseResults"), not an open scope. No AC rewrite needed.Scope Assessment
Non-Goals:⚠️ Non-Goals section not found. Consider adding scope boundaries.
src/lib/workflow/)Verdict: ✅ SCOPE_OK (trivial — assessment skipped)
Acceptance Criteria
AC-1: Spec-only / exec-only success leaves the issue
in_progress, notready_for_mergeVerification: Integration Test
Scenario: Given a run with
phases: ["spec"](or["exec"]) and noqaphase in the resolved plan → WhenrunIssueWithLoggingcompletes successfully → ThenstateManager.updateIssueStatusis called with"in_progress", never"ready_for_merge"or"awaiting_verification".Assumptions: The signal is "a
qaPhaseResultis present inphaseResults," not "qa was in the requested phase list" — matches the issue comment's "read what ran, not what was requested."AC-2: A spec-only run doesn't cause a later
--phases execto be skippedVerification: Integration Test
Scenario: Given an issue whose persisted status is
"in_progress"(post-AC-1 fix) → Whensequant run N --phases execis invoked without--force→ Then the non-chain skip guard inrun-orchestrator.ts(~line 947) does not log "already … skipping" and the issue proceeds throughexec.Assumptions:
isCompletedIssueStatus/COMPLETED_ISSUE_STATUSES(src/lib/workflow/completed-status.ts) are unchanged —in_progresswas already outside the completed set; this AC is regression coverage for the state write, not the predicate.AC-3: A run that includes
qaand passes still records the current terminal statusVerification: Integration Test
Scenario: Given
phases: ["qa"]with aNEEDS_VERIFICATIONorREADY_FOR_MERGEverdict (existing fixtures atbatch-executor.test.ts:2813-2839) → When the run completes → ThenupdateIssueStatusstill records"awaiting_verification"/"ready_for_merge"exactly as today.Assumptions: None — pure regression guard, no new fixture needed beyond confirming the existing suite stays green after the AC-1 change.
Implementation Plan
Phase 1: Fix
finalStatuscomputation (batch-executor.ts:2234-2241)qaVerdicttruthy/matches a value" to "did aqaphase actually appear inphaseResults":success→success && qaPhaseResult); thereadyGateResultbranch, theNEEDS_VERIFICATIONbranch, and the failure (in_progress) branch are untouched.grep -n finalStatus src/lib/workflow/batch-executor.tsand confirm every consumer (theupdateIssueStatuscall, the checkpoint-failure warning string) reads the corrected value with no further edits needed. Per the issue comment's own audit: the checkpoint commit (if (success && chainMode && worktreePath)) and PR creation (hasExecChanges-gated since fix(run): phase-restricted runs without an implementing phase must skip PR creation — spec-only batches always report failed #920) already key off chain-mode/commit-evidence rather thanfinalStatusdirectly, so a spec-only run already can't produce a spurious checkpoint or PR — verify this holds, don't add new guards there.qaVerdictbinding at ~line 2342 (used only for the PR body) is unaffected — leave it as its ownconst.Phase 2: Test coverage —
batch-executor.test.tsphases: ["spec"],qualityLoop: false, mock returns success forspeconly → assertupdateIssueStatus.mock.callscontains"in_progress"and not"ready_for_merge"/"awaiting_verification"(AC-1).phases: ["exec"](no qa) with the same assertion — the AC text names this as an explicit example, not just--phases spec.NEEDS_VERIFICATION/READY_FOR_MERGEcases unmodified to confirm AC-3 (no new fixture, just a regression run).Phase 3: Test coverage —
run-orchestrator.test.tsstateManager.getIssueStateto return{ status: "in_progress" }, run with--phases execand no--force, assert the issue is not logged as skipped and is included in the phases actually executed (AC-2). This file currently has zero coverage of the skip guard — it's new, not modified, coverage.Phase 4: PR & housekeeping
CHANGELOG.md: add a### Fixedentry under[Unreleased], per the issue comment's explicit instruction.Closes #1233,Refs #1236(tracker, wave 2).Design Review
batch-executor.ts's hoistedfinalStatuscomputation — the single site the fix(chain): --chain --ready-gate resume re-executes already-gated links (COMPLETED_STATUSES misses waiting_for_human_merge/blocked) #837 comment already made responsible for this decision.run-orchestrator.tsonly reads the persisted status; it needs no change.phaseResults.find(p => p.phase === "qa")(what ran) rather than inferring "qa was requested" fromconfig.phases/options.autoDetectPhases(what was asked for). Rejected: threading a newranQaflag through the function signature — the phase-result list already carries this signal, no new state needed.hasExecChanges, evidence-based rather than phase-list-based) already established "trust what happened, not what was requested" in this same function — this fix is the same convention applied tofinalStatus.isCompletedIssueStatus/COMPLETED_ISSUE_STATUSESinstead?" — because the skip predicate is correct (ready_for_mergeshould mean skip); the bug is that a spec-only run wroteready_for_mergewhen it never validated anything. Fixing the predicate would leave the state file recording a false claim that other consumers (e.g.state-cleanup.ts's merge-detection sweep) also read.Feature Quality Planning
All standard checks pass. Notable items:
## Non-Goalssection in the issue (flagged above) — low risk given the tightly scoped 3-file "May touch" list; not blocking.:838-842,:2813-2839) new cases should sit beside — exec should follow that placement rather than appending at file end, to keep the qa-verdict scenarios grouped.Open Questions
isCompletedIssueStatuspredicate in isolation? Recommendation: the real skip-guard code path inrun-orchestrator.test.ts(per Phase 3 above) — the AC's own wording is behavioral ("sequant run N --phases execruns without--force"), and a predicate-only unit test wouldn't prove the orchestrator path works. Impact if wrong: coverage looks satisfied but doesn't match the AC'sEvidence:clause.batch-executor.ts, not yet started — no live worktree). No conflict today; the issue itself notes fix(pr): sequant run PRs double the conventional prefix in the title and ship a placeholder body #1223 should run after this merges. No action needed now beyond normal file-overlap awareness during exec.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: Issue is explicitly tagged
Tier: mechanical— a single-conjunct ternary fix in one function, with the exact test placement already specified in the issue comment.testgenis deliberately not recommended despite AC-1/AC-2 declaringnpx vitest run <file>evidence (which would normally trigger it per the declared-evidence rule): both evidence commands point at test files that already exist with an established, pinned pattern for this exact scenario family (qa-verdict branching at:2813-2839) — exec should hand-write the two new cases beside that pattern directly rather than going through stub generation for already-patterned code.Label Review
Current:
bug,graph-2026-09-prereleaseRecommended: no changes to domain labels (no UI/frontend surface, not
complex/refactor/breaking— single ternary fix)Reason: Current labels already match the mechanical/bug shape of this fix.
Quality Loop: Won't auto-enable —
SCOPE_OK, mechanical tier, no scope warning.→
gh issue edit 1233 --add-label planned--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
Plan for #1233
AC Checklist
in_progress, notready_for_merge— Integration Test,batch-executor.test.ts--phases exec— Integration Test,run-orchestrator.test.tsqarun still records today's terminal status — Integration Test, existingbatch-executor.test.tsfixtures stay greenFix:
batch-executor.ts:2234-2241— gate theready_for_merge/awaiting_verificationbranch on aqaPhaseResultactually being present inphaseResults, not just onsuccess. One-conjunct change (success→success && qaPhaseResult);readyGateResult, checkpoint-commit, and PR-creation logic are all unaffected (already evidence-gated per #920).Tests: two new cases in
batch-executor.test.ts(spec-only, exec-only) beside the existing qa-verdict block at:2813-2839; one new case inrun-orchestrator.test.tsexercising the non-chain skip guard with a seeded"in_progress"status (currently zero coverage there).Key decision:
testgenskipped despite declared vitest evidence — both target files already have the exact pattern to extend; stub generation would add ceremony, not value, for a mechanical-tier fix.Open questions: test the orchestrator skip-guard path directly (recommended) vs. the predicate in isolation; #1223 coordination noted, not blocking.
Workflow: exec → qa, quality loop disabled.
admarble commentedon Sep 30, 2026
QA Verdict: AC_NOT_MET
AC coverage: 0/1 met
Gaps:
### Fixedentry under[Unreleased], although the issue comment asks for one explicitly.Closes #1233/Refs #1236and no CI.batch-executor.ts:~2284says "#N stays${finalStatus}, so a re-run will skip it." For a chain run without qa,finalStatusis nowin_progress, and a re-run does not skip that. The warning names a real status but predicts the wrong outcome. This is the exact consumer audit the issue comment asked for (the fix(chain): --chain --ready-gate resume re-executes already-gated links (COMPLETED_STATUSES misses waiting_for_human_merge/blocked) #837 class).Suggestions:
toContain("in_progress")passes trivially if status is set toin_progressat the start of the run. Thenot.toContain("ready_for_merge")assertions are the ones that actually tell the fixed and broken code apart.admarble commentedon Sep 30, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 3/5 met
Gaps:
Suggestions:
batch-executor.ts:~2261-2273still says that "a completed status was already written above … so a re-run reads this link as a completed prefix". After this change that's only true when qa ran. The comment should mention thein_progresscase.chain-resume.ts:112-123), so if an earlier link is alsoin_progressit resumes there. This is a wording nit.--resumerun that skips an earlier, completed qa now recordsin_progress. That's the safe direction and it's documented in the CHANGELOG and the code comment, but no test covers it.test(#1233): cover the --resume case; checkpoint comment and warning …
test(#1233): name the warning test for its current wording
admarble commentedon Sep 30, 2026
QA Verdict: NEEDS_VERIFICATION
AC coverage: 3/3 met
Gaps:
batch-executor.ts:2268: the reflowed comment line runs past about 150 characters. Its next sentence, "Its uncommitted work is therefore absent … whichcomputeChainResumePlandetects", now follows thein_progresssentence. But the dirty-worktree fail-fast only applies to the completed-prefix case, so "therefore" now points at the wrong status. Only the comment is affected; the code is correct.docs(#1233): checkpoint comment separates the completed and in_progre…
test(#1233): #817 ready-gate standard-status tests run a qa phase
fix(#1223): a bug(scope): issue title becomes fix(#N):, not a doubled…