Skip to content

Parse the Azure OpenAI rate limit message - #5956

Merged
etraut-openai merged 2 commits into
openai:mainfrom
tombl:push-qlmpzxuuqswu
Nov 1, 2025
Merged

etraut-openai merged 2 commits into
openai:mainfrom
tombl:push-qlmpzxuuqswu

Conversation

@tombl

@tombl tombl commented Oct 30, 2025

Copy link
Copy Markdown
Contributor

Fixes #4161

Currently Codex uses a regex to parse the "Please try again in 1.898s" OpenAI-style rate limit message, so that it can wait the correct duration before retrying. Azure OpenAI returns a different error that looks like "Rate limit exceeded. Try again in 35 seconds."

This PR extends the regex and parsing code to match in a more fuzzy manner, handling anything matching the pattern "try again in <duration><unit>".

@github-actions

github-actions Bot commented Oct 30, 2025 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@tombl

tombl commented Oct 30, 2025

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Oct 30, 2025
@tombl
tombl marked this pull request as draft October 30, 2025 09:31
@tombl
tombl force-pushed the push-qlmpzxuuqswu branch from 8d2d9c5 to ade1eaa Compare October 30, 2025 09:44
@tombl
tombl marked this pull request as ready for review October 30, 2025 12:59
@etraut-openai

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ 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".

Comment thread codex-rs/core/src/client.rs Resolved
Comment thread codex-rs/core/src/client.rs Resolved
Comment thread codex-rs/core/src/client.rs Resolved
Comment thread codex-rs/core/src/client.rs Resolved
@etraut-openai

Copy link
Copy Markdown
Contributor

Thanks for the contribution, and apologies for the slow response. We were overwhelmed by PR request, and we're catching up on the backlog.

I think this is a good change, but it would be better if it's a little more surgical. I'm guessing that it's AI-generated. Please take a look at my comments and questions.

@tombl
tombl force-pushed the push-qlmpzxuuqswu branch from 24df41c to e28332e Compare November 1, 2025 11:23
@tombl

tombl commented Nov 1, 2025

Copy link
Copy Markdown
Contributor Author

I've updated the PR to be the bare minimum diff necessary.

It was written with LLM assistance but ultimately the choice to defensively handle other units was mine. I've done some more research and it looks like Azure does always return seconds, so I've reverted that part.

(also your response wasn't slow at all, I'm used to corporate open source projects taking much longer to review community PRs, so thank you!)

@tombl
tombl requested a review from etraut-openai November 1, 2025 11:36
@etraut-openai

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ 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".

@etraut-openai
etraut-openai merged commit d9118c0 into openai:main Nov 1, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 2025
@etraut-openai

Copy link
Copy Markdown
Contributor

Thanks again for the contribution! This will improve the experience for a lot of Azure OpenAI users.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stream retry does not honor “Try again in x seconds” delays; falls back to exponential backoff

2 participants