Skip to content

fix(generation): retry a 429 instead of aborting the pipeline - #558

Open
pcbeingused333 wants to merge 1 commit into
OpenBMB:mainfrom
pcbeingused333:fix/generation-retry-rate-limit
Open

pcbeingused333 wants to merge 1 commit into
OpenBMB:mainfrom
pcbeingused333:fix/generation-retry-rate-limit

Conversation

@pcbeingused333

Copy link
Copy Markdown

The OpenAI and LiteLLM generation backends back off and retry on 5xx errors and timeouts, but a RateLimitError (HTTP 429) raised ToolError on the first attempt, so one rate-limited request stopped the whole pipeline step.

A 429 now takes the same path as the other transient errors: it is logged and the loop sleeps with the existing backoff before the next attempt. No new retry policy; after retries attempts the result is <error>, as for 5xx.

Adds test_rate_limit_is_retried_instead_of_aborting for the LiteLLM backend and a new test_openai_backend.py for the OpenAI one (a fake client returns 429 then a completion). Both fail on main (the first attempt raises ToolError) and pass with the change; the existing generation tests still pass. Not run against a live API.

This change was prepared with the assistance of an AI agent (Claude), on behalf of the PR author.

The openai and litellm backends already back off and retry 5xx errors and
timeouts, but a RateLimitError raised ToolError at once. Treat it like the
other transient errors.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant