diff --git a/plugins/memory/honcho/client.py b/plugins/memory/honcho/client.py index 08efe0beaea23..d8ef74f22b2a8 100644 --- a/plugins/memory/honcho/client.py +++ b/plugins/memory/honcho/client.py @@ -575,7 +575,9 @@ class HonchoClientConfig: else None ) base_url = ( - native_base_url + host_block.get("baseUrl") + or host_block.get("base_url") + or native_base_url or raw.get("baseUrl") or raw.get("base_url") or os.environ.get("HONCHO_BASE_URL", "").strip() diff --git a/tests/honcho_plugin/test_client.py b/tests/honcho_plugin/test_client.py index e3b117aceb738..7306f937fc05e 100644 --- a/tests/honcho_plugin/test_client.py +++ b/tests/honcho_plugin/test_client.py @@ -202,6 +202,18 @@ class TestFromGlobalConfig: # Should fall back to from_env without crashing assert isinstance(config, HonchoClientConfig) + def test_base_url_host_block_overrides_root_and_env(self, tmp_path): + """Host-specific baseUrl should win for self-hosted Honcho deployments.""" + config_file = tmp_path / "config.json" + config_file.write_text(json.dumps({ + "baseUrl": "http://root:9000", + "hosts": {"hermes": {"baseUrl": "http://host-block:9001"}}, + })) + + with patch.dict(os.environ, {"HONCHO_BASE_URL": "http://env:8000"}, clear=False): + config = HonchoClientConfig.from_global_config(config_path=config_file) + assert config.base_url == "http://host-block:9001" + class TestResolveSessionName: def test_manual_override(self):