Skip to content

The agent that grows with you

refactor(auxiliary): drop the redundant key normalization on the live-runtime path

kshitijk4poorde64070452fd
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.py
index 8d2d3569a37..8384858b7e6 100644
--- a/agent/auxiliary_client.py
+++ b/agent/auxiliary_client.py
@@ -2526,7 +2526,7 @@ def _read_main_api_key_if_same_origin(aux_base_url: str) -> Union[str, Callable[
if live.get("base_url") or live.get("api_key"):
if aux_origin != base_url_origin(live.get("base_url", "")):
return ""
- return _normalize_api_key(live.get("api_key", ""))
+ return live.get("api_key", "")
if aux_origin != base_url_origin(_read_main_base_url()):
return ""
return _read_main_api_key()
diff --git a/tests/agent/test_auxiliary_client.py b/tests/agent/test_auxiliary_client.py
index 8424e3d64d6..1d2cf179c88 100644
--- a/tests/agent/test_auxiliary_client.py
+++ b/tests/agent/test_auxiliary_client.py
@@ -4855,8 +4855,7 @@ class TestCustomEndpointApiKeyInheritance:
aux.shutdown_cached_clients()
aux.clear_runtime_main()
- assert served[:2] == ["sk-first-session", "sk-second-session"]
- assert served[2] == expected_third # keyless explicit endpoint → placeholder; runtime endpoint → no client
+ assert served == ["sk-first-session", "sk-second-session", expected_third]
class TestNoProgressTimeoutTaskConfigGating:
diff --git a/tests/agent/test_auxiliary_ollama_local_provider.py b/tests/agent/test_auxiliary_ollama_local_provider.py
index e6dcb8187b0..84ae4651c71 100644
--- a/tests/agent/test_auxiliary_ollama_local_provider.py
+++ b/tests/agent/test_auxiliary_ollama_local_provider.py
@@ -20,7 +20,7 @@ import pytest
def _keyless_environment(monkeypatch):
for key in ("OPENAI_API_KEY", "OPENAI_BASE_URL"):
monkeypatch.delenv(key, raising=False)
- # The key ladder inherits the main config's key on a host match; the placeholder
+ # The key ladder inherits the main config's key on a same-origin match; the placeholder
# assertions below need that rung empty.
with patch("agent.auxiliary_client._read_main_api_key_if_same_origin", return_value=None):
yield
@@ -44,7 +44,7 @@ def _client_attr(client, attr: str) -> str:
("", "", "no-key-required"),
("test-key-123", "", "test-key-123"),
# SECURITY: a keyless local-server lane must not borrow OPENAI_API_KEY (or the main
- # key on a host match) — that would send an OpenAI secret to the lane's base_url.
+ # key on a same-origin match) — that would send an OpenAI secret to the lane's base_url.
("", "sk-USER-OPENAI-SECRET", "no-key-required"),
],
)