Repository navigation
Conversation
- Filter None ids out of collected_ids before vec_db.delete to avoid passing Null neo4j values to the vector store. - Use lazy %-style formatting for id_collect_query log call, matching the sibling log line's style. - Assert get_by_metadata is called in the filter-path regression test so the mock actually exercises the branch it documents.
syzsunshine219
marked this pull request as ready for review
November 9, 2026 15:47
endxxxx
approved these changes
Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restores the change proposed in #2332 for review against
mainafter its former base branch,dev-v2.0.33, was deleted. The source commits and authors are preserved.Source head:
55178d01f9194f8bebd58a1f8812732ca7cf0c5aThis PR is open for review. Review and CI against the current base are pending; validation claims in the original description below refer to the earlier snapshot. The original discussion and evidence remain in #2332.
Original change description
Description
Fixed bug #2331: delete memory API returned success but the memory remained searchable after deletion.
Root cause:
Neo4jCommunityGraphDB.delete_node_by_pramsinsrc/memos/graph_dbs/neo4j_community.pyonly removed nodes from the Neo4j graph but never purged the corresponding embedding vectors fromvec_db(Qdrant). Since all search calls go through vector similarity onvec_db, stale vectors caused deleted memories to keep surfacing in search results. Theclear()method and the reorganize path both cleanedvec_dbcorrectly —delete_node_by_pramssimply omitted that step.Fix: replaced the pre-delete count query with an ID-collecting query (
MATCH ... RETURN n.id AS id), then calledself.vec_db.delete(collected_ids)after the graphDETACH DELETE. Avec_dbfailure is caught and logged as a warning rather than re-raised, so a transient vector store error does not roll back an already-committed graph deletion. Added 5 regression tests intests/graph_dbs/test_delete_vec_cleanup.pycovering delete-by-memory-ids, delete-by-filter, empty-list early-return, no-args early-return, and vec_db failure resilience. All 5 tests pass; all 36 existing graph_dbs tests continue to pass; ruff lint clean.Related Issue (Required): Fixes #2331
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Automated tests are pending.
Checklist
@MatthewZhuang,@CarltonXiang,@syzsunshine219,@World-controllerplease review this PR.Reviewer Checklist