From 0a81853d84e43ca92718166db6d07ea984889a39 Mon Sep 17 00:00:00 2001 From: yansheng3 Date: Fri, 28 Feb 2025 19:06:43 +0800 Subject: [PATCH] Optimize Task ID Initialization Order Signed-off-by: yansheng3 --- src/core/Cline.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 00897eecf4..3127d3d38b 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -148,7 +148,8 @@ export class Cline { throw new Error("Either historyItem or task/images must be provided") } - this.taskId = crypto.randomUUID() + this.taskId = historyItem ? historyItem.id : crypto.randomUUID() + this.apiConfiguration = apiConfiguration this.api = buildApiHandler(apiConfiguration) this.terminalManager = new TerminalManager() @@ -161,10 +162,6 @@ export class Cline { this.diffViewProvider = new DiffViewProvider(cwd) this.enableCheckpoints = enableCheckpoints ?? false - if (historyItem) { - this.taskId = historyItem.id - } - // Initialize diffStrategy based on current state this.updateDiffStrategy(Experiments.isEnabled(experiments ?? {}, EXPERIMENT_IDS.DIFF_STRATEGY))