Skip to content

Commit b3f421b

Browse files
committed
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.
1 parent 5e3854f commit b3f421b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,7 @@ export class ClineProvider
859859

860860
public async createTaskWithHistoryItem(
861861
historyItem: HistoryItem & { rootTask?: Task; parentTask?: Task },
862+
startTask: boolean = true,
862863
): Promise<Task> {
863864
await this.removeClineFromStack()
864865

@@ -919,7 +920,8 @@ export class ClineProvider
919920
try {
920921
const { historyItem: parentHistoryItem } = await this.getTaskWithId(historyItem.parentTaskId)
921922
// Recursively restore parent task (which may have its own parent)
922-
restoredParentTask = await this.createTaskWithHistoryItem(parentHistoryItem)
923+
// Pass startTask: false to prevent the parent from automatically starting execution
924+
restoredParentTask = await this.createTaskWithHistoryItem(parentHistoryItem, false)
923925
} catch (error) {
924926
this.log(
925927
`Failed to restore parent task ${historyItem.parentTaskId}: ${error instanceof Error ? error.message : String(error)}`,
@@ -966,6 +968,7 @@ export class ClineProvider
966968
workspacePath: historyItem.workspace,
967969
onCreated: this.taskCreationCallback,
968970
enableBridge: BridgeOrchestrator.isEnabled(cloudUserInfo, taskSyncEnabled),
971+
startTask,
969972
})
970973

971974
await this.addClineToStack(task)

0 commit comments

Comments
 (0)