From 8d464e648db8f2049d8de7ea6afd7894e9bf05a0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 29 Jul 2026 00:14:52 +0000 Subject: [PATCH] Fix duplicate/mislabeled document entities from local_files and github imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _document_name() only checked metadata keys `path`/`file`/`filename`/ `document`/`title_path`, but local_files.py and github.py write `file_path`/`relative_path`/`file_name` instead. The mismatch made every document entity fall back to the first line of its content as its name/key, which collides across unrelated files and chunks (shared license headers, imports, blank lines) and silently merges them into one mislabeled graph node on reindex — the "everything in the graph looks the same/fake" symptom after a whole-repo import. Add the actual connector metadata keys, with relative_path preferred over the absolute file_path. --- server/core/entities.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/core/entities.py b/server/core/entities.py index a5e3a34..ba7caee 100644 --- a/server/core/entities.py +++ b/server/core/entities.py @@ -21,7 +21,16 @@ # Sources / metadata that mark a memory as a document. _DOCUMENT_SOURCES = ("notion", "obsidian", "local_files", "github") -_DOCUMENT_META_KEYS = ("path", "file", "filename", "document", "title_path") +_DOCUMENT_META_KEYS = ( + "path", + "file", + "filename", + "document", + "title_path", + "relative_path", + "file_path", + "file_name", +) # Task / action-item markers (English + Turkish) — same spirit as the # commitment detector, but these become first-class task entities.