Skip to content

feat: allow unlimited parallel task execution#20

Merged
jacksoncage merged 3 commits intomainfrom
feat/parallel-tasks
Mar 2, 2026
Merged

feat: allow unlimited parallel task execution#20
jacksoncage merged 3 commits intomainfrom
feat/parallel-tasks

Conversation

@jacksoncage
Copy link
Owner

Summary

  • Remove per-repo lock from dequeue() — tasks on the same repo can now run in parallel since each gets its own worktree
  • Remove maxConcurrent = 5 cap from worker loop — no artificial limit on concurrent tasks
  • Clean up "repo busy" status text in task list display

Test plan

  • All 369 existing tests pass
  • Updated queue.test.ts to verify same-repo parallel dequeue works
  • Manual: send multiple tasks for the same repo, verify they run concurrently in separate worktrees

Remove per-repo lock from task dequeue and global concurrency cap from
worker loop. Each task already runs in an isolated worktree, so there's
no need to serialize tasks per repo or cap total concurrency.
- Per-repo mutex in RepoManager serializes clone/pull/worktree-create
  so concurrent tasks on the same repo don't hit git lock contention.
  The lock releases before the agent runs, so execution is still parallel.
- Atomic dequeue via SQLite transaction prevents duplicate task dispatch
  when multiple dequeue calls race.
- 100ms sleep between task spawns prevents burst-spawning all queued
  tasks simultaneously.
- Outer worker catch now cleans up task state (queue.fail, delete from
  runningProcesses/pendingReplies) instead of just logging.
- Worktree cleanup failures are logged instead of silently swallowed.
# Conflicts:
#	src/queue.ts
#	src/worker.ts
@jacksoncage jacksoncage merged commit 24c7f3b into main Mar 2, 2026
1 check passed
@jacksoncage jacksoncage deleted the feat/parallel-tasks branch March 2, 2026 20:43
jacksoncage added a commit that referenced this pull request Mar 2, 2026
Reconcile PR #20 (parallel tasks) with waiting_user blocking.
Only block dequeuing from repos that have a waiting_user task
(live session waiting for input), not from repos with running tasks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant