Skip to content

The agent that grows with you

refactor(agent/agent_init): fix model_thresholds parse on absent key; repoint banner source-pin test to _print_key_banner

Teknium9f1ab5a7f2a6
diff --git a/tests/run_agent/test_callable_api_key.py b/tests/run_agent/test_callable_api_key.py
index 6588da27a15..1e32c1a990c 100644
--- a/tests/run_agent/test_callable_api_key.py
+++ b/tests/run_agent/test_callable_api_key.py
@@ -282,13 +282,16 @@ class TestInlinedDisplayMasks:
from pathlib import Path
src = (Path(__file__).resolve().parent.parent.parent
/ "agent" / "agent_init.py").read_text()
- assert src.count("is_token_provider(") >= 2, (
+ # Both banner paths route through the shared ``_print_key_banner`` helper,
+ # which owns the single ``is_token_provider`` guard.
+ assert src.count("_print_key_banner(") >= 3, (
"agent/agent_init.py must guard BOTH masked-banner paths "
"(chat_completions and anthropic_messages) with "
- "is_token_provider()."
+ "is_token_provider() via _print_key_banner()."
)
- assert src.count('"πŸ”‘ Using credentials: Microsoft Entra ID"') >= 2, (
- "agent/agent_init.py banner blocks should print a static "
+ assert "is_token_provider(" in src
+ assert '"πŸ”‘ Using credentials: Microsoft Entra ID"' in src, (
+ "agent/agent_init.py banner helper should print a static "
"'Microsoft Entra ID' label for callable api_keys β€” no "
"placeholder plumbing, no describe-mask fallback."
)