fix: retain exhausted-chain cooldown classification after extraction

This commit is contained in:
Teknium
2026-09-07 02:17:02 -07:00
parent fb2f66f586
commit 68b16aa7e3
+1
View File
@@ -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)