Repository navigation
Description
Problem
When running multiple issues without --sequential, the code labels itself as the default/parallel path but executes serially:
// src/commands/run.ts:700-703
} else {
// Default mode: run issues serially but continue on failure (don't stop)
// TODO: Add proper parallel execution with listr2
for (const issueNumber of issueNumbers) {This is a for...of loop with await — it runs one issue at a time, sequentially. The difference from --sequential is only that this mode continues on failure instead of stopping.
User expectation vs reality
sequant run 100 101 102 # User expects parallelism — gets serial
sequant run 100 101 --sequential # Explicitly serial — same behavior, but stops on failureThere is no way to actually run issues in parallel today.
Why it matters
Parallel execution is a key value proposition for multi-issue workflows. Each issue runs in its own worktree, so true parallelism (or at least concurrency via Promise.all / Promise.allSettled) is architecturally feasible. The current behavior wastes wall-clock time linearly with issue count.
Acceptance Criteria
- Default mode runs issues concurrently (not sequentially) when multiple issues are provided
- Concurrency limit is configurable (e.g.,
--concurrency N, default 3 or CPU-count based) - Each issue's output is isolated — logs don't interleave in terminal (consider listr2, or buffered output per issue)
- Failure in one issue does not stop others (current continue-on-failure semantics preserved)
-
--sequentialflag continues to work as today (serial, stop on failure) - Progress indication shows which issues are running, completed, failed
- Shutdown (Ctrl-C) gracefully stops all running issues, not just the current one
- Log writer correctly handles concurrent issue logging
Design Considerations
Option A: Promise.allSettled with concurrency limiter
Simple, no new deps. Use p-limit or manual semaphore. Output buffered per issue, printed on completion.
Option B: listr2 (as the TODO suggests)
Provides concurrent task rendering with spinners per issue. Heavier dependency but better UX.
Option C: Worker threads
Overkill — the bottleneck is the spawned agent process, not CPU. Promise.allSettled is sufficient.
Key constraint
Each issue already gets its own worktree (created at run.ts:515-565). The LogWriter, StateManager, and ShutdownManager need to be either thread-safe or per-issue instances. Currently they're shared — this needs design attention.
Files in Scope
src/commands/run.ts— default execution path (lines 700-747)src/lib/workflow/batch-executor.ts— may need concurrent-awareexecuteBatchsrc/lib/workflow/log-writer.ts— concurrent loggingsrc/lib/shutdown.ts— multi-process shutdown coordination
Activity
admarble commentedon Mar 24, 2026
Spec Plan — Issue #404: Default execution mode is serial despite being labeled parallel
AC Quality Check
--concurrency Nflag--sequentialunchangedSummary: 6/8 clear. AC-3 and AC-6 have UX ambiguity but don't block planning.
Scope Assessment
Verdict:⚠️ SCOPE_WARNING — Single feature, but 8 AC items and 4-directory spread. Manageable since all changes serve one feature. Quality loop auto-enabled.
Non-Goals:
Conflict Risk Analysis
src/commands/run.tsAcceptance Criteria with Verification
AC-1: Default mode runs issues concurrently
--sequentialsequant run 100 101 102AC-2: Concurrency limit configurable
--concurrency 2with 4 issuesAC-3: Output isolation
AC-4: Failure isolation
AC-5:
--sequentialunchanged--sequential, issue feat: Complete remaining v1.0 features (AC-10, AC-13, AC-14) #1 failsAC-6: Progress indication
Running: #100 ✓, #101 ⏳, #102 ⏳).AC-7: Graceful shutdown
AC-8: Log writer concurrent handling
Implementation Plan
Phase 1: Infrastructure
p-limitdependency (lightweight concurrency limiter)--concurrency <n>option tobin/cli.ts,RunOptions,ExecutionConfigforceParallelfield fromExecutionConfigPhase 2: LogWriter concurrency
4. Refactor
LogWriter— replace singlecurrentIssueslot withMap<number, Partial<IssueLog>>. UpdatestartIssue(),logPhase(),setPRInfo(),completeIssue()to take issue number.Phase 3: Parallel execution
5. Replace
for...ofloop (run.ts:700-748) withPromise.allSettled()+p-limitwrapper6. Per-issue
AbortControllerregistered with sharedShutdownManagerPhase 4: Progress
7. Use
ora(existing dep) with updating spinner text showing aggregate issue statusFeature Quality Planning
concurrencyin RunOptions + ExecutionConfig, removeforceParallelDerived ACs:
--concurrencyvalues produce clear errorforceParallelfrom ExecutionConfigOpen Questions
Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: enabled (scope warning: 8 AC, 4 directories)
Labels: Add
complex→gh issue edit 404 --add-label complexadmarble commentedon Mar 24, 2026
Test Stubs Generated
Unit Test Stubs
File:
__tests__/parallel-execution.test.tsIntegration Test Stubs
File:
__tests__/integration/parallel-execution.integration.test.tsManual Test Scenarios (AC-6: Progress indication)
Prerequisites:
Test Steps:
sequant run 100 101 102(no flags)Expected:
Running: #100 ✓, #101 ⏳, #102 ⏳)Next steps:
throw new Error(...)with actual test logic)/exec 404to implement the featurenpm testGenerated with Claude Code
feat(#404): parallel execution as default mode for multi-issue runs
admarble commentedon Mar 24, 2026
Exec Phase — Progress Update
AC Coverage
--sequentialunchangedforceParallelKey Files Changed
src/commands/run.ts— Parallel execution withPromise.allSettled+p-limit, progress indicator, concurrency validationsrc/lib/workflow/log-writer.ts— Map-based concurrent issue trackingsrc/lib/workflow/types.ts—concurrencyfield replacesforceParallelsrc/lib/workflow/batch-executor.ts—concurrencyinRunOptionssrc/lib/settings.ts—concurrencyinRunSettingsbin/cli.ts—--concurrency <n>CLI flagQuality Checks
npm run buildnpm run lintnpm testPR
Created: #419
Quality Plan Alignment: N/A — No quality plan in issue beyond spec-level planning
admarble commentedon Mar 24, 2026
QA Review for Issue #404
AC Coverage
Promise.allSettled+p-limitreplaces serialfor...ofloop--concurrency <n>registered in CLI, validated, default 3\rin-place updatePromise.allSettledcaptures all results regardless of individual failures--sequentialunchanged#N ✓,#N ✗,#N ⏳shutdown.shuttingDownchecked before each issue; cleanup registeredMap<number, Partial<IssueLog>>replaces single-slotcurrentIssue< 1and non-integer rejected with clear error messageforceParallelconcurrencyreplaces itCoverage: 10/10 AC items fully met
Original ACs: 8/8 met
Derived ACs: 2/2 met
Quality Plan Verification
N/A — No quality plan found in issue comments (spec-level planning only)
CI Status
build (20.x)build (22.x)typecheckvalidate-skillsvalidate-pluginCI Summary: 5 passed, 0 pending, 0 failed
Quality Metrics
any)Build Verification
N/A — Build passed (
npm run buildexits cleanly)Test Coverage Analysis
src/commands/run.tssrc/commands/run.test.ts,__tests__/integration/parallel-execution.integration.test.tssrc/lib/workflow/log-writer.tssrc/lib/workflow/log-writer.test.ts,__tests__/parallel-execution.test.tssrc/lib/workflow/types.ts__tests__/parallel-execution.test.tssrc/lib/workflow/batch-executor.tssrc/lib/settings.tsbin/cli.tsCoverage: 4/6 changed source files have direct tests; remaining 2 covered indirectly
Critical paths without tests: None
Code Review
Strengths:
Promise.allSettled+p-limitis the right choice — simple, no new heavy depscurrentIssuekept as deprecated fallback in LogWriter for existing callers--quietflag and TTY detectionIssues:
Suggestions:
rejectedbranch insettledResultsprocessing (line 821) setsissueNumber: 0— this shouldn't happen in practice (as noted in comment), but could confuse log analysis if it ever does. Not blocking.Test Quality Review
runIssueWithLogging, not internalsTest failure note:
state-utils.test.tstimeout is pre-existing on main — not a regression.Anti-Pattern Detection
Dependency Audit
p-limit@7Code Patterns
No anti-patterns detected in changed files.
Call-Site Review
New exported functions detected: 0 (changes are to existing functions)
N/A — No new exported functions.
startIssue,logPhase,setPRInfo,completeIssuewere modified (not added).Execution Evidence
N/A — No script files changed. CLI change is
--concurrencyflag addition, verified via build + test suite.CLI Registration Verification
Option files modified: Yes (
batch-executor.tsRunOptions,bin/cli.ts)concurrencymergedOptions.concurrency(run.ts:157,247-249,309)--concurrency <n>in bin/cli.ts:218Verification Status: Passed
Smoke Test
Not Required — No workflow-affecting changes (skills, scripts). Core execution path changes covered by 22 new tests.
CHANGELOG Verification
Result: CHANGELOG requirements met
Self-Evaluation
issueNumber: 0in the rejected-promise fallback could confuse log analysis, butrunIssueWithLoggingcatches all errors so this path is effectively unreachableVerdict: READY_FOR_MERGE
All 10 AC items met. Implementation uses correct concurrency primitives (
Promise.allSettled+p-limit), maintains backward compatibility (sequential path unchanged, LogWritercurrentIssuedeprecated but retained), and has thorough test coverage (22 new tests). CI all green.Documentation
--concurrencyis documented in--helpoutput)Next Steps
issueNumber: 0fallback in the rejected-promise handler to extract the actual issue number from the error contextQA completed: READY_FOR_MERGE
admarble commentedon Mar 24, 2026
QA Review for Issue #404
AC Coverage
Promise.allSettled+p-limitreplaces serialfor...ofloop--concurrency <n>wired through CLI → settings → config →pLimit()PhaseSpinner(ora), andrunIssueWithLoggingcallsconsole.logdirectly. Multiple ora spinners competing for stdout produces garbled output.Promise.allSettledcaptures all results regardless of individual failures--sequentialunchanged#N ✓,#N ✗,#N ⏳shutdown.shuttingDownflag is shared and checked before each issue starts. Bug:ShutdownManagerhas a singleabortControllerslot (shutdown.ts:61). Each concurrentexecutePhasecall overwrites it (phase-executor.ts:233). On Ctrl-C, only the last-started issue's abort controller fires — others continue until phase timeout or nextshuttingDowncheck.Map<number, Partial<IssueLog>>replaces single-slotcurrentIssue< 1and non-integer rejected with clear error messageforceParallelconcurrencyreplaces itCoverage: 8/10 AC items fully met
Original ACs: 6/8 met
Derived ACs: 2/2 met
Quality Plan Verification
Quality plan found in spec comment.
Derived ACs: 2/2 addressed
Quality Plan Status: Partial
CI Status
build (20.x)build (22.x)typecheckvalidate-pluginvalidate-skillsCI Summary: 5 passed, 0 pending, 0 failed
Quality Metrics
any)Build Verification
N/A — Build passed
Test Coverage Analysis
src/commands/run.tssrc/commands/run.test.ts,__tests__/integration/parallel-execution.integration.test.tssrc/lib/workflow/log-writer.tssrc/lib/workflow/log-writer.test.ts,__tests__/parallel-execution.test.tssrc/lib/workflow/types.ts__tests__/parallel-execution.test.tssrc/lib/workflow/batch-executor.tssrc/lib/settings.tsbin/cli.tsCoverage: 4/6 direct, 2/6 indirect
Critical paths without tests: None
Code Review
Strengths:
Promise.allSettled+p-limitis simple and sufficientcurrentIssuekept for existing callers)--quietand TTY detectionIssues:
Terminal output interleaving (AC-3):
runIssueWithLogging(batch-executor.ts:392+) does directconsole.logcalls per issue, and each createsPhaseSpinner(ora) instances. Concurrent ora spinners writing\rto the same terminal line = garbled output. Fix: Either (a) suppress spinners in parallel mode and rely on the progress indicator, or (b) buffer console output per issue and print on completion, or (c) adopt listr2 for concurrent task rendering.Single abort controller in ShutdownManager (AC-7):
ShutdownManager.abortControlleris a single slot (shutdown.ts:61). EachexecutePhasecall doesshutdownManager.setAbortController(abortController)(phase-executor.ts:233), overwriting previous issues' controllers. On SIGINT, only the last-registered controller fires. Fix: Change toSet<AbortController>orMap<number, AbortController>keyed by issue number, and abort all on shutdown.Minor:
issueNumber: 0fallback (run.ts:821-826): The rejected-promise handler setsissueNumber: 0which could confuse log analysis. While unreachable in practice (sincerunIssueWithLoggingcatches errors internally), it could be improved by extracting the issue number from the settled result's index.Suggestions:
Test Quality Review
runIssueWithLoggingNote: Tests don't cover terminal output interleaving (AC-3 gap) or multi-abort-controller shutdown (AC-7 gap).
Anti-Pattern Detection
Dependency Audit
[email protected]Code Patterns
No anti-patterns detected.
Call-Site Review
N/A — No new exported functions (existing functions modified to accept optional
issueNumberparameter).Execution Evidence
N/A — No script files changed. CLI
--concurrencyflag verified via build + test suite.CLI Registration Verification
Option files modified: Yes
concurrencymergedOptions.concurrency(run.ts:157,247,309)--concurrency <n>in bin/cli.ts:218Verification Status: Passed
CHANGELOG Verification
Result: CHANGELOG requirements met
Self-Evaluation
Verdict: AC_NOT_MET
Two AC items are partially met:
AC-3 (Output isolation): Terminal output interleaves because concurrent issues each create their own
PhaseSpinner(ora) and do directconsole.logcalls. Log file isolation works correctly.AC-7 (Graceful shutdown):
ShutdownManagerhas a singleabortControllerslot. With N concurrent issues, only the last-started issue gets properly aborted on Ctrl-C. The other N-1 issues continue until their nextshuttingDownflag check or phase timeout.Documentation
Next Steps
PhaseSpinner(ora) in parallel mode — rely on theupdateProgressstatus line instead. Alternatively, bufferconsole.logoutput per issue and flush on completion.ShutdownManager.abortControllerfrom single slot toSet<AbortController>. Register/unregister per-issue controllers. On shutdown, abort all controllers in the set./qa 404after fixes.QA completed: AC_NOT_MET — 2 gaps identified
fix(#404): resolve terminal output interleaving and concurrent shutdo…
fix(#404): per-issue completion summaries and issueNumber fallback fix
admarble commentedon Mar 25, 2026
Documentation Generated
File:
docs/features/parallel-execution.mdSections Included:
--concurrencyReference — parameter table with validationNext Steps:
Ready to merge!
docs(#404): add parallel execution feature documentation
feat(#404): parallel execution as default mode for multi-issue runs
fix(#404): resolve terminal output interleaving and concurrent shutdo…
fix(#404): per-issue completion summaries and issueNumber fallback fix
docs(#404): add parallel execution feature documentation
fix(#404): resolve lint warning for unused parameter in parallel log …
feat(#404): parallel execution as default mode for multi-issue runs (#…