anomalyco / anomalyco/opencode

Session retries fixed-window usage quota errors until reset

Open
#39,790 3 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Jul 31, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

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
  1. Configure an OpenAI-compatible provider that enforces a fixed usage quota.
  2. Exhaust its 5-hour usage quota.
  3. Submit another prompt.
  4. Observe OpenCode repeatedly retry the same 429 response instead of ending the request.
Operating System

macOS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.