Skip to content

fix: increase OpenAI client max_retries to handle 429 rate limits#245

Merged
gvanrossum merged 1 commit intomicrosoft:mainfrom
KRRT7:fix/openai-retry-rate-limits
Apr 23, 2026
Merged

fix: increase OpenAI client max_retries to handle 429 rate limits#245
gvanrossum merged 1 commit intomicrosoft:mainfrom
KRRT7:fix/openai-retry-rate-limits

Conversation

@KRRT7
Copy link
Copy Markdown
Contributor

@KRRT7 KRRT7 commented Apr 23, 2026

Summary

  • Bumps max_retries from the default (2) to 5 across all four AsyncOpenAI/AsyncAzureOpenAI construction sites (create_async_openai_client and _make_azure_provider)
  • The openai SDK's built-in exponential backoff handles transient 429s automatically — this just gives it more attempts
  • Three online tests (test_ingest_podcast, test_query_method_basic, test_transcript_knowledge_extraction_slow) were failing intermittently due to 429s

Test plan

The default max_retries=2 is too low for bursty workloads. Bump to 5
across all four AsyncOpenAI/AsyncAzureOpenAI construction sites so the
built-in exponential backoff handles transient 429s.
gvanrossum pushed a commit that referenced this pull request Apr 23, 2026
## Summary
- Adds 3 tests for `resolve_azure_model_name` covering: deployment name
extraction from endpoint, fallback to provided model name, and default
`AZURE_OPENAI_ENDPOINT` envvar usage
- Fixes `test_create_embedding_model_uses_azure_deployment_name` —
wasn't clearing `OPENAI_EMBEDDING_MODEL` from the environment, so the
assertion failed when that envvar was set
- Addresses review comment from #241

## Test plan
- [x] `make check` (pyright) — 0 errors
- [x] `pytest tests/test_utils.py tests/test_model_adapters.py` — 33/33
pass
- [x] `make test` — 496 pass, 3 fail (all transient 429 rate limits,
addressed in #245)
@gvanrossum gvanrossum merged commit f707547 into microsoft:main Apr 23, 2026
16 checks passed
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.

2 participants