The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
fix(cli): reject invalid int config values without traceback (#5956)
Barryd5b64ccec967
diff --git a/cli/python/src/mem0_cli/config.py b/cli/python/src/mem0_cli/config.pyindex 0d8de27b9..cc513ce4d 100644--- a/cli/python/src/mem0_cli/config.py+++ b/cli/python/src/mem0_cli/config.py@@ -235,7 +235,10 @@ def set_nested_value(config: Mem0Config, dotted_key: str, value: str) -> bool:if isinstance(current, bool):value = value.lower() in ("true", "1", "yes") # type: ignore[assignment]elif isinstance(current, int):- value = int(value) # type: ignore[assignment]+ try:+ value = int(value) # type: ignore[assignment]+ except ValueError:+ return Falsesetattr(obj, final_key, value)return Truediff --git a/cli/python/tests/test_config.py b/cli/python/tests/test_config.pyindex 86dc2561b..051bd3167 100644--- a/cli/python/tests/test_config.py+++ b/cli/python/tests/test_config.py@@ -139,6 +139,11 @@ class TestNestedAccess:assert set_nested_value(config, "platform.api_key", "new-key")assert config.platform.api_key == "new-key"+ def test_set_int_value_rejects_invalid_input(self):+ config = Mem0Config()+ assert set_nested_value(config, "version", "abc") is False+ assert config.version == 1+def test_set_nonexistent_key(self):config = Mem0Config()assert set_nested_value(config, "nonexistent.key", "val") is False