The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
docs(fallback): fold the stranded #20465 comment into its branch; keep the pool docstring caller-free
kshitijk4poor74449250c78c
diff --git a/agent/agent_runtime_helpers.py b/agent/agent_runtime_helpers.pyindex 5859c1ca209..db2ca1a0671 100644--- a/agent/agent_runtime_helpers.py+++ b/agent/agent_runtime_helpers.py@@ -1327,15 +1327,10 @@ def restore_primary_runtime(agent) -> bool:(long-lived CLI agents and the gateway's cached agents)."""if not agent._fallback_activated:# Reset the index even without activation: a failed _try_activate_fallback() can strand- # _fallback_index past the chain end and silently block future fallbacks.+ # _fallback_index past the chain end and silently block future fallbacks (#20465).agent._fallback_index = 0_revert_credential_rotation(agent)return False- # Reset the chain index even when no fallback was activated this turn. Without this, a turn where- # _try_activate_fallback() was called but returned False (chain exhausted or provider not configured)- # leaves _fallback_index >= len(_fallback_chain) while _fallback_activated stays False. The next turn- # skips this block entirely, stranding the index and silently blocking all future fallback attempts for- # the session. Fixes #20465.rt = agent._primary_runtimeprimary_provider = str((rt or {}).get("provider") or "").strip().lower()primary_model = str((rt or {}).get("model") or "").strip()diff --git a/agent/credential_pool.py b/agent/credential_pool.pyindex 4ad5d303ee7..0cda36c68c5 100644--- a/agent/credential_pool.py+++ b/agent/credential_pool.py@@ -1051,9 +1051,8 @@ class CredentialPool(CredentialPoolAdminMixin, CredentialPoolModelCooldownMixin)def lift_reopened_cooldowns(self, *, model: Optional[str] = None) -> bool:"""Clear cooldowns that have elapsed or (Codex) reopened early, then report availability.- The lift ``select()`` performs, without leasing an entry: ``has_available`` and- ``next_available_at`` never run the early-reopen probe, so a caller that only gates on- them (the fallback restore) waits out the whole declared reset window.+ The lift ``select()`` performs, without leasing an entry. ``has_available`` and+ ``next_available_at`` never run the early-reopen probe."""with self._lock:available, _pending = self._available_entries(clear_expired=True, model=model)