codex - 💡(How to fix) Fix Feature Request: Auto-resume CLI session when usage limit resets [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#21073Fetched 2026-05-05 05:53:52
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×3renamed ×1

Error Message

When Codex hits the usage limit mid-task, the error already tells me exactly when the quota resets (e.g. "try again at 6:34 AM"). If that reset time falls while I'm asleep, the information is wasted — the task just dies and waits for me to wake up, find the session, and re-issue the prompt. The reset timestamp is already structured data in the protocol (codex-rs/protocol/src/error.rsUsageLimitReachedError.resets_at) and the session already updates rate limits on this error (codex-rs/core/src/session/turn.rs ~line 1075). Today we just throw the timestamp away and crash the turn. The ask is: use it.

Code Example

codex --auto-resume-on-limit

---

[usage_limits]
auto_resume = true
RAW_BUFFERClick to expand / collapse

What variant of Codex are you using?

CLI

What feature would you like to see?

When Codex hits the usage limit mid-task, the error already tells me exactly when the quota resets (e.g. "try again at 6:34 AM"). If that reset time falls while I'm asleep, the information is wasted — the task just dies and waits for me to wake up, find the session, and re-issue the prompt.

<img width="548" height="219" alt="Image" src="https://github.com/user-attachments/assets/0fd2c533-1613-468f-8732-31499c642afb" />

I'd like Codex to automatically continue the session at the reset time, without me being there.

Behavior:

  1. Turn fails with usage limit reached.
  2. Codex reads the reset time it already knows about (resets_at in UsageLimitReachedError).
  3. Instead of erroring out, Codex sleeps until that time and then re-runs the same turn.
  4. I wake up to a finished or in-progress task instead of a frozen one.

Why this is basically free to implement:

The reset timestamp is already structured data in the protocol (codex-rs/protocol/src/error.rsUsageLimitReachedError.resets_at) and the session already updates rate limits on this error (codex-rs/core/src/session/turn.rs ~line 1075). Today we just throw the timestamp away and crash the turn. The ask is: use it.

Make it opt-in so nothing changes for existing users:

codex --auto-resume-on-limit

or in ~/.codex/config.toml:

[usage_limits]
auto_resume = true

That's it — that's the feature.

Additional information

The screenshot shows the exact message in question: "try again at 6:34 AM". I was asleep at 6:34 AM. The agent could have just kept going.

Related: #15788 covers the App-side queueing of new prompts on usage limit. This is the CLI/session-resume sibling — same idea, different surface.

extent analysis

TL;DR

Implement an auto-resume feature that utilizes the existing resets_at timestamp in the UsageLimitReachedError to sleep until the quota resets and then re-run the same turn.

Guidance

  • Modify the turn.rs file (~line 1075) to handle the UsageLimitReachedError by sleeping until the resets_at time instead of crashing the turn.
  • Add an opt-in configuration option (--auto-resume-on-limit or auto_resume = true in ~/.codex/config.toml) to enable this feature without changing existing user behavior.
  • Update the error handling logic to parse the resets_at timestamp and schedule a retry at that time.
  • Consider implementing a queueing mechanism to handle multiple turns that are waiting for the quota to reset.

Example

// Pseudo-code example, actual implementation may vary
if let UsageLimitReachedError { resets_at } = error {
    let sleep_duration = resets_at - current_time;
    sleep(sleep_duration);
    retry_turn();
}

Notes

The implementation details may vary depending on the specific requirements and constraints of the Codex project. This guidance provides a general outline of the steps needed to implement the auto-resume feature.

Recommendation

Apply workaround: Implement the auto-resume feature as described, allowing users to opt-in to this behavior and providing a seamless experience when hitting usage limits.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Feature Request: Auto-resume CLI session when usage limit resets [1 participants]