From 0c376841dc8ecada4f98b764c33c2cb73892fc4b Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Sun, 12 Apr 2026 21:58:44 -0700 Subject: [PATCH] fix(run_agent): use public default_headers attr when preserving routed client headers The OpenAI Python SDK stores default headers on the public attribute, not the private . Because the code checked for the private attribute, provider-specific headers (e.g. Kimi's User-Agent) were silently dropped, causing 403 errors for Kimi Coding API users. Fixes #8779 --- run_agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run_agent.py b/run_agent.py index 37572db5e1..18ac8210df 100644 --- a/run_agent.py +++ b/run_agent.py @@ -886,8 +886,8 @@ class AIAgent: "base_url": str(_routed_client.base_url), } # Preserve any default_headers the router set - if hasattr(_routed_client, '_default_headers') and _routed_client._default_headers: - client_kwargs["default_headers"] = dict(_routed_client._default_headers) + if hasattr(_routed_client, 'default_headers') and _routed_client.default_headers: + client_kwargs["default_headers"] = dict(_routed_client.default_headers) else: # When the user explicitly chose a non-OpenRouter provider # but no credentials were found, fail fast with a clear