Skip to content

feat(#458): parallel run progress lines + reconcileState race fix - #466

Merged
admarble merged 3 commits into
mainfrom
feature/458-parallel-run-ux-freeze-reconcilestate-race-con
Mar 26, 2026
Merged

admarble merged 3 commits into
mainfrom
feature/458-parallel-run-ux-freeze-reconcilestate-race-con

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Add per-phase progress callback (onProgress) to runIssueWithLogging — parallel mode now renders #453: exec started / #452: spec ✓ (4m 6s) lines to the terminal instead of freezing for 20-30 minutes
  • Add 60-second heartbeat timer so the terminal never appears frozen during long phases
  • Fix reconcileState() race condition by wrapping the entire read-modify-write cycle in withLock(), preventing concurrent updatePhaseStatus from being overwritten by stale snapshots
  • Document getState()/saveState() as lock-unaware and make withLock() public for external callers

AC Coverage

AC Description Status
AC-1 Per-phase progress lines in parallel mode ✅ Implemented
AC-2 60-second heartbeat timer ✅ Implemented
AC-3 Atomic single-line console.log() calls ✅ Implemented
AC-4 reconcileState() wrapped in withLock() ✅ Implemented
AC-5 getState()/saveState() documented as lock-unaware ✅ Implemented
AC-6 Concurrent race condition unit test ✅ Implemented
AC-7 Visual validation (parallel progress) 🔄 Requires manual test
AC-8 MCP status during active run 🔄 Requires manual test

Files Changed

File Change
src/lib/workflow/batch-executor.ts Add ProgressCallback type and onProgress param; call at all 9 emitProgressLine sites
src/commands/run.ts Create parallel progress renderer + 60s heartbeat timer; wire onProgress to parallel call site
src/lib/workflow/reconcile.ts Wrap entire read-modify-write cycle in stateManager.withLock(); increase lock timeout to 30s
src/lib/workflow/state-manager.ts Make withLock() public; add JSDoc warnings to getState()/saveState()
src/lib/workflow/reconcile.test.ts Add concurrent race condition test (AC-6)
CHANGELOG.md Document both fixes

Test plan

  • npm run build passes
  • npm run lint passes (0 warnings)
  • npm test — 2242 tests pass (2 integration tests fail due to pre-existing worktree build issue, unrelated)
  • New reconcile race condition test passes
  • Manual: Run npx sequant run <issue1> <issue2> <issue3> — verify per-phase progress lines appear within 10s of each transition
  • Manual: Call sequant_status via MCP during active run — verify state reflects latest phase

Closes #458

…ondition

Add per-phase progress callback to runIssueWithLogging so parallel mode
renders phase start/complete events to the terminal instead of freezing.
Add 60-second heartbeat timer for long gaps between phases.

Fix reconcileState race condition by wrapping the entire read-modify-write
cycle (including GitHub API calls) in withLock(), preventing concurrent
updatePhaseStatus from being overwritten. Document getState/saveState as
lock-unaware and make withLock public for external callers.
The variable was removed locally but a reference remained in the
onProgress wrapper. Simplify by passing onPhaseProgress directly.
@admarble
admarble merged commit bae8a9d into main Mar 26, 2026
5 checks passed
@admarble
admarble deleted the feature/458-parallel-run-ux-freeze-reconcilestate-race-con branch March 26, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parallel run UX freeze + reconcileState race condition on shared state file

1 participant