opencode
opencode copied to clipboard
feat: Add retry mechanism for Anthropic overloaded errors
Implement automatic retry with exponential backoff when Anthropic returns {"type": "overloaded_error"} responses, by checking the error message on overloaded_error inclusion.
Changes
- Add
ServiceOverloadedErrortype to properly categorize these errors - Implement configurable retry logic with exponential backoff and jitter
- Add retry configuration schema with sensible defaults (20 retries, 30s max delay)
Configuration
We can now configure retry behavior in opencode.json:
{
"retry": {
"maxRetries": 20,
"initialDelay": 1000,
"maxDelay": 30000
}
}
Closes #833
i ended up submitting a PR upstream: https://github.com/vercel/ai/pull/7317
@thdxr So i should dismiss this one ?
Or could we patch this library on opencode side to then be able to parse and work on that error ? I don't know how long we should wait for the upstream PR to be merged
I believe this is still necessary to fix this issue: https://github.com/sst/opencode/issues/1712