From 68b16aa7e3a39bda415c66df96ece127debaabc0 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Mon, 7 Sep 2026 02:17:02 -0700 Subject: [PATCH] fix: retain exhausted-chain cooldown classification after extraction --- agent/chat_completion_helpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/agent/chat_completion_helpers.py b/agent/chat_completion_helpers.py index c72584a1ac..e06c4b0b55 100644 --- a/agent/chat_completion_helpers.py +++ b/agent/chat_completion_helpers.py @@ -1716,6 +1716,7 @@ def _fallback_chain_exhausted(agent, reason: "FailoverReason | None") -> bool: """Chain exhausted (always False). A non-empty chain walked on a non-rate-limit failure arms a short cooldown so next turn's restore_primary_runtime stays gated instead of replaying the whole context across every provider again.""" + from agent.fallback_cooldown import _RATE_LIMIT_FAILOVER_REASONS if agent._fallback_chain and reason not in _RATE_LIMIT_FAILOVER_REASONS: agent._rate_limited_until = max( getattr(agent, "_rate_limited_until", 0) or 0, time.monotonic() + _FALLBACK_EXHAUSTED_COOLDOWN_S)