The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(auxiliary): prove the origin check through a real config.yaml task route
John Paul Soliva98e76509033f
diff --git a/tests/agent/test_auxiliary_client.py b/tests/agent/test_auxiliary_client.pyindex 0e339ed502f..d8fafcb11d8 100644--- a/tests/agent/test_auxiliary_client.py+++ b/tests/agent/test_auxiliary_client.py@@ -4794,22 +4794,27 @@ class TestCustomEndpointApiKeyInheritance:("http://gw.example.com/v1", False),("https://gw.example.com:8443/v1", False),])- def test_main_key_follows_only_the_identical_origin(self, monkeypatch, aux_base_url, inherits):+ def test_main_key_follows_only_the_identical_origin(self, tmp_path, monkeypatch, aux_base_url, inherits):"""Same hostname is not the same endpoint: a different scheme or port must not- receive the main key; the identical origin (default port spelled out) still does."""- import agent.auxiliary_client as ac+ receive the main key; the identical origin (default port spelled out) still does.+ Real config.yaml under a temp HERMES_HOME, resolved through the task route."""+ import hermes_yaml as yamlmonkeypatch.delenv("OPENAI_API_KEY", raising=False)- fake_config = {"model": {"api_key": "sk-main-config-key", "base_url": "https://gw.example.com/v1"}}- captured: dict = {}+ monkeypatch.delenv("OPENAI_BASE_URL", raising=False)+ home = tmp_path / ".hermes"+ home.mkdir()+ (home / "config.yaml").write_text(yaml.safe_dump({+ "model": {"provider": "custom", "base_url": "https://gw.example.com/v1",+ "api_key": "sk-main-config-key", "default": "main-model"},+ "auxiliary": {"compression": {"provider": "custom", "base_url": aux_base_url, "model": "aux-model"}},+ }))+ monkeypatch.setenv("HERMES_HOME", str(home))- with patch("hermes_cli.config.load_config", return_value=fake_config), \- patch("hermes_cli.config.load_config_readonly", return_value=fake_config), \- patch.object(ac, "_create_openai_client", side_effect=lambda **kw: captured.update(kw) or MagicMock()):- resolve_provider_client("custom", model="test-model",- explicit_base_url=aux_base_url, explicit_api_key=None)+ client, model = get_text_auxiliary_client("compression")- assert (captured.get("api_key") == "sk-main-config-key") is inherits+ assert model == "aux-model"+ assert (client.api_key == "sk-main-config-key") is inheritsclass TestNoProgressTimeoutTaskConfigGating: