From 2c985005d01e2772a21bbf68c8850ebdbf2247af Mon Sep 17 00:00:00 2001 From: cpacker Date: Thu, 29 Jan 2026 16:03:12 -0800 Subject: [PATCH] fix(memfs): auto-sync when new files or changes detected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, file watching only triggered a conflict check, not a full sync. New files created in the memory directory were detected but not synced until the user ran /memory-sync manually. Now when the conflict check detects: - New files (status.newFiles.length > 0) - Pending file changes (status.pendingFromFile.length > 0) It automatically triggers a sync to create/update the corresponding blocks. 🐾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta --- src/cli/App.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cli/App.tsx b/src/cli/App.tsx index 2110b0c..f068fdf 100644 --- a/src/cli/App.tsx +++ b/src/cli/App.tsx @@ -2058,13 +2058,24 @@ export default function App({ `Conflict check triggered (dirty=${isDirty}, interval=${isIntervalTurn}, turn=${turnCountRef.current})`, ); checkMemoryFilesystemStatus(agentId) - .then((status) => { + .then(async (status) => { if (status.conflicts.length > 0) { debugLog( "memfs", `Found ${status.conflicts.length} conflict(s): ${status.conflicts.map((c) => c.label).join(", ")}`, ); pendingMemfsConflictsRef.current = status.conflicts; + } else if ( + status.newFiles.length > 0 || + status.pendingFromFile.length > 0 + ) { + // New files or file changes detected - auto-sync + debugLog( + "memfs", + `Auto-syncing: ${status.newFiles.length} new, ${status.pendingFromFile.length} changed`, + ); + pendingMemfsConflictsRef.current = null; + await runMemoryFilesystemSync("auto"); } else { pendingMemfsConflictsRef.current = null; }