You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(#217): rate-limit key rotation no longer consumes retry attempts
Key rotation on a 429 burned one MAX_TRANSLATION_ATTEMPTS attempt per
rotation, so with the default of 2 attempts a 3-key pool never tried key 3
and never raised RateLimitError: chunks failed silently (untranslated
output) in exactly the multi-key setups the pool was built for, and the
pipeline auto-pause never engaged.
Separate the budgets: providers now run a while loop where only transient
errors (timeout, 5xx, bad JSON) increment the attempt counter, while 429s
increment their own rate_limit_events counter. handle_rate_limit() gets an
explicit budget of pool_size + max_attempts - 1 rate-limit events per
request (one rotation per key plus the historical single-key sleep-waits),
past which it raises RateLimitError even if a key has recovered, guarding
against an unbounded rotate loop.
Single-key behavior is unchanged (sleep once, then raise). Applies to all
six pooled providers: gemini, openai-compatible, mistral, deepseek, poe,
openrouter.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0 commit comments