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]:Add retry logic for subagents on TPM/RPM rate limits #59533
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Description / Current Behavior: While the primary agent automatically waits for
the specified cooldown duration and retries the task when hitting TPM or RPM
limits, subagents immediately terminate their session and return an error,
discarding all progress made up to that point.
Subagent failed (sessionID: ses_e83f85d5fffeqWwsge8YKfsVMI): You exceeded your current quota, please check your plan and billing details. For more information on this error
...
Please retry in 436.41948ms.
Proposed Solution / Feature Request: It would be greatly appreciated if you
could add a configuration option (such as in opencode.jsonc or as documented in
explainer.md) allowing subagents to handle TPM/RPM rate limits
gracefully—waiting for the required retry delay and retrying up to a specified
number of times, rather than immediately terminating the session with an error.
Thanks for the request! To restate it: you'd like subagents to handle TPM/RPM rate limits gracefully, by waiting for the suggested delay and retrying a configurable number of times, instead of failing and losing their progress.
Some context from the current v2 code: a subagent's session goes through the same retry logic as the primary agent. It retries rate-limit errors up to 10 times, backing off from 2s to 10s between attempts and waiting at least as long as the provider's retry hint. The "You exceeded your current quota… Please retry in …" message comes from Gemini's free tier. Once its daily quota is used up, every retry until the reset gets another 429, so the subagent can run out of retries and fail. If you see the primary agent keep retrying on the very same error while a subagent fails right away, please reply with your opencode --version, provider and model. That would make this a bug rather than a feature request.
At the moment this can't be done fully as a plugin. The session.retry hook can change the delay of the built-in retries, but it can't add attempts beyond them. Maintainers will consider both the option and that plugin hook gap.
It does seem to be a bug rather than the retries simply being exhausted. Here
are my environment details and observations:
Version: opencode/latest/2.2.0/desktop
Provider: Google
Model: Gemini 3.5 flash lite
Observed behavior:
When a subagent hits the TPM/RPM limit, it does not wait for the
cooldown/retry delay at all—it immediately terminates the session with an
error on the very first hit (rather than backing off and retrying up to 10
times).
Subagent sessions that do not hit TPM/RPM limits complete successfully
without any issues.
Under the exact same rate-limit error, the primary agent behaves as
expected: it waits for the configured retry interval and retries properly.
It looks like the retry logic isn't being triggered for subagents in this setup.
Please let me know if you need any additional logs or details to help reproduce
this.
Note that in Version 1, even when the sub-agent Gemini encounters a limit-exceeded restriction, it is able to retry without any issues after the countdown. Also, I am not using any plugins at all.
Activity
opencode-agent commentedon Oct 27, 2026
Thanks for the request! To restate it: you'd like subagents to handle TPM/RPM rate limits gracefully, by waiting for the suggested delay and retrying a configurable number of times, instead of failing and losing their progress.
Some context from the current v2 code: a subagent's session goes through the same retry logic as the primary agent. It retries rate-limit errors up to 10 times, backing off from 2s to 10s between attempts and waiting at least as long as the provider's retry hint. The "You exceeded your current quota… Please retry in …" message comes from Gemini's free tier. Once its daily quota is used up, every retry until the reset gets another 429, so the subagent can run out of retries and fail. If you see the primary agent keep retrying on the very same error while a subagent fails right away, please reply with your
opencode --version, provider and model. That would make this a bug rather than a feature request.At the moment this can't be done fully as a plugin. The
session.retryhook can change the delay of the built-in retries, but it can't add attempts beyond them. Maintainers will consider both the option and that plugin hook gap.Related issues:
monbooo090 commentedon Oct 27, 2026
Thanks for the detailed explanation!
It does seem to be a bug rather than the retries simply being exhausted. Here
are my environment details and observations:
Observed behavior:
cooldown/retry delay at all—it immediately terminates the session with an
error on the very first hit (rather than backing off and retrying up to 10
times).
without any issues.
expected: it waits for the configured retry interval and retries properly.
It looks like the retry logic isn't being triggered for subagents in this setup.
Please let me know if you need any additional logs or details to help reproduce
this.
Note that in Version 1, even when the sub-agent Gemini encounters a limit-exceeded restriction, it is able to retry without any issues after the countdown. Also, I am not using any plugins at all.