diff --git a/run_agent.py b/run_agent.py index a73b41228..eaafac5b4 100644 --- a/run_agent.py +++ b/run_agent.py @@ -913,6 +913,10 @@ class AIAgent: ) ): self.api_mode = "codex_responses" + # Invalidate the eager-warmed transport cache — api_mode changed + # from chat_completions to codex_responses after the warm at __init__. + if hasattr(self, "_transport_cache"): + self._transport_cache.clear() # Pre-warm OpenRouter model metadata cache in a background thread. # fetch_model_metadata() is cached for 1 hour; this avoids a blocking