Skip to content

fix(memory): paginate delete_all past list() top_k default - #6629

Open
Bartok9 wants to merge 1 commit into
mem0ai:mainfrom
Bartok9:fix/6627-delete-all-top-k
Open

fix(memory): paginate delete_all past list() top_k default#6629
Bartok9 wants to merge 1 commit into
mem0ai:mainfrom
Bartok9:fix/6627-delete-all-top-k

Conversation

@Bartok9

@Bartok9 Bartok9 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

delete_all() only deleted the first page of vector_store.list() (default top_k=100) but still returned success.

Motivation

Closes #6627. Silent partial delete is a data-retention/privacy hazard.

Fix

Page list(filters=..., top_k=1000) until a short/empty page in sync and async Memory.delete_all.

Verification

pytest tests/test_main.py::test_delete_all tests/test_main.py::test_delete_all_paginates_beyond_default_top_k (+ entity-id delete_all cases) — passed.

Closes mem0ai#6627

Root cause: delete_all called vector_store.list without top_k; most
stores default top_k=100 so only the first page was deleted while the
API still reported full success (privacy/GDPR hazard).

Fix: page list() with top_k=1000 until a short/empty page for sync and
async Memory.delete_all.

Verification: pytest tests/test_main.py::test_delete_all
tests/test_main.py::test_delete_all_paginates_beyond_default_top_k
TestEntityIdValidation delete_all cases — 4 passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sdk-python Python SDK specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

delete_all() silently deletes only the first 100 memories

1 participant