From 7e602489509ed1e957eff48595bdbc367fabfcf4 Mon Sep 17 00:00:00 2001 From: Jerry-Xin Date: Sat, 14 Mar 2026 22:05:45 +0800 Subject: [PATCH] fix(memory): do not close cached manager during doctor status probe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The doctor.memory.status handler was closing the manager in a finally block, but MemoryIndexManager.get returns a cached instance that may be the long-lived startup manager with an active file watcher. Closing it tears down the watcher and disables external-change auto-reindexing. Remove the close call — manager lifecycle is handled by closeAllMemorySearchManagers at gateway shutdown. --- src/gateway/server-methods/doctor.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gateway/server-methods/doctor.ts b/src/gateway/server-methods/doctor.ts index f842f40f4eb..a2db2841a79 100644 --- a/src/gateway/server-methods/doctor.ts +++ b/src/gateway/server-methods/doctor.ts @@ -56,11 +56,9 @@ export const doctorHandlers: GatewayRequestHandlers = { }; respond(true, payload, undefined); } finally { - try { - await manager.close(); - } catch { - // Ignore close errors - response already sent - } + // Do NOT close the manager here — it may be the long-lived cached + // instance from startup whose file watcher must stay active. + // Manager lifecycle is handled by closeAllMemorySearchManagers at shutdown. } }, };