The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(agent): Kimi Code fallback lands on anthropic_messages; lookalike host stays on chat_completions
kshitijk4poor562383ad31bb
diff --git a/tests/run_agent/test_fallback_api_mode_preservation.py b/tests/run_agent/test_fallback_api_mode_preservation.pyindex f4572975ed2..31778406145 100644--- a/tests/run_agent/test_fallback_api_mode_preservation.py+++ b/tests/run_agent/test_fallback_api_mode_preservation.py@@ -159,6 +159,21 @@ class TestOriginalUrlDetection:assert agent.api_mode == "anthropic_messages"assert mock_rpc.call_args.kwargs["api_mode"] == "anthropic_messages"+ def test_kimi_coding_hint_uses_the_messages_wire(self):+ """api.kimi.com/coding serves Anthropic Messages only; the fallback must not POST+ /chat/completions there (404, #77256). A lookalike host stays on chat_completions."""+ fbs = [{"provider": "kimi-coding", "model": "kimi-for-coding",+ "base_url": "https://api.kimi.com/coding/v1", "api_key": "k"}]+ agent = _make_agent(fallback_model=fbs)+ mock_rpc = _activate(agent, "https://api.kimi.com/coding", "kimi-for-coding")+ assert agent.api_mode == "anthropic_messages"+ assert mock_rpc.call_args.kwargs["api_mode"] == "anthropic_messages"++ lookalike = "https://api.kimi.com.attacker.test/coding/v1"+ agent = _make_agent(fallback_model=[{"provider": "custom", "model": "m", "base_url": lookalike, "api_key": "k"}])+ _activate(agent, lookalike, "m")+ assert agent.api_mode == "chat_completions"+class TestPlainFallbackUnchanged:def test_plain_openrouter_fallback_stays_chat_completions(self):