fix(memory): use effective_embed_provider for all embedding ops in semantic submodules#3035
Merged
fix(memory): use effective_embed_provider for all embedding ops in semantic submodules#3035
Conversation
…mantic submodules Replace self.provider with self.effective_embed_provider() at all 18 embedding call sites across recall.rs, cross_session.rs, summarization.rs, and corrections.rs. The main LLM provider was used for embedding at recall time, causing ensure_collection() to see a dimension mismatch (e.g. 1536 vs. 768) and silently delete and recreate Qdrant memory collections on every session startup. Add a regression test that constructs SemanticMemory with a dedicated embed provider and asserts that effective_embed_provider() routes to it rather than to self.provider. Fixes #3029
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.
Summary
self.providerwithself.effective_embed_provider()at all 18 embedding call sites acrossrecall.rs,cross_session.rs,summarization.rs, andcorrections.rsinzeph-memoryeffective_embed_provider_routes_to_dedicated_embed_providerthat verifies the dedicated embed provider is used instead of the main LLM providerRoot Cause
self.provider(main LLM provider, e.g. OpenAI/text-embedding-3-small, 1536 dim) was used at recall time instead ofself.effective_embed_provider()(e.g. Ollama/nomic-embed-text-v2-moe, 768 dim).ensure_collection()detected the dimension mismatch and silently deleted and recreated all Qdrant memory collections on every session startup, losing all stored embeddings.Test Plan
cargo build -p zeph-memory— passes, 0 errorscargo clippy -p zeph-memory -- -D warnings— 0 warningscargo nextest run -p zeph-memory --lib— 1115 passed, 7 skipped, 0 failedeffective_embed_provider_routes_to_dedicated_embed_providerpasses and would fail if any fixed call site reverted toself.providerzeph_conversationscollection no longer recreated on startupCloses #3029