From ba98b44504d81ea2a261a7a18bf894b4893579c3 Mon Sep 17 00:00:00 2001 From: Ara Date: Fri, 7 Nov 2025 19:13:31 -0800 Subject: [PATCH] feat(task): cancel active background command during task abort (#7363) Add cleanup logic to cancel any active background command when aborting a task. This ensures background processes are properly terminated before the task abort completes, preventing orphaned background commands. --- src/core/task/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) 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