[PR #2116] tweak: add experimental chatMaxRetries to config #10203

Closed
opened 2026-02-16 18:14:49 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/2116

State: closed
Merged: Yes


This PR tries to give users some power to work around AI_RetryError.

Some related issues this is aiming are:

This PR is also related to feat: Add retry mechanism for Anthropic overloaded errors however, in #1027 the retry backoff is re-implemented and I'm not sure this is the right approach.

Exponential backoff, and Retry-After behavior is already implemented at ai.util.retry-with-exponential-backoff and it is used in the streamText function here.

I could not find handles in the ai package where we could expose the backoff parameters (delay, maximumDelay, factor, etc..).

If someone can point me to where I should update the documentation, I can do that.

Here's a log from a session where I changed my config.chatMaxRetries to 5.

ERROR 2025-08-20T14:34:51 +14ms service=tui message=AI_RetryError: Failed after 6 attempts. Last error: Provider returned error name=UnknownError Server error
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/2116 **State:** closed **Merged:** Yes --- This PR tries to give users some power to work around AI_RetryError. Some related issues this is aiming are: - [Implement exponential back-off when hitting rate limits](https://github.com/sst/opencode/issues/1712) - [Retry error](https://github.com/sst/opencode/issues/545) - [AI_RetryError: Failed after 4 attempts. Last error: Provider returned error (Qwen3 Coder 480B A35B Instruct (](https://github.com/sst/opencode/issues/2018) - https://github.com/sst/opencode/issues/1592 This PR is also related to [feat: Add retry mechanism for Anthropic overloaded errors](https://github.com/sst/opencode/pull/1027/files) however, in #1027 the retry backoff is re-implemented and I'm not sure this is the right approach. Exponential backoff, and Retry-After behavior is already implemented at [ai.util.retry-with-exponential-backoff](https://github.com/vercel/ai/blob/8b96f99735dfdf9ee407aa4a8e00e3ddc1500ed9/packages/ai/src/util/retry-with-exponential-backoff.ts#L60) and it is used in the [streamText](https://github.com/sst/opencode/blob/dev/packages/opencode/src/session/index.ts#L898) function [here](https://github.com/vercel/ai/blob/8b96f99735dfdf9ee407aa4a8e00e3ddc1500ed9/packages/ai/src/generate-text/stream-text.ts#L970). I could not find handles in the `ai` package where we could expose the backoff parameters (delay, maximumDelay, factor, etc..). If someone can point me to where I should update the documentation, I can do that. Here's a log from a session where I changed my `config.chatMaxRetries` to 5. ``` ERROR 2025-08-20T14:34:51 +14ms service=tui message=AI_RetryError: Failed after 6 attempts. Last error: Provider returned error name=UnknownError Server error ```
yindo added the pull-request label 2026-02-16 18:14:49 -05:00
yindo closed this issue 2026-02-16 18:14:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10203