The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(aux): pin that a scoped runtime's key rotation stays out of the legacy mirrors
kshitijk4poor4c8d4148cade
diff --git a/tests/agent/test_anthropic_third_party_oauth_guard.py b/tests/agent/test_anthropic_third_party_oauth_guard.pyindex 84b48cf056d..3ad5a078c01 100644--- a/tests/agent/test_anthropic_third_party_oauth_guard.py+++ b/tests/agent/test_anthropic_third_party_oauth_guard.py@@ -164,6 +164,7 @@ class TestOAuthFlagOnRefresh:"""Production order: the turn publishes its aux runtime BEFORE the first request triggersthe silent refresh, so same-turn `auto` aux calls must still pick up the new token."""from agent import auxiliary_client as aux+ from agent.auxiliary_key_rotation import rotate_runtime_main_api_keyfrom agent.chat_completion_helpers import _context_thread_targetfrom agent.turn_context import _publish_runtime_main@@ -202,6 +203,11 @@ class TestOAuthFlagOnRefresh:"anthropic", agent.model, runtime.get("base_url", ""), runtime.get("api_key"), "anthropic_messages",)assert seen["api_key"] == new+ # A scoped runtime (normalized copy) rotates in place but never reaches the legacy mirrors.+ with aux.scoped_runtime_main({"provider": "anthropic", "api_key": old, "model": "m"}):+ rotate_runtime_main_api_key(old, new)+ assert aux._RUNTIME_MAIN_CONTEXT.get()["api_key"] == new+ assert (aux._RUNTIME_MAIN_MODEL, aux._RUNTIME_MAIN_API_KEY) == (agent.model, new)finally:aux.clear_runtime_main()