Repository navigation
Conversation
Signed-off-by: crazywolf132 <[email protected]>
|
ci failure change looks great in general, ty! |
addressed |
d3df4a7 to
7b6f490
Compare
|
the underlying cause of the failed type check here is the lack of the I have the type-checking fixed here (ideally just cherry-pick |
|
also, like other users in #137, rate_limit_exceeded crashes still occur in both the main branch, and also on this PR branch |
|
@main-horse fixed the type error in #228, please incorporate that here and I will merge |
|
to be clear, this pull request does not appear to fully resolve the issue. here is an example result from my last commit: [Error]: Rate limit reached for o4-mini in organization org-gHZLO7nuyDlyd5zXmeMhgfLC on tokens per min (TPM): Limit 200000, Used 153935, Requested 50854. Please try again in 1.436s. Visit https://platform.openai.com/account/rate-limits to learn more.
at e.a [as iterator] (file:///home/main/codex/codex-cli/dist/cli.js:445:1514)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async E0.run (file:///home/main/codex/codex-cli/dist/cli.js:462:3049) {
status: undefined,
headers: undefined,
request_id: undefined,
error: {
type: 'tokens',
code: 'rate_limit_exceeded',
message: 'Rate limit reached for o4-mini in organization org-gHZLO7nuyDlyd5zXmeMhgfLC on tokens per min (TPM): Limit 200000, Used 153935, Requested 50854. Please try again in 1.436s. Visit https://platform.openai.com/account/rate-limits to learn more.',
param: null
},
code: 'rate_limit_exceeded',
param: null,
type: 'tokens'
}you can also see exactly what i did as an asciinema recording in case it helps (also I hope some maintainer can delete the PR I made... it's locked and I can't modify it) |
Doing that. |
Do you have a suggested fix here, would be stellar to dig further into this and fix the root cause. Lots of folks are running into rate limiting issues. |
|
Solves for #233 |
|
Checkout #266 @tibo-openai I think this might be a much simpler bug than we imagine |
|
@jonchurch I'm still getting this with gpt-4.1. Built from |
|
@crazywolf132 are you still interested in pushing this forward? The changes in this PR are good to have and would like to decide whether to let others implement something similar or whether this one is the one that should get through. |
|
Planning on continuing this PR, will return in around 24 hours. If the issue is too critical, more than happy for someone else to take over so I am not a blocker |
|
@tibo-openai good to go |
|
why is this not merged yet |
|
This branch (specifically the version at https://github.com/scottleibrand/codex/tree/feat/rate-limit-backoff with merge conflicts and tests fixed) does not resolve the issue for me: Will try #357 next. |
|
FWIW I also opened #506 with an attempt at a minimal implementation of #357. I'm not sure if that is more of a substitute or a complement to the changes here: I'll defer to someone who actually knows what's going on to decide whether my observations are relevant to whether to continue forward with this PR. |
|
@scottleibrand Please verify if the last version of this branch addresses the issue |
|
I've checked out the latest version of the branch and I still receive the error: It seemed to take longer to hit the limit, but it's still been hit. |
|
We have merged a number of improvements here and I will now close this one as I judge it as not necessary anymore. Thank you for the effort that went into making hitting rate limits more resilient! |
Return drained tool errors to the turn loop so code-mode infrastructure failures abort cleanly instead of panicking a worker and timing out the session. Closes openai#176 Co-authored-by: GPT-5.6 Sol <[email protected]>
Return drained tool errors to the turn loop so code-mode infrastructure failures abort cleanly instead of panicking a worker and timing out the session. Closes openai#176 Co-authored-by: GPT-5.6 Sol <[email protected]>
Return drained tool errors to the turn loop so code-mode infrastructure failures abort cleanly instead of panicking a worker and timing out the session. Closes openai#176 Co-authored-by: GPT-5.6 Sol <[email protected]>

Description
This PR implements a more sophisticated rate limit handling mechanism with exponential backoff and jitter (Fixes #137). When the API returns a rate limit error, the client will now use a configurable exponential backoff strategy with jitter to avoid the "thundering herd" problem.
Changes
Benefits
Testing
Additional Notes
The default settings are: