Repository navigation
fix(memory): exclude vector-store-rejected records from ADD results - #7066
blazingretinol merged 1 commit into
Conversation
When a batch insert into the vector store fails, _add_to_vector_store
retries record-by-record, but records that also fail the retry were
logged and silently skipped while results, history rows, and entity
links were still built from the full extracted set. Callers received
{"id": ..., "event": "ADD"} for memories that were never stored.
Both Memory and AsyncMemory now track which records actually persisted:
- rejected records are excluded from returned results, history, and
entity linked_memory_ids
- if nothing persists at all, add() raises VectorStoreError, which the
docstring already documented but nothing raised
Closes mem0ai#6911
|
Thanks for taking the time to open this. We only review pull requests that fix an issue we have already agreed to take on, so this one is closed for now. To get it reviewed:
Issue already labeled Documentation-only changes skip this gate entirely. See CONTRIBUTING.md for the full policy. |
|
Hi @Diwak4r, thanks for opening this pull request. This is just a soft check: you are not yet in this repo's vouched contributor list ( A maintainer can vouch for you by commenting |
|
An |
Linked Issue
Closes #6911
Description
When a batch insert into the vector store fails,
_add_to_vector_storeretries record-by-record. Records that also fail the retry are logged and skipped â but until now, the returned payload, the history rows, and entitylinked_memory_idswere all still built from the full extracted set, so callers received{"id": ..., "event": "ADD"}for memories that were never stored.Both
MemoryandAsyncMemorynow track which records actually persisted:ADDhistory row, and are not referenced bylinked_memory_ids. Successfully persisted records behave exactly as before.add()now raisesVectorStoreError, which the method docstring already documented but nothing raised. Raw messages are still saved first so a later retry can re-extract them.Testing
TestPartialInsertFailure/TestAsyncPartialInsertFailure) reproducing the issue's scenario: a flaky insert that rejects the batch plus one poison record. Verified rejected records are absent from both results and history, and that total failure raisesVectorStoreError.tests/memory/suite passes (377 tests);ruff checkclean on both touched files.Type of Change