diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index 2dd9e55c0b..2c698cbc64 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -1935,6 +1935,16 @@ export class Task extends EventEmitter implements TaskLike { const iterator = stream[Symbol.asyncIterator]() let item = await iterator.next() while (!item.done) { + // Check if task is paused and wait if necessary + while (this.isPaused) { + // Wait for 100ms before checking again + await delay(100) + // Check if abort was requested while paused + if (this.abort) { + break + } + } + const chunk = item.value item = await iterator.next() if (!chunk) { diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 02f77c526d..5ea63755fd 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -2661,6 +2661,9 @@ export class ClineProvider // Set the task as paused task.isPaused = true + // Emit pause event for tracking + task.emit(RooCodeEventName.TaskPaused, task.taskId) + // Update the UI to reflect the paused state await this.postStateToWebview() } @@ -2676,6 +2679,9 @@ export class ClineProvider // Set the task as not paused task.isPaused = false + // Emit resume event for tracking + task.emit(RooCodeEventName.TaskUnpaused, task.taskId) + // Update the UI to reflect the resumed state await this.postStateToWebview() }