fix(mem0): merge env vars with mem0.json instead of either/or#4836
Closed
ellenlivia-mem0 wants to merge 1 commit into
Closed
fix(mem0): merge env vars with mem0.json instead of either/or#4836ellenlivia-mem0 wants to merge 1 commit into
ellenlivia-mem0 wants to merge 1 commit into
Conversation
When mem0.json exists but is missing the api_key (e.g. after running `hermes memory setup`), the plugin reports "not available" even though MEM0_API_KEY is set in .env. This happens because _load_config() returns the JSON file contents verbatim, never falling back to env vars. Use env vars as the base config and let mem0.json override individual keys on top, so both config sources work together. Fixes: mem0 plugin shows "not available" despite valid MEM0_API_KEY in .env
Contributor
|
Merged via PR #4939. Your commit was cherry-picked onto current main with authorship preserved. We added a small follow-up fix: changed the merge filter from |
Author
|
thankyou @teknium1 |
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
hermes memory statusshows mem0 as "not available" even whenMEM0_API_KEYis correctly set in~/.hermes/.env_load_config()in the mem0 plugin treatsmem0.jsonand env vars as mutually exclusive. Ifmem0.jsonexists (created byhermes memory setupwith justuser_id/agent_id), it returns that file's contents and never checks env vars — soapi_keyis silently empty.mem0.jsonoverride individual keys on top. Both sources now work together instead of one replacing the other.Reproduction
hermes memory setup→ configure user_id and agent_idMEM0_API_KEY=m0-xxxto~/.hermes/.envhermes memory status→ shows "not available"Test plan
hermes memory statusshows available with key only in.envhermes memory statusshows available with key only inmem0.jsonmem0.jsonvalues override env vars when both are setmem0.jsondon't clobber env var defaults