From 65d7fa2420a48b6ab41b976f3076bd2e7373ecc9 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 1 Jun 2026 23:14:01 +0100 Subject: [PATCH] fix(memory): reattach Linux watchers on directory rename (cherry picked from commit 0db7781514cc84fac4f3a999d24b4b747fc871f9) --- extensions/memory-core/src/memory/manager-sync-ops.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/memory-core/src/memory/manager-sync-ops.ts b/extensions/memory-core/src/memory/manager-sync-ops.ts index 19523a6c6fb..855c3d5133e 100644 --- a/extensions/memory-core/src/memory/manager-sync-ops.ts +++ b/extensions/memory-core/src/memory/manager-sync-ops.ts @@ -777,7 +777,7 @@ export abstract class MemoryManagerSyncOps { watcher = resolveMemoryNativeWatchFactory()( watchDir, { recursive: false }, - (_eventType, filename) => { + (eventType, filename) => { if (filename == null) { markDirty(); if (!this.attachLinuxMemoryDirectoryTreeSubtree(watchDir, attachDirectory)) { @@ -799,6 +799,9 @@ export abstract class MemoryManagerSyncOps { closeDirectorySubtree(full); } if (stats?.isDirectory()) { + if (eventType === "rename") { + closeDirectorySubtree(full); + } if (!this.attachLinuxMemoryDirectoryTreeSubtree(full, attachDirectory)) { closeAndFallback( `failed to attach Linux memory directory watcher under ${full}; falling back to chokidar`,