Skip to content

The agent that grows with you

fix: pin direct-alias rung of custom key_env resolution

teknium19641e60c8efb
diff --git a/tests/hermes_cli/test_runtime_provider_resolution.py b/tests/hermes_cli/test_runtime_provider_resolution.py
index ebb0703a77d..3d2815d2ace 100644
--- a/tests/hermes_cli/test_runtime_provider_resolution.py
+++ b/tests/hermes_cli/test_runtime_provider_resolution.py
@@ -1992,6 +1992,14 @@ def test_bare_custom_resolves_model_key_env_for_configured_base_url(monkeypatch)
monkeypatch.setenv("CUSTOM_BASE_URL", "https://other.example.test/v1")
assert rp.resolve_runtime_provider(requested="custom")["api_key"] == "no-key-required"
+ # Direct-alias rung (`hermes --resume` provider change, `/model` direct aliases pass explicit_base_url):
+ # the declared key follows the configured endpoint and stays home for any other endpoint.
+ monkeypatch.delenv("CUSTOM_BASE_URL", raising=False)
+ direct = rp.resolve_runtime_provider(requested="custom", explicit_base_url="https://api.example.test/v1")
+ assert (direct["source"], direct["api_key"]) == ("direct-alias", "scw-real-key-0123456789abcdef")
+ other = rp.resolve_runtime_provider(requested="custom", explicit_base_url="https://other.example.test/v1")
+ assert other["api_key"] == "no-key-required"
+
def test_configured_key_env_resolving_empty_is_logged(monkeypatch, caplog):
"""#67453: a declared ``key_env`` whose variable is unset used to be laundered silently into