Commit 729cf73
committed
feat(core,ui,tauri): parallel task execution with scan-aware concurrency
Enable multiple tasks to run simultaneously now that the worktree
migration makes each task filesystem-isolated. Default concurrency
is 5, configurable in Settings → General. Scans count against the
same pool so SUSTN never over-subscribes Claude CLI.
Backend (Rust):
- EngineState.running_tasks is now Mutex<HashMap<String, CurrentTask>>
instead of Mutex<Option<CurrentTask>>, tracking multiple tasks by id
- New concurrency_limit (RwLock<usize>, default 5), tokens_reserved
(Mutex<i64>), active_scans (Mutex<usize>) on EngineState
- engine_start_task and engine_address_review: capacity check sums
running_tasks + active_scans; register/release on task boundaries;
reserve/release estimated tokens via budget::estimated_task_tokens
- engine_scan_now: increments active_scans for pass 1 and spawned pass 2,
releases on both success and error paths
- budget::calculate_budget_status_with_reservation subtracts reserved
tokens so concurrent starts do not over-commit the daily budget
- New engine_set_concurrency_limit Tauri command (clamped 1..=10)
- EngineStatusResponse exposes running_tasks and concurrency_limit
Frontend:
- useQueueProcessor: removed single-task processingRef, now checks
runningTasks.length + concurrencyLimit via engine_get_status before
dequeuing. Chains processNext on task completion or enqueue
- useScheduler: skips tick when at concurrency capacity instead of when
any task is running
- TaskDetailView: queues only when at capacity, starts immediately when
a slot is available
- TaskStatusBanner: checks runningTasks.some(t => t.taskId === id)
for per-task working state
- Deep scan listener invalidates every running task in the affected repo
- useStartupRecovery syncs persisted concurrencyLimit to the Rust state
at boot so the setting survives restarts
Scan scope control:
- Migration 21: scan_enabled column on agent_config (default 1)
- AgentConfig.scanEnabled wired through DB layer and useUpdateAgentConfig
- Scheduler and startup scan skip repos with scanEnabled=false
- pr-import sets scanEnabled=false on imported repos; they never
auto-scan again unless the user explicitly re-enables in project
settings (new toggle in the Automation section)
PR lifecycle parallelism:
- prLifecycleTick now processes active PRs via Promise.allSettled
instead of a sequential for-await loop, so multiple PRs can sync
and address in parallel (bounded by backend concurrency limit)
Settings:
- GlobalSettings.concurrencyLimit (default 5), persisted in
global_settings via migration 20
- General settings section: parallel-tasks selector (1-10)
- useUpdateGlobalSetting propagates the limit to the Rust state on
change so it takes effect immediately without restart1 parent 7387bdd commit 729cf73
18 files changed
Lines changed: 441 additions & 120 deletions
File tree
- src-tauri/src
- engine
- src
- core
- api
- db
- services
- types
- ui/components
- settings/sections
- tasks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
152 | 162 | | |
153 | 163 | | |
154 | 164 | | |
155 | 165 | | |
156 | 166 | | |
157 | 167 | | |
158 | | - | |
| 168 | + | |
| 169 | + | |
159 | 170 | | |
160 | 171 | | |
161 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | | - | |
21 | | - | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
28 | 39 | | |
29 | 40 | | |
30 | 41 | | |
31 | 42 | | |
32 | 43 | | |
33 | 44 | | |
34 | | - | |
| 45 | + | |
35 | 46 | | |
36 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
37 | 51 | | |
38 | 52 | | |
39 | 53 | | |
| |||
0 commit comments