Skip to content

The agent that grows with you

test(memory): host-block router tests use a fixture provider, not the removed bundled honcho

teknium1bbff6cdf68eb
diff --git a/tests/hermes_cli/test_web_server.py b/tests/hermes_cli/test_web_server.py
index 3bb104ea317..4ff88b161b9 100644
--- a/tests/hermes_cli/test_web_server.py
+++ b/tests/hermes_cli/test_web_server.py
@@ -931,15 +931,16 @@ CONFIG_SCHEMA = ProviderConfigSchema(
return real_run(command, **kwargs)
monkeypatch.setattr(web_server.subprocess, "run", guarded_run)
+ self._install_flatprov()
- resp = self.client.post("/api/memory/providers/honcho/setup", json={"values": {}})
+ resp = self.client.post("/api/memory/providers/flatprov/setup", json={"values": {}})
assert resp.status_code == 200
data = resp.json()
pip_rows = [row for row in data["results"] if row["kind"] == "pip"]
assert pip_rows and pip_rows[0]["status"] == "installed"
assert pip_rows[0]["command"] == "hermes pm install"
- assert prepared == ["honcho"]
+ assert prepared == ["flatprov"]
def test_put_memory_provider_config_writes_config_and_secret(self):
@@ -999,42 +1000,103 @@ CONFIG_SCHEMA = ProviderConfigSchema(
assert "secret-value" not in json.dumps(data)
- # ── Memory provider config (Honcho host-block backend) ──────────────
+ # ── Memory provider config (host-block backend) ─────────────────────
+ # ``honcho_host_block`` storage is a host contract a catalog provider opts into. The core
+ # router reaches four names in the provider's own modules; this fixture is that contract.
- @pytest.fixture(autouse=True)
- def _isolate_honcho_config(self):
- # Honcho tests write the suite-wide HERMES_HOME honcho.json; snapshot and
- # restore it so provider status/config state never leaks across tests.
- from hermes_constants import get_hermes_home
+ _HOSTPROV_INIT = """
+from agent.memory_provider import MemoryProvider
- path = get_hermes_home() / "honcho.json"
- before = path.read_bytes() if path.exists() else None
- yield
- if before is None:
- path.unlink(missing_ok=True)
- else:
- path.write_bytes(before)
- @staticmethod
- def _seed_local_honcho(cfg=None):
- from hermes_constants import get_hermes_home
+class HostProv(MemoryProvider):
+ name = "hostprov"
+
+ def is_available(self):
+ return True
+
+ def initialize(self, session_id, **kwargs):
+ pass
+
+ def get_tool_schemas(self):
+ return []
+
+
+def register(ctx):
+ ctx.register_memory_provider(HostProv())
+"""
+ _HOSTPROV_CLIENT = """
+from hermes_constants import get_hermes_home
+
+
+def resolve_active_host():
+ return "hermes"
- path = get_hermes_home() / "honcho.json"
- path.parent.mkdir(parents=True, exist_ok=True)
- path.write_text(json.dumps(cfg if cfg is not None else {}), encoding="utf-8")
- return path
+def resolve_config_path():
+ return get_hermes_home() / "hostprov.json"
- def test_put_honcho_writes_host_block_root_and_secret(self, monkeypatch, tmp_path):
- monkeypatch.setenv("HOME", str(tmp_path))
- monkeypatch.setenv("HONCHO_API_KEY", "guard")
- monkeypatch.delenv("HONCHO_API_KEY")
- self._seed_local_honcho()
+
+def _host_block(cfg, host):
+ return (cfg.get("hosts") or {}).get(host) or {}
+"""
+ _HOSTPROV_OAUTH = """
+import contextlib
+import json
+import threading
+
+ACCESS_TOKEN_PREFIX = "oat_"
+_refresh_lock = threading.Lock()
+
+
+def _config_refresh_lock(path):
+ yield
+
+
+def _read_config_strict(path):
+ return json.loads(path.read_text(encoding="utf-8")) if path.exists() else {}
+"""
+ _HOSTPROV_SCHEMA = """
+from plugins.memory.config_schema import (
+ KIND_SECRET, KIND_SELECT, KIND_TEXT, STORAGE_HONCHO_HOST_BLOCK, ProviderConfigSchema, ProviderField,
+ ProviderFieldOption,
+)
+
+CONFIG_SCHEMA = ProviderConfigSchema(
+ name="hostprov",
+ label="Host-block Provider",
+ storage=STORAGE_HONCHO_HOST_BLOCK,
+ fields=(
+ ProviderField(key="apiKey", label="API key", kind=KIND_SECRET, description="", env_key="HOSTPROV_API_KEY"),
+ ProviderField(key="baseUrl", label="Base URL", kind=KIND_TEXT, description="", scope="root"),
+ ProviderField(key="environment", label="Environment", kind=KIND_SELECT, description="", default="production",
+ options=(ProviderFieldOption("production", "Cloud"), ProviderFieldOption("local", "Local"))),
+ ProviderField(key="workspace", label="Workspace", kind=KIND_TEXT, description=""),
+ ProviderField(key="peerName", label="Peer name", kind=KIND_TEXT, description=""),
+ ProviderField(key="aiPeer", label="AI peer", kind=KIND_TEXT, description=""),
+ ProviderField(key="sessionStrategy", label="Session strategy", kind=KIND_TEXT, description=""),
+ ),
+)
+"""
+
+ def _install_hostprov(self):
from hermes_constants import get_hermes_home
+
+ plugin_dir = get_hermes_home() / "plugins" / "hostprov"
+ plugin_dir.mkdir(parents=True, exist_ok=True)
+ for module, source in (("__init__", self._HOSTPROV_INIT), ("client", self._HOSTPROV_CLIENT),
+ ("oauth", self._HOSTPROV_OAUTH), ("config_schema", self._HOSTPROV_SCHEMA)):
+ (plugin_dir / f"{module}.py").write_text(source, encoding="utf-8")
+ config_path = get_hermes_home() / "hostprov.json"
+ config_path.write_text("{}", encoding="utf-8")
+ return config_path
+
+ def test_put_host_block_writes_host_block_root_and_secret(self):
from hermes_cli.config import load_config, load_env
+ config_path = self._install_hostprov()
resp = self.client.put(
- "/api/memory/providers/honcho/config?surface=declared",
+ "/api/memory/providers/hostprov/config?surface=declared",
json={
"values": {
"apiKey": "hch-test-key",
@@ -1050,10 +1112,10 @@ CONFIG_SCHEMA = ProviderConfigSchema(
assert resp.status_code == 200
assert resp.json() == {"ok": True}
- assert load_config()["memory"]["provider"] == "honcho"
- assert load_env()["HONCHO_API_KEY"] == "hch-test-key"
+ assert load_config()["memory"]["provider"] == "hostprov"
+ assert load_env()["HOSTPROV_API_KEY"] == "hch-test-key"
- cfg = json.loads((get_hermes_home() / "honcho.json").read_text(encoding="utf-8"))
+ cfg = json.loads(config_path.read_text(encoding="utf-8"))
# baseUrl is root-scoped; the rest live in the active host block.
assert cfg["baseUrl"] == "https://honcho.example.dev"
assert cfg["hosts"]["hermes"]["workspace"] == "myws"
@@ -1064,18 +1126,14 @@ CONFIG_SCHEMA = ProviderConfigSchema(
assert cfg["hosts"]["hermes"]["apiKey"] == "hch-test-key"
- def test_get_honcho_config_does_not_return_secret(self, monkeypatch, tmp_path):
- monkeypatch.setenv("HOME", str(tmp_path))
- monkeypatch.setenv("HONCHO_API_KEY", "guard")
- monkeypatch.delenv("HONCHO_API_KEY")
- self._seed_local_honcho()
-
+ def test_get_host_block_config_does_not_return_secret(self):
+ self._install_hostprov()
self.client.put(
- "/api/memory/providers/honcho/config?surface=declared",
+ "/api/memory/providers/hostprov/config?surface=declared",
json={"values": {"apiKey": "secret-value"}},
)
- resp = self.client.get("/api/memory/providers/honcho/config?surface=declared")
+ resp = self.client.get("/api/memory/providers/hostprov/config?surface=declared")
assert resp.status_code == 200
data = resp.json()
diff --git a/tests/plugins/memory/test_discovery_sources.py b/tests/plugins/memory/test_discovery_sources.py
index f19f4119222..439de730ef0 100644
--- a/tests/plugins/memory/test_discovery_sources.py
+++ b/tests/plugins/memory/test_discovery_sources.py
@@ -109,12 +109,12 @@ def test_bundled_still_wins_over_project(tmp_path, monkeypatch):
PluginManager's later-wins order. A provider is activated by name, so a
directory dropped into the working tree must not be able to shadow a
shipped one and silently redirect the agent's memory."""
- _write_provider_dir(tmp_path / ".hermes" / "plugins", "honcho")
+ _write_provider_dir(tmp_path / ".hermes" / "plugins", "holographic")
monkeypatch.chdir(tmp_path)
monkeypatch.setenv("HERMES_ENABLE_PROJECT_PLUGINS", "1")
- resolved = memory_plugins.find_provider_dir("honcho")
- assert resolved == Path(memory_plugins.__file__).parent / "honcho"
+ resolved = memory_plugins.find_provider_dir("holographic")
+ assert resolved == Path(memory_plugins.__file__).parent / "holographic"
# ---------------------------------------------------------------------------