diff --git a/apps/ui/src/components/views/board-view.tsx b/apps/ui/src/components/views/board-view.tsx index 2624514a3..48d068a1e 100644 --- a/apps/ui/src/components/views/board-view.tsx +++ b/apps/ui/src/components/views/board-view.tsx @@ -1274,8 +1274,10 @@ export function BoardView() { maxConcurrency={maxConcurrency} runningAgentsCount={runningAutoTasks.length} onConcurrencyChange={(newMaxConcurrency) => { - if (currentProject && selectedWorktree) { - const branchName = selectedWorktree.isMain ? null : selectedWorktree.branch; + if (currentProject) { + // If selectedWorktree is undefined or it's the main worktree, branchName will be null. + // Otherwise, use the branch name. + const branchName = selectedWorktree?.isMain === false ? selectedWorktree.branch : null; setMaxConcurrencyForWorktree(currentProject.id, branchName, newMaxConcurrency); // Also update backend if auto mode is running if (autoMode.isRunning) {