From c2dfcadbacf0f9fcdd6d24cf0df7c41714fe021a Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 7 Feb 2026 17:31:01 +0900 Subject: [PATCH] fix: clear race timeout after plugin loading settles --- src/plugin-handlers/config-handler.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugin-handlers/config-handler.ts b/src/plugin-handlers/config-handler.ts index 0b0eb9d3b..41adbaf20 100644 --- a/src/plugin-handlers/config-handler.ts +++ b/src/plugin-handlers/config-handler.ts @@ -120,15 +120,19 @@ export function createConfigHandler(deps: ConfigHandlerDeps) { if (pluginsEnabled) { const timeoutMs = pluginConfig.experimental?.plugin_load_timeout_ms ?? 10000; try { - const timeoutPromise = new Promise((_, reject) => - setTimeout(() => reject(new Error(`Plugin loading timed out after ${timeoutMs}ms`)), timeoutMs) - ); + let timeoutId: ReturnType; + const timeoutPromise = new Promise((_, reject) => { + timeoutId = setTimeout( + () => reject(new Error(`Plugin loading timed out after ${timeoutMs}ms`)), + timeoutMs, + ); + }); pluginComponents = await Promise.race([ loadAllPluginComponents({ enabledPluginsOverride: pluginConfig.claude_code?.plugins_override, }), timeoutPromise, - ]); + ]).finally(() => clearTimeout(timeoutId)); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); log("[config-handler] Plugin loading failed", { error: errorMessage });