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
Session retries fixed-window usage quota errors until reset #39790
When a provider returns a retryable HTTP 429 such as:
You have exceeded the 5-hour usage quota. It will reset at 2026-07-30 16:11:46 +0800 CST.
OpenCode keeps retrying through SessionRetry.policy() even though another attempt cannot succeed before the fixed quota window resets. This generates repeated requests for hours and leaves the session in retry state.
Known long-window quota errors (5-hour, weekly, or monthly) should stop immediately. Short-lived rate limits should continue using the existing retry behavior.
Related to #21960. #38958 proposes a general retry cap; this issue covers early classification of a known terminal quota response.
Plugins
None required.
OpenCode version
1.18.9
Steps to reproduce
Configure an OpenAI-compatible provider that enforces a fixed usage quota.
Exhaust its 5-hour usage quota.
Submit another prompt.
Observe OpenCode repeatedly retry the same 429 response instead of ending the request.
Confirmed that #24011 describes the same class of bug. It was automatically closed after inactivity with instructions to open a new issue if the problem remained relevant, and its PR #24013 was closed by automated cleanup without merging.
This report is a current reproduction on 1.18.9 with a 5-hour quota response. PR #39791 uses narrower long-window matching, checks the retained response body, and includes regression coverage for transient per-minute quotas.
One concrete source is zen itself: an exhausted free tier returns 429 with retry-after set to the seconds left until the next daily reset (getRetryAfterDay in packages/console/app/src/routes/zen/util/ipRateLimiter.ts), and SessionRetry.delay() honors that header up to RETRY_MAX_DELAY, so the session parks on a single attempt that can be up to 24h out. Nothing is logged after the first stream error, and inside a subagent even the retry status is invisible because it is published on the child session ID.
The PR stops the schedule when the requested wait is longer than 5 minutes, after publishing the retry status so the free tier and Go limit dialogs still fire. Short rate limits keep the current behavior.
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
github-actions commentedon Jul 31, 2026
This issue might be a duplicate of existing issues. Please check:
vinlee19 commentedon Jul 31, 2026
Confirmed that #24011 describes the same class of bug. It was automatically closed after inactivity with instructions to open a new issue if the problem remained relevant, and its PR #24013 was closed by automated cleanup without merging.
This report is a current reproduction on 1.18.9 with a 5-hour quota response. PR #39791 uses narrower long-window matching, checks the retained response body, and includes regression coverage for transient per-minute quotas.
ApexMene commentedon Sep 6, 2026
Opened #47641 for this.
One concrete source is zen itself: an exhausted free tier returns 429 with
retry-afterset to the seconds left until the next daily reset (getRetryAfterDayinpackages/console/app/src/routes/zen/util/ipRateLimiter.ts), andSessionRetry.delay()honors that header up toRETRY_MAX_DELAY, so the session parks on a single attempt that can be up to 24h out. Nothing is logged after the firststream error, and inside a subagent even the retry status is invisible because it is published on the child session ID.The PR stops the schedule when the requested wait is longer than 5 minutes, after publishing the retry status so the free tier and Go limit dialogs still fire. Short rate limits keep the current behavior.
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊