The current model is:
dequeue → update state → run handlers → execute commands (sequentially) → enqueue results → repeat
The bottleneck isn't handler execution (those are pure functions, fast). It's command execution — specifically provider writes that hit the GitHub API. Each TransitionWorkItemStatus is a
REST call.
Parallel execution would look like:
dequeue → update state → run handlers → classify commands:
- Independent commands (different work items) → execute in parallel
- Dependent commands (same work item) → execute sequentially
→ collect all results → enqueue events → repeat
The handler independence invariant already guarantees safety here — you just need a classification step in the executor. The compound commands are already designed for this (they encapsulate
dependencies).
Concrete change: In create-command-executor.ts, group commands by work item ID. Commands targeting different work items can Promise.all. Commands targeting the same work item stay
sequential. That's it.