From 8e2b9baf19688c503281556b9bfb8ad4d1b69fbf Mon Sep 17 00:00:00 2001 From: pewdiepie-archdaemon Date: Wed, 3 Jun 2026 11:36:24 +0900 Subject: [PATCH] Rebuild memory vector index from the full saved set, not just the audited owner (#1747) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit audit_memories saves final_entries merged with other owners' entries (correct), but then rebuilt the shared vector collection from final_entries alone — wiping every other owner from semantic search until they happened to run their own audit. Keyword fallback masked it, so it degraded silently. Capture saved_entries once and rebuild from that. Caught by #1747. --- services/memory/memory_extractor.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/services/memory/memory_extractor.py b/services/memory/memory_extractor.py index c994bb9..f31dc7c 100644 --- a/services/memory/memory_extractor.py +++ b/services/memory/memory_extractor.py @@ -547,17 +547,20 @@ async def audit_memories( for e in all_entries: if e.get("owner") is None and e["id"] not in audited_ids and e["id"] not in {o["id"] for o in other_entries}: other_entries.append(e) - memory_manager.save(final_entries + other_entries) + saved_entries = final_entries + other_entries else: - memory_manager.save(final_entries) + saved_entries = final_entries + memory_manager.save(saved_entries) logger.info( f"Memory audit complete: {before_count} -> {after_count} entries " f"({before_count - after_count} removed/merged)" ) - # Rebuild vector index + # Rebuild vector index from the full saved set, not just this owner's + # slice — otherwise the shared collection is wiped of every other + # owner's entries until they happen to run their own audit. if memory_vector and memory_vector.healthy: - memory_vector.rebuild(final_entries) + memory_vector.rebuild(saved_entries) # Persist the post-tidy fingerprint so the next call short-circuits # if nothing has changed in the meantime.