feat: add backoff on auth for 429/5xx responses#95
Conversation
Retry OAuth token fetch on transient HTTP failures with exponential backoff, jitter, and Retry-After support while honouring DIODE_MAX_AUTH_RETRIES. Co-authored-by: Cursor <cursoragent@cursor.com>
Coverage Report
|
||||||||||||||||||||||||||||||||||||||||
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44d170a709
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Apply jitter before the final min() so sleeps never exceed the configured max delay cap. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Restore develop formatting in client.py and test_client.py while keeping the OAuth retry/backoff behaviour, helper functions, README note, and tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Add retry/backoff on the OAuth2 token HTTP call when the auth endpoint returns transient failures.
What changed
/auth/tokenon429,500,502, and503only; other 4xx fail immediatelyRetry-Afteron429and503when present (seconds or HTTP-date), capped at 30sDIODE_MAX_AUTH_RETRIESfor total auth HTTP attempts (default3)DIODE_MAX_AUTH_RETRIESin READMEHow tested
pytest tests/test_client.pyruff check/ruff formaton changed filesMade with Cursor