The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(memory): host-block save never replaces an unparseable provider config
teknium18b8dc9a83752
diff --git a/tests/hermes_cli/test_web_server.py b/tests/hermes_cli/test_web_server.pyindex 4ff88b161b9..50abdef183d 100644--- a/tests/hermes_cli/test_web_server.py+++ b/tests/hermes_cli/test_web_server.py@@ -1143,6 +1143,30 @@ CONFIG_SCHEMA = ProviderConfigSchema(assert "secret-value" not in json.dumps(data)+ @pytest.mark.parametrize("corrupt", [True, False], ids=["unparseable-file-is-left-alone", "parseable-file-is-merged"])+ def test_put_host_block_never_replaces_an_unparseable_config(self, corrupt):+ # The router reads the provider's config strictly: a file that exists but does not parse must+ # not be replaced by this host's block alone (that would wipe every other host's keys).+ from hermes_cli.config import load_config++ config_path = self._install_hostprov()+ before = "{not json" if corrupt else json.dumps({"hosts": {"other": {"apiKey": "keep-me"}}})+ config_path.write_text(before, encoding="utf-8")++ resp = self.client.put("/api/memory/providers/hostprov/config?surface=declared",+ json={"values": {"workspace": "myws"}})++ if corrupt:+ assert resp.status_code == 400+ assert config_path.read_text(encoding="utf-8") == before+ assert (load_config().get("memory") or {}).get("provider") != "hostprov"+ return+ assert resp.status_code == 200+ cfg = json.loads(config_path.read_text(encoding="utf-8"))+ assert cfg["hosts"]["other"]["apiKey"] == "keep-me"+ assert cfg["hosts"]["hermes"]["workspace"] == "myws"++# ── GET /api/media (remote image display) ───────────────────────────