From b3f421bc672140f52a0cdcac6bea46228339ad2a Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 4 Nov 2025 23:38:39 +0000 Subject: [PATCH] fix: prevent parent tasks from auto-starting during recursive restoration When restoring subtasks after VS Code restart, parent tasks were being recursively restored but inadvertently started execution due to missing startTask parameter. This caused parent tasks to interfere with child task execution. Solution: - Added optional startTask parameter to createTaskWithHistoryItem (defaults to true) - Pass startTask: false when recursively restoring parent tasks - Parent tasks now exist in memory for reference only without starting execution This ensures subtasks can properly complete and report back to parent tasks after VS Code restarts. --- src/core/webview/ClineProvider.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 8416c01e49..4e87d63c97 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -859,6 +859,7 @@ export class ClineProvider public async createTaskWithHistoryItem( historyItem: HistoryItem & { rootTask?: Task; parentTask?: Task }, + startTask: boolean = true, ): Promise { await this.removeClineFromStack() @@ -919,7 +920,8 @@ export class ClineProvider try { const { historyItem: parentHistoryItem } = await this.getTaskWithId(historyItem.parentTaskId) // Recursively restore parent task (which may have its own parent) - restoredParentTask = await this.createTaskWithHistoryItem(parentHistoryItem) + // Pass startTask: false to prevent the parent from automatically starting execution + restoredParentTask = await this.createTaskWithHistoryItem(parentHistoryItem, false) } catch (error) { this.log( `Failed to restore parent task ${historyItem.parentTaskId}: ${error instanceof Error ? error.message : String(error)}`, @@ -966,6 +968,7 @@ export class ClineProvider workspacePath: historyItem.workspace, onCreated: this.taskCreationCallback, enableBridge: BridgeOrchestrator.isEnabled(cloudUserInfo, taskSyncEnabled), + startTask, }) await this.addClineToStack(task)