mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
refactor: invalidate transport cache when api_mode auto-upgrades to codex_responses
Follow-up for #13862 — the post-init api_mode upgrade at __init__ (direct OpenAI / gpt-5-requires-responses path) runs AFTER the eager transport warm. Clear the cache so the stale chat_completions entry is evicted. Cosmetic: correctness was already fine since _get_transport() keys by current api_mode, but this avoids leaving unused cache state behind.
This commit is contained in:
parent
d30ee2e545
commit
c78a188ddd
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue