fix(memfs): auto-sync when new files or changes detected
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 <noreply@letta.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user