From 4157c2224fb08a68cb4f1ffdb97fb14a317d5e11 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Thu, 12 Mar 2026 11:04:35 +0900 Subject: [PATCH] fix(background-agent): clear pending parent on silent cancel Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/features/background-agent/cancel-task-cleanup.test.ts | 1 + src/features/background-agent/manager.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/features/background-agent/cancel-task-cleanup.test.ts b/src/features/background-agent/cancel-task-cleanup.test.ts index e47e28ca8..1994e22a9 100644 --- a/src/features/background-agent/cancel-task-cleanup.test.ts +++ b/src/features/background-agent/cancel-task-cleanup.test.ts @@ -105,6 +105,7 @@ describe("BackgroundManager.cancelTask cleanup", () => { // then expect(cancelled).toBe(true) + expect(getPendingByParent(manager).get(task.parentSessionID)).toBeUndefined() runScheduledCleanup(manager, task.id) expect(manager.getTask(task.id)).toBeUndefined() }) diff --git a/src/features/background-agent/manager.ts b/src/features/background-agent/manager.ts index 536988f93..d133f2d77 100644 --- a/src/features/background-agent/manager.ts +++ b/src/features/background-agent/manager.ts @@ -1242,6 +1242,7 @@ export class BackgroundManager { removeTaskToastTracking(task.id) if (options?.skipNotification) { + this.cleanupPendingByParent(task) this.scheduleTaskRemoval(task.id) log(`[background-agent] Task cancelled via ${source} (notification skipped):`, task.id) return true