[Bug]: Codex usage-limit failures on a fresh session have no reset time, so auto-resume never arms #29277
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
- Use a Codex account whose usage limit is already exhausted (weekly window at 100%).
- Turn on Settings → Usage limits → Resume after usage limits (environment-wide or for the project).
- Start a new Codex thread and send any message. This is the first turn on a fresh Codex session.
- The run fails with the usage-limit error, e.g.
You've hit your usage limit. … try again at Nov 4th, 2026 3:39 AM.
Expected behavior#
The failure carries the reset time, so the thread is armed and resumes on its own at the reset, the same way it does when the limit is reached mid-session.
Actual behavior#
The error turn item is classified correctly but has no reset time:
{"class":"usage_limit","code":"usageLimitExceeded","retryable":null,"resetAt":null}
With resetAt: null the thread never becomes a recovery candidate, so nothing is armed and it never resumes. It stays like that: no account/rateLimits/updated notification arrives afterwards, because usage does not change while the account is limited.
Codex does know the reset time. Asking the same app-server directly with account/rateLimits/read returns the exhausted window and its reset:
{"limitId":"codex","primary":{"usedPercent":0,"windowDurationMins":300,"resetsAt":1793638321},"secondary":{"usedPercent":100,"windowDurationMins":10080,"resetsAt":1793774386},"planType":"plus","rateLimitReachedType":"rate_limit_reached"}
codexUsageLimitResetAt would return 2026-11-04T06:39:46Z for that snapshot.
Cause: CodexAdapterV2 fills resetAt only from its rateLimitSnapshot Ref (emitRootTerminal and the terminal-failure path), and that Ref is populated only by the account/rateLimits/updated notification. On a fresh session that is already limited the notification never comes, so the snapshot stays undefined. CodexProvider.ts does call account/rateLimits/read, but only for the provider status probe; the adapter never reads it.
Impact#
Major degradation or frequent failure
Auto-resume after usage limits never works for Codex when the limit is hit on the first turn of a session, which is common: the limit is reached in one thread, then the next thread or a restarted session starts already limited. Manual Resume at reset has nothing to schedule either.
Version or commit#
main @ 47f2c8d29e
Environment#
macOS 27.2, T3 Code dev build from source (vp run dev, isolated worktree state), Codex CLI 0.163.0, model gpt-5.6-luna, ChatGPT Plus account.
Logs or stack traces#
Thread mcp:a46e9380-… stopped with status failed: You've hit your usage limit. Upgrade to Pro (…), visit https://chatgpt.com/settings/usage to purchase more credits or try again at Nov 4th, 2026 3:39 AM.
Workaround#
None. The user has to notice the failure and send a message again after the reset.
Found while verifying #26378 end to end. I have a fix ready and will open a PR that links here.
juliusmarminge closed this
Sign in to join this conversation.
Fixed by #27791, merged as 80e1e4d. The adapter now reads available Codex rate limits before publishing a first-request usage-limit failure without a reset, allowing recovery to arm. Thanks for the detailed report and reproduction!