diff --git a/src/core/task/index.ts b/src/core/task/index.ts index ce8a0dd4..4e2b4c4c 100644 --- a/src/core/task/index.ts +++ b/src/core/task/index.ts @@ -1358,6 +1358,14 @@ export class Task { } } + if (this.activeBackgroundCommand) { + try { + await this.cancelBackgroundCommand() + } catch (error) { + Logger.error("Failed to cancel background command during task abort", error) + } + } + // PHASE 4: Run TaskCancel hook // This allows the hook UI to appear in the webview // Use the shouldRunTaskCancelHook value we captured in Phase 1