Repository navigation
Open
Labels
backlogDeferred until user traction (100+ WAU)enhancementNew feature or requestroadmapFuture plans and roadmap items
Description
Problem (User Impact)
Users running sequant run 100 101 102 --concurrency 3 expect three issues to execute in parallel. In practice, spawnSync calls in github.ts, worktree-manager.ts, and batch-executor.ts block the Node.js event loop — meaning "parallel" execution serializes whenever any issue hits a git or GitHub CLI call. A slow gh issue view (common with GitHub rate limiting) freezes all concurrent issues, not just the one making the call.
Additionally, each issue triggers individual gh CLI invocations for metadata, comments, PR status, and labels. With 10 issues, that's 30-40 sequential subprocess calls before any real work begins.
Why Now
- Parallel execution is Sequant's primary performance feature — it's half-broken without async I/O
- The
p-limit(3)concurrency control inrun.ts:812is correct but ineffective when subprocess calls block the event loop - Commander.js has supported async action handlers since v5 — the "sync callers need sync APIs" constraint that created
fetchIssueCommentBodiesSync()andgetPRStatusSync()no longer applies - arch: extract RunOrchestrator — decouple execution engine from CLI wiring #503 (RunOrchestrator) creates a clean async boundary — this issue migrates the internals to match
Acceptance Criteria
Async Subprocess Migration
- AC-1: All
spawnSync/execSynccalls insrc/lib/workflow/replaced with async equivalents. Useexeca(v7+) or a typed async wrapper aroundchild_process.spawn - AC-2:
GitHubProvider(src/lib/workflow/platforms/github.ts) — all sync methods (fetchIssueCommentBodiesSync,getPRStatusSync,checkAuthSync,listClosedIssuesSync) converted to async. Sync variants removed - AC-3: All callers of removed sync methods migrated to async (phase-detection.ts, pr-status.ts, doctor.ts, batch-executor.ts)
- AC-4:
WorktreeManager— git operations (git worktree add,git checkout,git rebase,git diff) use async subprocess execution
GitHub Query Batching
- AC-5: New
batchFetchIssues(issueNumbers: number[])method onGitHubProviderthat fetches metadata for N issues in a singlegh api graphqlcall (title, labels, body, comments with phase markers) - AC-6:
batch-executor.tsusesbatchFetchIssues()at batch start instead of per-issuegetIssueInfo()calls. Target: 1 API call for N issues instead of N calls - AC-7: Phase marker parsing (
SEQUANT_PHASEcomments) included in the batch query — no separate per-issue comment fetching - AC-8: Concurrency limit of 5 for any remaining individual
ghAPI calls (respects GitHub secondary rate limits)
Verification
- AC-9: Parallel execution with
--concurrency 3shows measurable improvement: wall-clock time for 3-issue run should be closer to 1x single-issue time, not 3x - AC-10: All existing tests pass. New tests verify async behavior (e.g., concurrent subprocess calls don't serialize)
Scope & Gaps to Watch
- Gap: Error handling changes —
spawnSyncreturns{ status, stdout, stderr }synchronously. Asyncexecathrows on non-zero exit by default. All callers must handle the new error contract (use{ reject: false }where needed or catch explicitly) - Gap:
doctor.tssync dependency — Thedoctorcommand runs sequential health checks using sync subprocess calls. Must migrate to async but preserve sequential execution order (health checks should not run in parallel) - Gap: GraphQL query complexity — GitHub's GraphQL API has a node limit. For batches of 20+ issues, the query may need pagination. Test with realistic batch sizes (10, 20, 50 issues)
- Gap: Offline/CI environments —
ghCLI may not be authenticated in some CI environments. Async migration must preserve the graceful degradation (return defaults on failure) that sync methods currently provide - Risk:
execadependency — Adds ~50KB. Alternative: a 20-line typed wrapper aroundchild_process.spawn. Either is fine, but decide and document the choice. If the project avoids heavy dependencies, the wrapper is better - Risk: Timeout behavior —
spawnSynctimeout kills the child process immediately. Async timeouts need anAbortControllerpattern. Ensure git operations that hang (e.g., waiting for credential input) are still killed
Technical Notes
- Best practice from research:
execais the standard for production CLI tools. For staying dependency-light, a typed wrapper withreject: falseoption is ~15 lines - Current sync call sites to migrate:
github.ts: 8 methods usingspawnSync("gh", ...)worktree-manager.ts: ~20spawnSync("git", ...)callsbatch-executor.ts:spawnSync("gh", ...)ingetIssueInfo(),parseDependencies()run.ts:detectDefaultBranch()usesspawnSync("git", ...)phase-detection.ts: calls sync GitHub methods
- Existing
batchQueryIssuesAndPRs()in github.ts can be extended for AC-5/6 - Commander.js awaits async action handlers since v5 — no barrier to async at the top level
Dependencies
- Depends on: arch: extract RunOrchestrator — decouple execution engine from CLI wiring #503 (RunOrchestrator — provides async entry point for the execution engine)
- Independent of: Event system (arch: typed workflow event system for decoupled progress, logging, and MCP streaming #504), phase registry (arch: phase plugin registry — user-extensible workflow phases #505)
- Related: Platform abstraction: GitLab and Azure DevOps support #375 (platform abstraction — async GitHubProvider makes other platform implementations easier)
Batch Group
sequant run batch 2 (parallel with event system and phase registry — all depend only on #503)
Metadata
Metadata
Assignees
Labels
backlogDeferred until user traction (100+ WAU)enhancementNew feature or requestroadmapFuture plans and roadmap items
Activity
admarble commentedon Apr 9, 2026
Architecture Review: Recommended Scope Split
After an overcomplexity assessment of the #503-#508 target architecture, this issue should be split. The async migration is justified —
spawnSyncgenuinely blocks the event loop during parallel execution — but the scope is too broad for one issue.Phase A: This issue (critical path)
Focus on GitHubProvider — this is where the actual bottleneck lives. A slow
gh issue viewduring--concurrency 3freezes all concurrent issues, not just the one making the call.Keep:
GitHubProvideronly (8 sync methods → async)batchFetchIssues()GraphQL batching) — real perf win, 1 API call for N issuesbatchFetchIssues())ghcalls)Defer to follow-up issue:
spawnSync("git", ...)calls) — these are per-issue sequential operations. Makinggit worktree addasync doesn't help when issue A's worktree setup must finish before issue A's phases begin. The event loop benefit is marginal compared to GitHubProvider where calls happen during the parallel fan-out.Rationale
The ~30+
spawnSynccall sites span two very different profiles:Fix the bottleneck that matters first. File the WorktreeManager migration as a separate low-priority issue.
Updated AC checklist
GitHubProvider— all sync methods converted to async (fetchIssueCommentBodiesSync→fetchIssueCommentBodies, etc.)batchFetchIssues()— single GraphQL query for N issues (title, labels, body, comments)batch-executor.tsusesbatchFetchIssues()at batch startghcalls--concurrency 3shows measurable improvementdocs: descope target architecture after overcomplexity review
fix(#494): /assess batch output formatting + label-priority spec-skip (…
admarble commentedon May 11, 2026
→ PARK — Backlog label already applied per author's own architecture review (2026-04-09). The review recommended a scope split: keep Phase A (GitHubProvider async + GraphQL batching, ACs 1–3, 5–10) as the actionable critical-path work, defer Phase B (WorktreeManager async migration, AC-4) to a separate low-priority issue.
Resume after: parallel execution latency becomes a real pain point, or a user reports it. When unparked, file Phase A as a slimmed issue per the architecture review rather than executing the original AC set.
admarble commentedon May 12, 2026
Supersedes prior assess from 2026-05-11 (PARK)
→ PARK — Backlog label remains the live state. The descoped Phase A (GitHubProvider async + GraphQL batching, ACs 1–3, 5–10) is the actionable critical-path work; Phase B (WorktreeManager, AC-4) is deferred per the 2026-04-09 review.
New signal worth recording: #604's chain-mode forensics (df6277c) attribute parallel-mode failures to rate limits, QA saturation, and the AC_MET_BUT_NOT_A_PLUS retry loop — not event-loop blocking from sync subprocess calls. So even Phase A wouldn't move the documented success-rate needle. Phase A still has standalone value (cleaner async surface, faster fan-out under no-rate-limit conditions), but the user-pain trigger this issue was waiting on hasn't materialized.
Resume after: parallel execution latency becomes a real pain point under non-rate-limited conditions, or someone files a slow-parallel report. When unparked, file Phase A as a slimmed issue per the architecture review rather than executing the original AC set.
admarble commentedon May 14, 2026
→ PARK — Re-confirming the 2026-05-12 PARK. No new signal warrants unparking.
The descoped Phase A (GitHubProvider async + GraphQL batching) remains the actionable critical-path work; Phase B (WorktreeManager, AC-4) stays deferred per the 2026-04-09 review. Per #604's chain-mode forensics, parallel-mode failures trace to rate limits, QA saturation, and the AC_MET_BUT_NOT_A_PLUS retry loop — not event-loop blocking from sync subprocess calls.
Resume after: parallel execution latency becomes a real pain point under non-rate-limited conditions, or someone files a slow-parallel report. When unparked, file Phase A as a slimmed issue per the architecture review rather than executing the original AC set.
admarble commentedon May 31, 2026
Supersedes 3 prior assessments (most recent: 2026-05-14)
→ PARK — Dependency blockers cleared (#503 closed 2026-04-09, #504 closed 2026-05-14), but the live gate is the
backloglabel ("Deferred until user traction, 100+ WAU"), not a dependency. Re-assessed 3× since 2026-05-11 without execution — this is a deliberate product gate, not a stuck issue.No new signal warrants unparking. The descoped Phase A (GitHubProvider async + GraphQL batching, ACs 1–3, 5–10) remains the actionable critical-path work; Phase B (WorktreeManager, AC-4) stays deferred per the 2026-04-09 review. Per #604's chain-mode forensics, parallel-mode failures trace to rate limits, QA saturation, and the AC_MET_BUT_NOT_A_PLUS retry loop — not event-loop blocking from sync subprocess calls — so even Phase A wouldn't move the documented success-rate needle.
Resume after: parallel execution latency becomes a real pain point under non-rate-limited conditions, or someone files a slow-parallel report. When unparked, file Phase A as a slimmed issue per the architecture review rather than executing the original AC set.