Repository navigation
Description
Context
sequant run --chain validates flag combinations only (run.ts: --stacked/--no-chain, --chain/--batch, etc.); there is zero content-level validation of the issues being chained. Issues run in the order given on the CLI with no check that the order matches actual dependencies, that the issues have acceptance criteria at all, or that declared blockers ("blocked by #N") are consistent with the chain order. The #133 incident (chain 114 → 116: QA fixes on the predecessor invalidated the already-built successor) is the historical example of the class this catches cheapest at the front door.
Most of the machinery already exists: src/lib/assess-collision-detect.ts does pairwise file-overlap prediction and ordering for /assess, and /assess's chain detection already parses "depends on #N" / "blocked by #N" markers.
Proposal
A fast pre-flight at chain start, warn-by-default (the #604 philosophy: suggest, never auto-decide — false dependency inference is worse than none):
- Each issue exists, is open, and has a non-empty Acceptance Criteria section (warn if missing).
- Declared dependency markers ("blocked by #N", "depends on #N") in issue bodies are checked against the CLI order; warn on contradiction (e.g.
run 39 38 --chainwhen feat: Add MCP browser testing patterns reference #39 says blocked by feat: Create framework gotchas reference #38). - Predicted file-overlap ordering (reuse
detectFileCollisions) is compared against the CLI order; warn on mismatch. - Warnings print before the first worktree is provisioned; a
--strict-preflight(or similar) opt-in turns warnings into a hard stop. Naming/UX is /spec's call.
Acceptance Criteria
-
--chainruns print pre-flight warnings for: missing/empty AC section, CLI order contradicting declared dependency markers, CLI order contradicting predicted file-overlap order. - Warnings never block by default; an opt-in flag makes them fatal before any worktree is provisioned.
- Pre-flight reuses
assess-collision-detectrather than reimplementing overlap prediction; no new heuristics beyond what /assess already does. - Runs a closed/merged-issue check consistent with the existing fix: pre-flight state guard and worktree lifecycle management #305 guard (and notes the fix(run): pre-flight guard misses in_progress issues already merged on GitHub (gap in #305/#423) #592 in_progress-but-merged gap if not fixed by then).
- Unit tests cover each warning against verbatim issue-body fixtures (real markers like "Blocked by feat(#26): Add PR verification to /exec skill #36", not synthetic combined fixtures).
Out of scope
Spec-completeness scoring or any LLM-based judgment of issue quality; auto-reordering the chain; blocking on unmerged predecessor PRs (chains intentionally branch from local committed work).
References
- Chain mode: Add QA gate option to prevent stale downstream issues #133 / PR feat(#133): add --qa-gate option for chain mode #136 — the downstream-staleness incident this class of check front-loads
docs/reference/chain-mode-analysis-2026-05.md(investigate(metrics): chain mode 29% success rate vs 92% single-issue — failure forensics #604) — 0/5 recorded failures were content-caused; hence warn-only defaultsrc/lib/assess-collision-detect.ts— existing overlap/order machinery to reuse
Activity
admarble commentedon Jul 15, 2026
Complexity: Standard (5 ACs, ~3 directories)
AC Quality Check
All 5 ACs are measurable and reference concrete, verifiable markers (
"Blocked by #36", "missing/empty AC section", opt-in fatal flag). No vague/unmeasurable language. One soft spot: AC-4 hedges ("notes the #592 in_progress-but-merged gap if not fixed by then") — acceptable, it's a doc-note escape hatch, not an unbounded scope.Scope Assessment
Non-Goals: ✅ Present ("Out of scope": spec-completeness scoring, LLM judgment, auto-reordering, blocking on unmerged predecessor PRs).
src/lib/workflow,bin/, testsVerdict: ✅ SCOPE_OK — tightly scoped, warn-only, reuses existing machinery.
Acceptance Criteria
AC-1:
--chainruns print pre-flight warnings (missing/empty AC · dep-marker contradiction · file-overlap mismatch)Verification: Unit Test
Scenario: Given three chained issue bodies (one lacking an AC section, one with
Blocked by #Ncontradicting CLI order, one sharing a file target) → When the pre-flight runs → Then it returns exactly three warnings, one per class.Assumptions: Warnings are computed by a pure function over fetched issue bodies so they're unit-testable without a live run.
AC-2: Warnings never block by default; opt-in flag makes them fatal before any worktree is provisioned
Verification: Unit + Integration
Scenario: Given contradicting issues → When run without the flag → Then run proceeds (non-zero warnings, zero exit); When run with
--strict-preflight→ Then it exits beforeensureWorktreesChainis called.Assumptions: Pre-flight is invoked in
RunOrchestrator.run()upstream of the worktree-provisioning block (~run-orchestrator.ts:764).AC-3: Reuses
assess-collision-detectfor overlap prediction — no new heuristicsVerification: Unit Test + code inspection
Scenario: Given issue bodies naming shared files → When predicting overlap order → Then it calls
extractPathsFromIssueBody+detectFileCollisions(not a reimplementation).Assumptions:
detectFileCollisionsreturns per-fileissues[]in ascending order; pre-flight compares that predicted order to CLI order.AC-4: Closed/merged-issue check consistent with the existing #305 guard (+ note #592 gap)
Verification: Unit Test
Scenario: Given a chained issue that is CLOSED on GitHub → When pre-flight runs → Then it warns, matching the semantics of the
ready_for_merge/mergedstate guard (run-orchestrator.ts:636–684) andreconcileStateAtStartup.Assumptions: Pre-flight fetches
statealongsidebodyin the samegh issue viewcall; the #592 in_progress-but-merged gap is documented, not fixed here.AC-5: Unit tests cover each warning against verbatim issue-body fixtures
Verification: Unit Test (meta)
Scenario: Given real marker strings copied verbatim (
Blocked by #36, real AC headers) → When each warning path is tested individually → Then no synthetic combined fixture is used (perfeedback_synthetic_test_fixture_trap).Implementation Plan
Phase 1: Pre-flight module (
src/lib/workflow/chain-preflight.ts)runChainPreflight(cliOrderedIssues: number[]): Promise<PreflightWarning[]>— fetchbody,state,titlefor each issue in onegh issue view … --jsoncall per issue (or batched), then compute warnings.hasAcceptanceCriteria(body)fromac-parser.ts; warn on false.blocked by #Nanddepends on #N.parseDependencies(batch-executor.ts:199) matches only "depends on" — extend it or add a sibling marker parser soBlocked by #N(the issue's own motivating example) is caught. Warn when a declared blocker appears after the issue in CLI order.Map<number, Set<string>>viaextractPathsFromIssueBody, calldetectFileCollisions, warn when predicted per-file order ≠ CLI order (AC-3).state === "CLOSED"(AC-4).Phase 2: Orchestrator wiring (
run-orchestrator.ts)run()guarded bymergedOptions.chain, before the worktree block (~line 754–764). Print warnings viachalk.yellow/bracketedConsoleLog.mergedOptions.strictPreflightand warnings exist → print, dispose shutdown, return early withexitCode: 1beforeensureWorktreesChain.issueNumbers— see Open Questions feat: Complete remaining v1.0 features (AC-10, AC-13, AC-14) #1.Phase 3: CLI + types
strictPreflight?: booleantoRunOptions(types.ts) and register.option("--strict-preflight", …)inbin/cli.ts— the CLI-wiring gap won't be caught by tsc/build/tests.Phase 4: Tests
chain-preflight.test.ts— one test per warning class against verbatim fixtures; assert warn-only vs--strict-preflightfatal.Design Review
chain-preflight.tsinsrc/lib/workflow/(fetch + compute), invoked once fromRunOrchestrator.run(). Keeps orchestrator lean and the warning logic unit-testable.hasAcceptanceCriteria,detectFileCollisions, marker regex). Rejected: a scoring/severity system (out of scope, investigate(metrics): chain mode 29% success rate vs 92% single-issue — failure forensics #604 says warn-only).logNonFatalWarning, theready_for_mergeskip block) and/assess's collision annotations — same⚠ #Nphrasing for consistency.getIssueInfoalready runs?" — becausegetIssueInfofetches onlytitle,labels; pre-flight needsbody,state. Consolidating both into one fetch is a reasonable optional optimization but adds coupling; flag as follow-up, don't force it.Feature Quality Planning
All standard checks pass. Notable items:
sortByDependenciesruns duringresolveConfig(run-orchestrator.ts:504) and silently reorders "depends on" chains. If the pre-flight compares against the post-sortissueNumbers, it can never surface a "depends on" contradiction — the sorter already fixed it. The pre-flight MUST receive the rawissueArgsorder. (Open Question feat: Complete remaining v1.0 features (AC-10, AC-13, AC-14) #1.)parseDependenciesignores "blocked by" — the exact phrase in the AC-2 example. Extend it once, reused by both the sorter and pre-flight, to avoid drift (feedback_sibling_scan_includes_prose).ghfailure handling: ifgh issue viewfails for an issue, warn-degrade (skip that check) rather than abort — pre-flight must never be the thing that breaks a run.Derived ACs (if any)
run 39 38 --chainwhere #39 depends-on #38 still warns)Rule Touchpoints
The behavior-rule detector fired on AC-2 (keywords
default,never), but all returned touchpoints are false positives (the detector's own source + unrelated Zod.default()calls). This is a new rule with no pre-existing runtime duplicate — the "warn-by-default, opt-in fatal" behavior lives entirely in the new module + CLI flag. No touchpoint table needed; just ensure the flag semantics live in exactly one place.Open Questions
issueArgs-parsed order into the pre-flight. Impact if wrong: the file-overlap and depends-on contradiction checks become dead code (the sorter pre-fixes them), silently passing AC-1/AC-3 while catching nothing.--strict-preflight(issue says naming is /spec's call). Alternatives:--preflight-strict,--fail-on-warnings. Impact: cosmetic; pick one and register it inbin/cli.ts.blocked byinsortByDependenciestoo? — Recommendation: extendparseDependenciesto includeblocked by, which also improves the sorter. Impact: behavior change to auto-ordering — keep warn-only for now if we want to avoid touching sort semantics; flag as a deliberate decision.Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: disabled (SCOPE_OK, no complex/refactor label)
Reasoning: AC-1/AC-3/AC-4 are Unit-Test-verifiable pure logic and AC-5 mandates unit tests →
testgenstubs the fixtures before implementation. No UI → notestphase. Not security-sensitive → nosecurity-review.Label Review
Current:
enhancement,cliRecommended: keep
enhancement,cli; addplannedReason: Scope is green and single-feature; no
complex/breakingwarranted.cliis accurate (new--chainsub-behavior + flag).Quality Loop: Won't auto-enable — scope is SCOPE_OK, not SCOPE_WARNING.
--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
Plan — content pre-flight for
--chain(warn-by-default)--strict-preflightmakes them fatal before any worktree is provisioned. (Unit + Integration)extractPathsFromIssueBody+detectFileCollisions— no new overlap heuristics. (Unit + inspection)Blocked by #N, not synthetic combined). (Unit)Build: new
src/lib/workflow/chain-preflight.ts(fetchbody,state→ compute warning list) → invoke inRunOrchestrator.run()before worktree provisioning → addstrictPreflighttoRunOptions+.option()inbin/cli.ts.Two things that will bite if missed:
issueNumbers—sortByDependenciesalready reorders "depends on" chains during config resolution, so comparing post-sort catches nothing.parseDependenciesonly matches "depends on" — extend it to also catchblocked by #N(the AC-2 example) so the dependency-contradiction check actually fires.Reuses:
hasAcceptanceCriteria(ac-parser),detectFileCollisions(assess-collision-detect), theready_for_merge/mergedguard semantics. Warn-degrade onghfailure. Suggested phases: spec → testgen → exec → qa.admarble commentedon Jul 15, 2026
Exec Progress — content pre-flight for
--chain(#762)Implemented, PR up: #764.
AC Coverage
--strict-preflightfatal before any worktree provisionedassess-collision-detect— no new heuristicsrun 39 38 --chainstill warns)Key files
src/lib/workflow/chain-preflight.ts(new) — purecomputePreflightWarnings+ghfetch inrunChainPreflight; warn-degrades on fetch failure.src/lib/workflow/run-orchestrator.ts— invoke inrun()before worktree setup; newResolvedRun.rawIssueOrderthreads the raw CLI order pastsortByDependencies.src/lib/workflow/types.ts+bin/cli.ts—strictPreflight/--strict-preflight.src/lib/workflow/chain-preflight.test.ts(new) — 17 tests.Quality Plan Alignment
issueArgsorder; regression test at[39, 38]parseDeclaredBlockerscatches bothdepends onandblocked by; kept local so sorter semantics are untouched (Open Q #3 → warn-only for now)ghfailure handlinghasNonEmptyAcSectionextendshasAcceptanceCriteriato also accept bare-checkbox AC sections (e.g. this issue's own body) — avoids false "missing AC" warningsChecks
npm run build✅ ·npm run lint✅ (0 warnings) ·npx vitest run src/lib/workflow/✅ 976 pass / 2 skip · new suite ✅ 17 pass ·run --helpshows--strict-preflight✅Known gap
ensureWorktreesChainis verified by code inspection + type-check, not a fullrun()integration test (no orchestrator run-harness withgh/state/worktree mocking exists; building one would be brittle for marginal value). Pure warning computation is fully unit-tested.admarble commentedon Jul 15, 2026
QA Review — content pre-flight for
--chain(#762) · PR #764Verdict: AC_MET_BUT_NOT_A_PLUS — all 6 ACs met, CI green, mergeable clean. Two non-blocking improvements below.
AC Coverage
run-orchestrator.ts:766-805, upstream of the worktree block;--strict-preflightregistered inbin/cli.tsand confirmed inrun --helpextractPathsFromIssueBody+detectFileCollisions; no reimplemented overlap heuristicsResolvedRun.rawIssueOrderthreads raw CLI order pastsortByDependencies;[39, 38]regression test presentCoverage: 6/6 met. CI: 5/5 pass. Type issues: 0. Deleted tests: 0. Diff: +593 / -0 across 6 files.
Verified, not assumed
detectFileCollisionsexplicitly re-sorts[...issues].sort((a,b) => a-b)(assess-collision-detect.ts:208), socollision.issuesis genuinely ascending rather than Map-insertion order. Had it preserved insertion order,issuePathsis built incliOrderorder and the contradiction check would have compared CLI order against itself and never fired. The code comment's claim holds.formatCollisionAnnotationsrendersOrder: A → BandChain: npx sequant run <ascending ids> --chainoff the same ascending array, so the pre-flight warns exactly when CLI order deviates from what /assess itself would recommend. Faithful reuse per AC-3.run()that fires with locks held, andShutdownManager.dispose()(shutdown.ts) discards cleanup tasks rather than running them — so the registered "Release issue locks" task never runs. Locks are still released, but only via theprocess.on("exit")safety net, which survives because its detach task is discarded too. Correct by a two-step accident rather than by design; worth a comment if this path grows.Issue 1 — prose mentions parse as real blockers (
--strict-preflightinteraction)parseDeclaredBlockersstrips fenced code and HTML comments but still matches the marker anywhere in prose. Run against its own issue body:Neither is real. They come from #762's own prose:
...(e.g. `run 39 38 --chain` when #39 says blocked by #38)— an example...real markers like "Blocked by #36"...— AC-5's own text naming a markerSo
sequant run 762 38 --chainwould print a bogus "blocked by #38" warning. Two mitigating facts: the existingparseDependencies(batch-executor.ts:215) is equally unanchored and actually reorders the chain on it, so this is an inherited class, not a new one; and warn-only default makes it noise rather than breakage.The concern is the
--strict-preflightinteraction: under the new flag a spurious warning becomes a hard abort on a legitimate chain, with no override but dropping the flag. That's in tension with the philosophy the module's own docblock quotes ("false dependency inference is worse than none"). A line-anchored match (marker at line start / list-item start) would fix both hits, but would break the mid-line"This is Blocked by #38 until it lands."test — so it's a deliberate call, not a drive-by.Note the file-overlap check has the same shape of false positive — real
[762, 760, 761]warns because all three citedocs/reference/chain-mode-analysis-2026-05.mdrather than modify it. That one is inherited fromextractPathsFromIssueBodyand AC-3 mandates reusing it, so it's out of scope here.Issue 2 — flag undocumented outside
--help--strict-preflightis in CHANGELOG andrun --help, but the two places every comparable run flag lives don't mention it:docs/reference/run-command.md:55— flag table (has--qa-gate)docs/reference/cheat-sheet.md:126— flag table (has--qa-gate)No documentation AC in #762, so this isn't an AC miss — but it's a one-row-each fix.
Test quality
Behavior-asserting, verbatim markers, one class per test with a separate three-at-once test for AC-1's scenario — correct structure, avoids the synthetic-combined-fixture trap. Two nits:
BARE_CHECKBOX_AC_BODYis commented "copied verbatim from #762" but is an abridged paraphrase; and no test covers the prose false positive above (adding one would lock in current behavior — worth doing only alongside a decision on Issue 1).Self-Evaluation
--strict-preflightinrun --help, and executed the detector against five real issue bodies. The false positive came from that dogfood run, not from reading.--strict-preflight, hits a prose false positive on a legitimate chain, and abandons the flag.Next Steps
--strict-preflightcaveat.--strict-preflightto the two flag tables.AC_MET_BUT_NOT_A_PLUSproceeds to PR rather than the quality loop.fix(#762): anchor blocker markers to line start; document --strict-pr…
admarble commentedon Jul 15, 2026
QA Gap Fixes — both items resolved (
9b984da)Both improvements from the QA review above are fixed in PR #764.
1. Prose mentions no longer parse as blockers
BLOCKER_MARKER_REGEXis now anchored to line start (still allowing list-item and bold forms), inline code spans are stripped alongside fences and HTML comments, and the#is required soBlocked by 5 days of reviewcan't parse as issue #5.Rationale: a declaration is a line about the issue's own dependencies; prose that merely mentions the marker mid-sentence is not. This deliberately diverges from
batch-executor.ts:parseDependencies, which stays unanchored — the pre-flight parser is local by design (Open Q #3).Verified against the real issue corpus, not just fixtures — scanning 40 real issues that mention a marker:
- Blocked by: #107 (symlinks improvement)[107]- Depends on #187 (project name detection...)[187]- Depends on: #219 being merged first[219]**Depends on**: #10inside a```markdownfence[][][38, 36])#31 is the interesting one: it looks like a true-positive regression from a raw-body grep, but the marker sits inside a fenced block as an example of the format — so ignoring it is right. Anchoring cost no real declarations.
2.
--strict-preflightdocumentedAdded to the two flag tables that list every comparable run flag:
docs/reference/run-command.md:56docs/reference/cheat-sheet.md:127CHANGELOG updated to describe the line-anchored matching.
Also addressed
The
BARE_CHECKBOX_AC_BODYcomment claimed "copied verbatim from #762" for what is an abridged paraphrase — corrected to "the shape of #762's issue, abridged."Checks
npx vitest run src/lib/workflow/→ 980 pass / 2 skip (42 files) ·npm run lint→ clean (0 warnings) ·npm run build→ clean · pre-flight suite 21 pass (4 new, including a regression test built from #762's two verbatim prose lines).Two of the new tests replace cases that encoded the mid-line matching being fixed (
"This is Blocked by #38 until it lands."), rewritten to line-anchored form.Verdict: unchanged at AC_MET_BUT_NOT_A_PLUS → now READY_FOR_MERGE pending CI green on
9b984da. Both open items are closed; no AC status changed (all 6 were already met).feat(#762): lightweight content pre-flight for --chain (#764)
docs(#762): explain the chain content pre-flight (#768)
fix(#766): summary reason tracks the last attempt; cover the loop-log…
fix(#766): recovered phase failure no longer reports failed (#772)
fix(#769): section-aware path extraction; drop background-only citati…
chore(assess): sync chain flag references and add chain-resume rule (#…
fix(#769): section-aware path extraction; drop background-only citations
feat(#762): lightweight content pre-flight for --chain
fix(#762): anchor blocker markers to line start; document --strict-pr…