Skip to content

fix(fallback): trigger immediate failover on overloaded (529) errors - #60790

Open
AIalliAI wants to merge 1 commit into
NousResearch:mainfrom
AIalliAI:fix/60761-fallback-chain-overloaded
Open

fix(fallback): trigger immediate failover on overloaded (529) errors#60790
AIalliAI wants to merge 1 commit into
NousResearch:mainfrom
AIalliAI:fix/60761-fallback-chain-overloaded

Conversation

@AIalliAI

@AIalliAI AIalliAI commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Two fixes for fallback_providers that were broken in real-world conditions:

Bug 1: Overloaded (529) never triggers fallback

FailoverReason.overloaded was in the transport-failure set requiring retry_count >= 2, but with default api_max_retries=3 the retry budget was exhausted before reaching the threshold — fallback never activated.

Fix: Move overloaded to the rate-limit set (immediate failover, no retry threshold), matching Anthropic SDK behavior. Z.AI Coding Plan overload 429s preserve their existing long-backoff schedule.

Bug 2: Fallback entries permanently suppressed on transient errors

_unavailable_fallback_keys permanently suppressed nous fallback entries on ANY exception, including transient network errors, for the entire session lifetime.

Fix: Remove the blanket nous suppression from the except block. The existing local_skip_reason and fb_client-is-None guards already handle permanent config/auth problems.

Changes

  • agent/conversation_loop.py: overloaded → immediate failover (with Z.AI exception)
  • agent/chat_completion_helpers.py: remove permanent nous suppression

Fixes: #60761

…ousResearch#60761)

Two fixes for the fallback chain:

Bug 1: Provider overload (529) errors required retry_count >= 2 before
fallback would activate, but with default api_max_retries=3 the retry
budget was exhausted before the threshold was reached — fallback never
triggered. Treat overloaded like rate_limit: immediate failover without
retry threshold (matches Anthropic SDK behavior). Z.AI Coding Plan
overload 429s preserve their existing long-backoff schedule.

Bug 2: The _unavailable_fallback_keys set permanently suppressed nous
fallback entries on ANY exception, including transient network errors.
Remove the blanket suppression — the local_skip_reason + fb_client-is-None
guards already handle permanent config/auth problems.

Fixes: NousResearch#60761
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels Jul 8, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #60785 (created ~20 min earlier by @liuhao1024, also Closes #60761). Bug 1 (moving FailoverReason.overloaded into the immediate-failover set) is byte-identical between the two PRs. For Bug 2, #60785 implements the full TTL-based suppression dict the issue requested, whereas this PR only removes the nous suppression — a narrower subset. #60785 is the earlier, more complete fix. Cluster: #58355 / #50228 / #56037.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fallback chain never activates for 529 overloaded errors; once a fallback entry fails, it is permanently suppressed for the rest of the session

3 participants