From 3d5b7a4a80756f942b281e8a68f036a73c1e4ae8 Mon Sep 17 00:00:00 2001 From: Jerry-Xin Date: Tue, 17 Mar 2026 14:08:32 +0800 Subject: [PATCH] fix(plugins): document leaked promise limitation on hook timeout Add a code comment explaining that timed-out handler promises continue running in the background since the current plugin hook API does not accept an AbortSignal for cooperative cancellation. Notes the path forward for when the plugin contract evolves. --- src/plugins/hooks.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/hooks.ts b/src/plugins/hooks.ts index fb4faa0986d..b80365951ef 100644 --- a/src/plugins/hooks.ts +++ b/src/plugins/hooks.ts @@ -175,6 +175,12 @@ export function createHookRunner(registry: PluginRegistry, options: HookRunnerOp /** * Execute a single async handler with the configured timeout. * Throws on timeout; callers catch via handleHookError. + * + * NOTE: On timeout, the underlying handler promise is NOT cancelled — it + * continues running in the background until it settles. The current plugin + * hook contract (`() => Promise`) does not accept an `AbortSignal`, so + * cooperative cancellation is not yet possible. If the plugin API evolves + * to accept a signal, wire it through here for proper cleanup. */ async function callHandlerWithTimeout( fn: () => Promise,