fix(memory): support Mem0 OSS mode in doctor + setup wizard - #59865
fix(memory): support Mem0 OSS mode in doctor + setup wizard#59865lunalunaa wants to merge 2 commits into
Conversation
b20b49c to
73c9c09
Compare
- doctor.py: branch Mem0 health check on mode — OSS validates oss.llm.config.api_key, oss.embedder.config.api_key, and oss.vector_store.provider; Platform mode unchanged (checks top-level api_key). Reports full config for both modes. - memory_setup.py: pass provider instance to status display so is_available() reflects OSS mode correctly. - _setup.py: default mode picker cursor to the currently configured mode (from mem0.json) instead of always defaulting to Platform. Adds '← current' label to the active mode option so users can see their existing setup at a glance. Closes NousResearch#57931 Supersedes NousResearch#57932
73c9c09 to
ba23d44
Compare
|
Thanks for addressing three real state-preservation issues in the Mem0 setup flow. The two picker-default changes match current main's behavior, but the doctor branch needs correction before it is safe to salvage. Problems
Suggested changes
Automated hermes-sweeper review. |
The Mem0 OSS doctor check expected api_key fields inside mem0.json's oss.llm.config / oss.embedder.config, but the setup wizard writes provider keys to ~/.hermes/.env (keyed by each provider's env_var) and only stores provider/model in mem0.json. Wizard-created OpenAI OSS setups therefore still failed doctor. Fix: resolve credentials per the provider registry (_oss_providers.LLM/EMBEDDER_PROVIDERS), which is the same source of truth the wizard uses. A provider with needs_key=False (Ollama) needs no credential; otherwise the key is satisfied if present in mem0.json *or* loaded into os.environ by load_hermes_dotenv() from .env. Also relax the cmd_setup cancellation test: load_config() is now called before the picker to compute the default cursor position, so the old 'load_config.assert_not_called()' contract is invalid. The invariant that matters — no config written on cancel — is preserved. Add regression coverage: - doctor: OSS + OpenAI keys in .env → ok - doctor: OSS + Ollama (needs_key=False), no keys → ok - doctor: OSS + OpenAI, no key → fail, naming OPENAI_API_KEY - picker: active mem0 provider → default cursor on mem0 row - picker: no provider → default on 'Built-in only' - picker: existing mem0.json mode=oss → default idx 2 + '← current' - picker: no mem0.json → default idx 0, no markers Addresses hermes-sweeper review on PR NousResearch#59865.
|
Addressed all three points from the review in a6070f4. 1. Doctor resolves OSS creds via provider registry +
So wizard-created OpenAI OSS setups (keys only in 2. Relaxed cancellation test contract 3. Added regression coverage
All 82 tests in the two test files pass; ruff clean. |
Fixes #57931
Three bugs in the Mem0 memory provider integration:
1.
hermes doctor— Mem0 OSS mode falsely reports "API key not set"doctor.py:2308only looked for a top-levelapi_keyfrom_load_config(). In OSS mode there is no top-levelapi_key— credentials are nested inoss.llm.config.api_keyandoss.embedder.config.api_keyinmem0.json. The check now branches onmode:oss.llm.config.api_key,oss.embedder.config.api_key, andoss.vector_store.providerare present. Reports mode, user_id, agent_id, llm model, embedder model, and vector store.api_key.2.
hermes memory setup— picker defaults to "Built-in only" even when a provider is activememory_setup.py:271hardcoded the picker default tobuiltin_idx(the last item, "Built-in only"). If the user pressed Enter without moving the cursor, it silently overwrotememory.provider: mem0→"". The fix reads the current config and defaults the cursor to the active provider.3.
hermes memory setup— mode picker always defaults to Platform, ignoring existing configplugins/memory/mem0/_setup.py:post_setup()showed an interactive 3-option picker (Platform / Self-hosted / Open Source) with the cursor hardcoded to index 0 (Platform), ignoring the existingmem0.jsonmode. A user runninghermes memory setupon an OSS setup would silently switch to Platform mode by pressing Enter. The fix:mem0.jsonand defaults the cursor to the active mode.Changes
hermes_cli/doctor.pymode— OSS path validates nested config fieldshermes_cli/memory_setup.pyplugins/memory/mem0/_setup.pyTesting
Platform mode behavior is unchanged (same code path, just wrapped in
else).