Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(config): reject explicit null nested Memory blocks

Max9e87055f2be5
diff --git a/config/v2_config.py b/config/v2_config.py
index f2a558d11..4d0b0ec00 100644
--- a/config/v2_config.py
+++ b/config/v2_config.py
@@ -1350,17 +1350,17 @@ class V2Config:
memory_payload = payload.get("memory", {})
if not isinstance(memory_payload, dict):
raise ValueError("Config 'memory' must be an object")
- memory_processing_payload = memory_payload.get("processing")
- if memory_processing_payload is None:
- memory_processing_payload = {}
+ # Default only when each nested block is absent. An explicitly null
+ # ``processing`` / ``llm`` / ``embedding`` block is malformed config,
+ # not an omission, and is rejected by the object checks below — the
+ # same contract the top-level ``memory`` block already enforces, so a
+ # corrupted ``"memory": {"processing": null}`` surfaces as an error
+ # instead of being silently normalized to empty endpoint defaults.
+ memory_processing_payload = memory_payload.get("processing", {})
if not isinstance(memory_processing_payload, dict):
raise ValueError("Config 'memory.processing' must be an object")
- memory_llm_payload = memory_processing_payload.get("llm")
- memory_embedding_payload = memory_processing_payload.get("embedding")
- if memory_llm_payload is None:
- memory_llm_payload = {}
- if memory_embedding_payload is None:
- memory_embedding_payload = {}
+ memory_llm_payload = memory_processing_payload.get("llm", {})
+ memory_embedding_payload = memory_processing_payload.get("embedding", {})
if not isinstance(memory_llm_payload, dict):
raise ValueError("Config 'memory.processing.llm' must be an object")
if not isinstance(memory_embedding_payload, dict):
diff --git a/tests/test_memory_config.py b/tests/test_memory_config.py
index d85f1de52..0c089130d 100644
--- a/tests/test_memory_config.py
+++ b/tests/test_memory_config.py
@@ -181,6 +181,20 @@ def test_memory_config_rejects_explicit_null_block() -> None:
V2Config.from_payload(_payload(None)) # type: ignore[arg-type]
+ "memory",
+ [
+ {"processing": None},
+ {"processing": {"llm": None, "embedding": {"base_url": "x", "model": "m"}}},
+ {"processing": {"llm": {"base_url": "x", "model": "m"}, "embedding": None}},
+ ],
+)
+def test_memory_config_rejects_explicit_null_nested_blocks(memory: dict) -> None:
+ """An explicitly null processing/llm/embedding block is corruption, not an omission."""
+ with pytest.raises(ValueError, match="must be an object"):
+ V2Config.from_payload(_payload(memory))
+
+
def test_generic_config_save_preserves_memory_keys(monkeypatch, tmp_path) -> None:
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
original = V2Config.from_payload(