Feature Request: Auto-resume CLI session when usage limit resets
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:
- Turn fails with usage limit reached.
- Codex reads the reset time it already knows about (
resets_atinUsageLimitReachedError). - Instead of erroring out, Codex sleeps until that time and then re-runs the same turn.
- 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.rs → UsageLimitReachedError.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.
10 Comments
Yes. Need this.
@etraut-openai need this though hope you consider.
It shouldn't just be on quota reset. There should also be automatic recovery from internet connection failures.
Codex retries to reestablish a connection, but these do nothing if all the retries are done before the connection recovers.
https://github.com/openai/codex/issues/22033
oh god please add this feature. :(
+1
Please enable this!
Adding one datapoint from the external-tool side while a native Codex fix is pending: I built Agent Island for this exact sleep/AFK case.
It runs outside the CLI as a small macOS watchdog for selected Claude/Codex sessions:
continueThis is not a replacement for the native
resets_athandling proposed here; Codex should still support this directly. But if anyone needs the workflow today, the repo is here:https://github.com/tristan666666/agent-island
We need this please
Confirmed the same gap specifically with a durable Codex Goal in the macOS app.
Observed state after quota exhaustion:
The UI reported the reset time, but reaching that time did not generate a continuation turn. The goal only resumed after a new user message. This is particularly surprising for Goal mode because the durable objective and continuation contract are still present, yet
usageLimitedbehaves as a terminal scheduler state rather than a timed waiting state.Suggested Goal-specific behavior:
resets_attogether with the goal state.usageLimited -> waiting_for_quota.resets_atplus bounded jitter, revalidate quota and enqueue exactly one synthetic continuation.This complements the CLI proposal here: the same primitive should work for App Goal continuations, not only a foreground CLI process sleeping until reset.
I ended up building this as an external tool while waiting for native support:
https://github.com/saaranshM/unsnooze
Codex turned out to be a little fiddly because there's no event when a session stops due to a usage limit. Instead, unsnooze watches the terminal for the exact limit banners used by Codex and handles all of the reset formats it emits:
When the limit expires, it resumes the original session with
codex resume <session-id>.The pleasant surprise was discovering that the rollout files under
~/.codex/sessionscontain the actual reset timestamp as a Unix epoch. That means the wait is based on the exact server-provided reset time rather than parsing human-readable text, and it works equally well for the CLI, the IDE extension, and the ChatGPT desktop app because they all write the same rollout data.It's MIT licensed, installs with:
```bash id="v1h2tm"
npm i -g unsnooze