Bug description
When Anthropic returns the error "Extra usage is required for long context requests" (billing tier context limit), opencode classifies it as a retryable API error and retries indefinitely with exponential backoff (observed up to attempt #7 with 2-minute delays).
This error means the prompt exceeds the user's billing tier context window — retrying will never succeed. The correct behavior is to treat it as a context overflow and trigger compaction.
Steps to reproduce
- Use an Anthropic API key on a billing tier with a standard context limit
- Have a session grow large enough that the prompt exceeds the tier's context window
- Observe:
Extra usage is required for long context requests. [retrying in 2m attempt #7]
Expected behavior
The error should be classified as context_overflow (same as "prompt is too long"), triggering compaction to reduce context size.
Actual behavior
Classified as a retryable API error. Retries indefinitely, never compacts, and can corrupt session message state from repeated partial writes.
Environment
- opencode version: v1.3.0 / custom-build
- Provider: Anthropic
- OS: macOS
Bug description
When Anthropic returns the error
"Extra usage is required for long context requests"(billing tier context limit), opencode classifies it as a retryable API error and retries indefinitely with exponential backoff (observed up to attempt #7 with 2-minute delays).This error means the prompt exceeds the user's billing tier context window — retrying will never succeed. The correct behavior is to treat it as a context overflow and trigger compaction.
Steps to reproduce
Extra usage is required for long context requests. [retrying in 2m attempt #7]Expected behavior
The error should be classified as
context_overflow(same as "prompt is too long"), triggering compaction to reduce context size.Actual behavior
Classified as a retryable API error. Retries indefinitely, never compacts, and can corrupt session message state from repeated partial writes.
Environment