The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
docs(mem0): comment and #99121 test state the one fail-loud scope contract
teknium1019103bfbc6d
diff --git a/plugins/memory/mem0/__init__.py b/plugins/memory/mem0/__init__.pyindex ba305f9a144..77f61647a2d 100644--- a/plugins/memory/mem0/__init__.py+++ b/plugins/memory/mem0/__init__.py@@ -89,9 +89,10 @@ def _load_config() -> dict:file_cfg = read_json_or_empty(get_hermes_home() / "mem0.json")config.update({k: v for k, v in file_cfg.items() if v is not None and v != ""})# MEM0_API_KEY authenticates the Platform and self-hosted HTTP backends; pure OSS mode builds its- # backend from the local ``oss`` config and has no platform credential to resolve. Decide after- # mem0.json overrode the env fallback so a scope-less multiplex caller can load an OSS config- # without weakening fail-closed reads for credentialed modes.+ # backend from the local ``oss`` config and has no platform credential to resolve, so a profile+ # scope WITHOUT the key must still load an OSS config (#99121 as it stands today: the caller is+ # scoped, the scope is just empty). Decided after mem0.json overrode the env defaults because+ # the file may be what selects ``oss``. Scope-less callers already raised above.if config.get("mode", "platform") == "oss":config.setdefault("api_key", "")elif not config.get("api_key"):diff --git a/tests/plugins/memory/test_mem0_v3.py b/tests/plugins/memory/test_mem0_v3.pyindex 028f55b52dd..9babf5b3f23 100644--- a/tests/plugins/memory/test_mem0_v3.py+++ b/tests/plugins/memory/test_mem0_v3.py@@ -349,8 +349,10 @@ class TestMem0ModeSwitch:))- # A profile scope WITHOUT the platform key: OSS mode must not demand MEM0_API_KEY. (A- # scope-less caller is a spawn-site bug and raises; see test_load_config_fails_closed_without_scope.)+ # Contract (#99121, restated for fail-loud reads): every production caller is scoped+ # (turn/cron/kanban scope installers); an OSS profile whose scope simply lacks MEM0_API_KEY+ # must initialize. A scope-LESS multiplex caller is a spawn-site bug and raises instead —+ # see test_load_config_fails_closed_without_scope_even_for_identity_settings.token = secret_scope.set_secret_scope({})secret_scope.set_multiplex_active(True)try: