From 3267808dbe8d32f8eb578d5ef1e4902058dc5b04 Mon Sep 17 00:00:00 2001 From: hannesrudolph Date: Thu, 3 Jul 2025 17:10:04 -0600 Subject: [PATCH] chore: revert out-of-scope logging changes --- src/core/webview/ClineProvider.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index f3aadff67e..d158bfdd5c 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -124,6 +124,7 @@ export class ClineProvider ) { super() + this.log("ClineProvider instantiated") ClineProvider.activeInstances.add(this) this.codeIndexManager = codeIndexManager @@ -162,6 +163,8 @@ export class ClineProvider // The instance is pushed to the top of the stack (LIFO order). // When the task is completed, the top instance is removed, reactivating the previous task. async addClineToStack(cline: Task) { + console.log(`[subtasks] adding task ${cline.taskId}.${cline.instanceId} to stack`) + // Add this cline instance into the stack that represents the order of all the called tasks. this.clineStack.push(cline) @@ -184,6 +187,7 @@ export class ClineProvider let cline = this.clineStack.pop() if (cline) { + console.log(`[subtasks] removing task ${cline.taskId}.${cline.instanceId} from stack`) try { // Abort the running task and set isAbandoned to true so // all running promises will exit as well. @@ -222,6 +226,7 @@ export class ClineProvider // and resume the previous task/cline instance (if it exists) // this is used when a sub task is finished and the parent task needs to be resumed async finishSubTask(lastMessage: string) { + console.log(`[subtasks] finishing subtask ${lastMessage}`) // remove the last cline instance from the stack (this is the finished sub task) await this.removeClineFromStack() // resume the last cline instance in the stack (if it exists - this is the 'parent' calling task) @@ -249,10 +254,13 @@ export class ClineProvider } async dispose() { + this.log("Disposing ClineProvider...") await this.removeClineFromStack() + this.log("Cleared task") if (this.view && "dispose" in this.view) { this.view.dispose() + this.log("Disposed webview") } this.clearWebviewResources() @@ -271,6 +279,7 @@ export class ClineProvider this.mcpHub = undefined this.marketplaceManager?.cleanup() this.customModesManager?.dispose() + this.log("Disposed all disposables") ClineProvider.activeInstances.delete(this) McpServerManager.unregisterProvider(this) @@ -373,6 +382,8 @@ export class ClineProvider } async resolveWebviewView(webviewView: vscode.WebviewView | vscode.WebviewPanel) { + this.log("Resolving webview view") + this.view = webviewView // Set panel reference according to webview type @@ -473,8 +484,10 @@ export class ClineProvider webviewView.onDidDispose( async () => { if (inTabMode) { + this.log("Disposing ClineProvider instance for tab view") await this.dispose() } else { + this.log("Clearing webview resources for sidebar view") this.clearWebviewResources() this.codeIndexStatusSubscription?.dispose() this.codeIndexStatusSubscription = undefined @@ -495,6 +508,8 @@ export class ClineProvider // If the extension is starting a new session, clear previous task state. await this.removeClineFromStack() + + this.log("Webview view resolved") } public async initClineWithSubTask(parent: Task, task?: string, images?: string[]) { @@ -549,6 +564,10 @@ export class ClineProvider await this.addClineToStack(cline) + this.log( + `[subtasks] ${cline.parentTask ? "child" : "parent"} task ${cline.taskId}.${cline.instanceId} instantiated`, + ) + return cline } @@ -578,6 +597,9 @@ export class ClineProvider }) await this.addClineToStack(cline) + this.log( + `[subtasks] ${cline.parentTask ? "child" : "parent"} task ${cline.taskId}.${cline.instanceId} instantiated`, + ) return cline } @@ -595,6 +617,11 @@ export class ClineProvider if (fs.existsSync(portFilePath)) { localPort = fs.readFileSync(portFilePath, "utf8").trim() + console.log(`[ClineProvider:Vite] Using Vite server port from ${portFilePath}: ${localPort}`) + } else { + console.log( + `[ClineProvider:Vite] Port file not found at ${portFilePath}, using default port: ${localPort}`, + ) } } catch (err) { console.error("[ClineProvider:Vite] Failed to read Vite port file:", err) @@ -937,6 +964,8 @@ export class ClineProvider return } + console.log(`[subtasks] cancelling task ${cline.taskId}.${cline.instanceId}`) + const { historyItem } = await this.getTaskWithId(cline.taskId) // Preserve parent and root task information for history item. const rootTask = cline.rootTask @@ -1188,6 +1217,7 @@ export class ClineProvider // delete the entire task directory including checkpoints and all content try { await fs.rm(taskDirPath, { recursive: true, force: true }) + console.log(`[deleteTaskWithId${id}] removed task directory`) } catch (error) { console.error( `[deleteTaskWithId${id}] failed to remove task directory: ${error instanceof Error ? error.message : String(error)}`,