Skip to content

fix(openai): avoid long Codex burst cooldown#2264

Closed
ronger-x wants to merge 1 commit intoWei-Shaw:mainfrom
ronger-x:codex/fix-openai-429-probe-recovery
Closed

fix(openai): avoid long Codex burst cooldown#2264
ronger-x wants to merge 1 commit intoWei-Shaw:mainfrom
ronger-x:codex/fix-openai-429-probe-recovery

Conversation

@ronger-x
Copy link
Copy Markdown

@ronger-x ronger-x commented May 7, 2026

Summary

  • Avoid writing Codex 429 5h/7d reset windows as long local cooldowns when those windows are not exhausted.
  • Add an OpenAI rate-limit probe recovery path so accounts hidden by rate_limit_reset_at can be retried when the normal scheduler has no viable account.
  • Add regression coverage for the fallback cooldown behavior and both normal/load-aware OpenAI selection paths.

Root Cause

Codex 429 responses can include long reset windows even when the corresponding used_percent values are below 100. The previous fallback selected the maximum reset value anyway, which could turn a short burst/RPM cooldown into a multi-hour account block. Once persisted, the main scheduler filtered those accounts before requests could reach the success-header cleanup path.

Validation

  • cd backend && go test -tags=unit ./internal/service -run "TestCalculateOpenAI429ResetTime|TestOpenAISelectAccount"

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA).

To sign, please reply with the following comment:

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

You only need to sign once — it will be valid for all your future contributions to this project.


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


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@ronger-x ronger-x closed this May 7, 2026
@ronger-x ronger-x deleted the codex/fix-openai-429-probe-recovery branch May 7, 2026 16:47
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