Symptom: TS OSS `memory.search()` returns entity rows (fragment text
like "a fan of", "recommending thriller movies and") mixed in with
real memories. The broken rows have `hash: undefined` and
`createdAt: undefined` because they came from the entity store, not
the memory pipeline.
Root cause: `MemoryVectorStore` uses a single `vectors` SQLite table
and ignores `collectionName` internally. The entity store is created
as a parallel instance with `collectionName: "${name}_entities"` in
`memory/index.ts:193`, but both default to the same `dbPath`
(`~/.mem0/vector_store.db`) when the caller doesn't set one. Both
writers append to the same `vectors` table, so a search that reads
that table returns rows from both collections.
The existing mitigation at `memory/index.ts:199` (dbPath.replace) only
fires when `dbPath` is set explicitly. The default (unset) case fell
through with no isolation.
Fix: `getDefaultVectorStoreDbPath(collectionName?)` now derives the
default filename from the collection name
(`vector_store_${name}.db`). `MemoryVectorStore` passes
`config.collectionName` into the helper. Memory vs entity stores now
land in separate files automatically, even when the caller doesn't set
`dbPath`. Explicit `dbPath` users are unaffected — the existing
suffix-swap in `memory/index.ts` still handles them.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The word 'anything' triggers a server-side 500 in the v3 search
endpoint's BM25/lemmatization pipeline.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- _get_all_from_vector_store: top_k -> limit (2 missed occurrences)
- test_empty_llm_response_fact_extraction (sync+async): add
db.get_last_messages mock returning [], set custom_instructions=None,
fix log assertion to use record.message not record.msg
- test_thinking_tags (sync+async): add embed_batch mock, db mock
with get_last_messages=[], set custom_instructions=None
Root cause: v3 pipeline calls self.db.get_last_messages() and
self.embedding_model.embed_batch() which weren't mocked, causing
the pipeline to silently fail before reaching the LLM call.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The async context manager tests that used asyncio were deleted in the
previous commit. The import is no longer needed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Take team's upstream changes for search return type
(Promise<{results: Array<Memory>}>) and test assertions.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests were written for the old two-pass extraction pipeline (extract
facts + merge with ADD/UPDATE/DELETE). V3 uses single-pass ADD-only
extraction with one LLM call returning {"memory": [...]}.
Changes by category:
Old pipeline tests (13 failures):
- Delete TestHallucinatedIdGuard entirely (tests UPDATE/DELETE ID
resolution that no longer exists)
- Update error log assertions to match v3 log messages
- Change LLM mock from 2-call side_effect to 1-call return_value
- Update vllm thinking tag tests for single-call format
ensure_json_instruction removed (3):
- Delete source-inspection tests (function still exists in utils
but is no longer called from _add_to_vector_store)
UTC timestamp normalization removed (2):
- Update expected timestamps to stored-as-is (no UTC conversion)
- Remove _normalize_iso_timestamp_to_utc import
_search_vector_store signature: top_k -> limit (2):
- Update test calls to use limit= parameter
Context manager + close/db removed (6):
- Delete tests for __enter__/__exit__/close/db that were removed
Vector store BM25 config (3):
- Qdrant: add sparse_vectors_config to create_col assertion,
named vector format {"": vector} in update assertion
- MongoDB: assert_any_call for both vector + text search indexes
Misc (6):
- test_search_handles_incomplete_payloads: expect 1 result (v3
filters entries without 'data' key)
- Embedding cache tests: update for embed_batch (1 call) vs
individual embed (was 2 calls)
- Graph reset tests: delete (graph support removed)
- use_azure_credential: update expected sensitivity to True
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- crud.test.ts: add() returns {event_id, status} not an array
- search.test.ts: use snake_case user_id in filters for v3 compatibility
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The v3 API returns {results: [...]} and the client should pass that
through without unwrapping. Updated return type to Promise<{results: Array<Memory>}>,
removed the unwrap logic, and fixed integration tests to access .results.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Someone else's changes unwrap the v3 envelope in the client,
so the return type should stay as Array<Memory> for consistency.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change TS client search() return type from Promise<Array<Memory>>
to Promise<{ results: Array<Memory> }> to match v3 API envelope.
Update unit test mocks to return {results: []} and fix assertions.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
search() now unwraps { results: [...] } -> [...] internally (same
pattern getAll() already uses), so callers always get Array<Memory>.
Removes redundant unwrap logic from integration test helpers and
search.test.ts that caused TS2339 'Property results does not exist
on type never' — the false branch of Array.isArray() was unreachable
since search() is typed as returning Array<Memory>.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove test_neo4j_cypher_syntax.py and test_graph_delete_docker.py
which reference deleted graph_memory module.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Strip graph_memory patches, GraphStoreFactory mocks, graph_store config,
enable_graph parametrize, _add_to_graph assertions, and "relations"
assertions from all test fixtures and test functions. Graph store has
been removed from the codebase.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v3 search returns {results: [...]} instead of a bare array.
Updated waitForSearchResults helper and search edge case tests
to unwrap the v3 envelope.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Restore LMStudioEmbedder, LMStudioLLM, DeepSeekLLM in TS factory.ts
(accidentally removed during graph store cleanup — unrelated to graphs)
- Add langchain>=0.1.0 to Python extras dep group (was transitively
provided by langchain-neo4j in the removed graph group, still needed
by mem0/llms/langchain.py and mem0/embeddings/langchain.py)
- Add pytest.importorskip("langchain") to test_langchain.py for graceful
skip when langchain isn't installed
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These test files import mem0.memory.graph_memory, kuzu_memory,
memgraph_memory, apache_age_memory, and mem0.graphs.neptune which
were deleted in the graph store removal commit.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update mock URLs in memoryClient.crud.test.ts and
memoryClient.search.test.ts to match v3 endpoints:
- add: /v1/memories/ -> /v3/memories/
- search: /v2/memories/search/ -> /v3/memories/search/
- deleteAll: stays on /v1/memories/ (no v3 equivalent)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Was missing 13 entries (credentials, token, access_token, refresh_token,
auth_token, session_token, client_secret, auth_client_secret,
azure_client_secret, service_account_json, aws_session_token, credential,
secret). Now matches the original list from commit 46b4b2e9.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The function and associated constants (_SENSITIVE_FIELDS_EXACT,
_SENSITIVE_SUFFIXES) were accidentally dropped during the merge.
Restores telemetry-safe config cloning that redacts API keys,
passwords, and other secrets while preserving runtime auth objects.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove deprecated custom_update_memory_prompt from MemoryConfig entirely
- Add MAX_BATCH=100 chunking guard to embed_batch in openai.py and azure_openai.py
- Move all inline imports (mem0.utils.*) to top-level in main.py
- Remove custom_update_memory_prompt from test fixture
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>