Skip to content

[FEATURE]:Automatically pause and resume tasks when rate limits have a known reset time #43126

Open

Description

@ECeternalcat

Feature hasn't been suggested before.

  • 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.

Activity

  1. github-actions commented on Aug 17, 2026

    @github-actions
    Contributor

    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.

  2. ECeternalcat commented on Aug 17, 2026

    @ECeternalcat
    Author

    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.

  3. Israel-Kli commented on Oct 13, 2026

    @Israel-Kli

    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.

  4. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    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.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.

  5. Gusser93 commented on Oct 28, 2026

    @Gusser93

    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.

  6. monbooo090 commented on Oct 29, 2026

    @monbooo090

    Thank you!
    The plugin created by @Gusser93 is working very well in my environment.

  7. trin4ik commented on Nov 14, 2026

    @trin4ik

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions