Memory sync ignores the configured memory embedding provider and 401s against the cloud embedder on local installs
Summary
On a local install with [memory] embedding_provider = "ollama", every memory-sync embed batch fails with openai embeddings returned HTTP 401 Unauthorized: {"success":false,"error":"Invalid token","errorCode":"UNAUTHORIZED"} and documents are stored without vectors — while the configured local Ollama embedder is never used.
Problem
What happened vs expected: default_embedding_provider_with_config() (src/openhuman/inference/embeddings/factory.rs) hard-codes the managed cloud embedder (OpenHumanCloudEmbedding) and never consults config.memory.embedding_provider. The memory host's default_embedding_provider() hands that to the document store, so sync-ingested documents (Composio pipelines etc.) always embed against the backend proxy. A user who is not signed into the cloud (fully local setup) gets a 401 per batch and vector-less documents — semantic search silently degrades to keyword-only for everything synced, with a WRN per batch as the only signal. Expected: the embedder the user configured (ollama/bge-m3 here) is used.
Steps to reproduce:
- Local setup, no cloud session.
[memory] embedding_provider = "ollama",embedding_model = "bge-m3",embedding_dimensions = 1024, Ollama running. - Enable any memory-sync source (e.g. a Composio Gmail connection with
[composio] enabled = true). - Let a sync tick run.
- Log fills with
batch embed failed … storing without vectors: … HTTP 401fromtinymemory_core::store::namespace_store::documents; rows land in the store with no vectors; Ollama receives no requests.
Version/platform: v0.63.14, macOS (Darwin 25.3.0), desktop bundle, Ollama with bge-m3 local.
Solution (optional)
Make the default honor the configured provider first: any [memory] embedding_provider other than cloud/managed/empty builds via create_embedding_provider_with_credentials (with resolve_api_key for keyed providers) and is returned; cloud/managed/unset keep today's managed default; a provider that fails to build falls back to managed with a warning. PR attached.
Acceptance criteria
- [ ] Repro gone — with
embedding_provider = "ollama", sync-ingested documents embed via the local Ollama endpoint and carry vectors; zero backend-proxy embed calls. - [ ] Regression safety — tests pin "configured local provider wins" and "cloud/managed/unset keeps the managed default".
- [ ] Diff coverage ≥ 80% — the fix PR meets the changed-lines coverage gate (Vitest + cargo-llvm-cov, enforced by
.github/workflows/ci-lite.yml).
Related
Fix PR to follow (same author).