You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]:Automatically pause and resume tasks when rate limits have a known reset time #43126
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
When a provider reports a specific rate-limit reset time, OpenCode could
persist the current session, pause it, and automatically resume it when
the limit resets.
For example:
You have reached your limit. Try again after 08:42.
Instead of stopping and requiring the user to manually type proceed,
OpenCode could show:
Rate limited. Paused until 08:42. The session will resume automatically.
If no reliable reset time is provided, manual resume would still be required.
This would be especially useful for long-running coding tasks and
subscription-based coding plans.
Reacted by Martin Vidovic, Yaroslav Gulevsky, ppoffice, NODA Kai, Dennis, Arjun Pramanik, Juraj Lorinc, Xavier, Israel, Samuel Huang and 6 more
This issue might be a duplicate of existing issues. Please check:
Session retries fixed-window usage quota errors until reset #39790: Session retries fixed-window usage quota errors until reset — covers the same rate-limit reset-time scenario from a bug angle (stopping futile retries when a known reset time is provided). Your feature request is the complementary proactive side: instead of just stopping retries, automatically resume when the reset time arrives.
This request is specifically about connecting them for rate-limited sessions:
persist the session, pause until the provider's reported reset time, and
automatically resume afterwards.
Reacted by Florian, Martin Vidovic and Arjun Pramanik
I hit this with a Claude subscription: after the limit is reached the session keeps retrying against the same model, and after the reset I have to type "continue" by hand. Using the reset time from the error would fix both.
A small shape that could work: surface the reset time on the failure, stop retrying when it is beyond the retry cap, and schedule a resume for that time using #52103 (session schedules). Could a maintainer say whether that direction is acceptable? I'm willing to build it once the design is agreed.
To restate it: when a provider reports when a rate or usage limit resets, you'd like OpenCode to save the session, show that it is paused until that time, and then continue on its own. You would only need to resume by hand when no reliable reset time is given. Maintainers will consider it.
Other reports have been pointed here, so this issue is where the request is being tracked. Related issues and PRs:
In the meantime, a plugin can do part of this. The session.retry hook lets a plugin change how long a session waits before retrying. A user on #43324 says they built a local plugin this way that works for them.
I would love to see this implemented.
To my knowledge, the session.retry hook doesn't expose the response headers like retry-after. In case you also get a message back that includes the time to wait or the next time you are allowed to send a request, you can try this plugin I wrote for my case. It tries to parse the error message (which I got by writing it to a file to check the content to write the regex), if this does not work, it falls back to a 5-minute timer, which is the default waiting time before tokens get reset in my case. If the information can only be found in the response header, to my knowledge, you would need to use the http.response hook, which should trigger with each answer, not only errors. Hope this helps until it gets implemented.
Activity
github-actions commentedon Aug 17, 2026
This issue might be a duplicate of existing issues. Please check:
If these don't fully cover your use case, it may be worth referencing them in this issue for context.
ECeternalcat commentedon Aug 17, 2026
This is related to #39790 and #27511, but combines the two:
This request is specifically about connecting them for rate-limited sessions:
persist the session, pause until the provider's reported reset time, and
automatically resume afterwards.
Israel-Kli commentedon Oct 13, 2026
I hit this with a Claude subscription: after the limit is reached the session keeps retrying against the same model, and after the reset I have to type "continue" by hand. Using the reset time from the error would fix both.
A small shape that could work: surface the reset time on the failure, stop retrying when it is beyond the retry cap, and schedule a resume for that time using #52103 (session schedules). Could a maintainer say whether that direction is acceptable? I'm willing to build it once the design is agreed.
opencodejr commentedon Oct 28, 2026
Thanks for the request, @ECeternalcat!
To restate it: when a provider reports when a rate or usage limit resets, you'd like OpenCode to save the session, show that it is paused until that time, and then continue on its own. You would only need to resume by hand when no reliable reset time is given. Maintainers will consider it.
Other reports have been pointed here, so this issue is where the request is being tracked. Related issues and PRs:
In the meantime, a plugin can do part of this. The
session.retryhook lets a plugin change how long a session waits before retrying. A user on #43324 says they built a local plugin this way that works for them.Gusser93 commentedon Oct 28, 2026
I would love to see this implemented.
To my knowledge, the
session.retryhook doesn't expose the response headers likeretry-after. In case you also get a message back that includes the time to wait or the next time you are allowed to send a request, you can try this plugin I wrote for my case. It tries to parse the error message (which I got by writing it to a file to check the content to write the regex), if this does not work, it falls back to a 5-minute timer, which is the default waiting time before tokens get reset in my case. If the information can only be found in the response header, to my knowledge, you would need to use thehttp.responsehook, which should trigger with each answer, not only errors. Hope this helps until it gets implemented.monbooo090 commentedon Oct 29, 2026
Thank you!
The plugin created by @Gusser93 is working very well in my environment.
trin4ik commentedon Nov 14, 2026
We wrote up a general session pause for V2: #63875 (soft / hard / kill, nothing wakes the session until resume, everything else gets queued).
"Pause until the limit resets" would be just a soft pause plus a timed resume on top of it, so a plugin like the one here could do it reliably.