diff --git a/src/features/background-agent/process-cleanup.ts b/src/features/background-agent/process-cleanup.ts index 2b29fc9bf..a2f9b4b72 100644 --- a/src/features/background-agent/process-cleanup.ts +++ b/src/features/background-agent/process-cleanup.ts @@ -19,7 +19,7 @@ function registerProcessSignal( } interface CleanupTarget { - shutdown(): void + shutdown(): void | Promise } const cleanupManagers = new Set() @@ -35,7 +35,9 @@ export function registerManagerForCleanup(manager: CleanupTarget): void { const cleanupAll = () => { for (const m of cleanupManagers) { try { - m.shutdown() + void Promise.resolve(m.shutdown()).catch((error) => { + log("[background-agent] Error during async shutdown cleanup:", error) + }) } catch (error) { log("[background-agent] Error during shutdown cleanup:", error) }