fix(session): make retry cap and backoffDelay configurable per provider - #41699
fix(session): make retry cap and backoffDelay configurable per provider#41699eyalatox wants to merge 1 commit into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search results, I found one potentially related PR: PR #38958: fix(session): cap retry attempts to prevent infinite thinking on API errors This PR appears to address a similar issue of capping retry attempts to prevent infinite sessions on API errors. It may be worth reviewing to see if it's a prior attempt at fixing the same problem or if it's been superseded by PR #41699. All other results in the search were either PR #41699 itself or unrelated retry handling fixes. No other duplicate PRs were identified. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
9e7a34d to
f991a32
Compare
Builds on the fixed RETRY_MAX_RETRIES cap from anomalyco#41939: providers differ in how aggressively they should be retried, so expose 'retry' (max attempts, 0 disables) and 'backoffDelay' (initial backoff ms) provider options in opencode.json. retry-after headers from the provider still take precedence over the configured backoff. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
f991a32 to
42e103a
Compare
|
Hope this PR merged ASAP, fixed max_retry in #41939 broken everything. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #21960
Type of change
What does this PR do?
Follow-up to #41939, which added the fixed
RETRY_MAX_RETRIES = 5cap. That default is right for most cases, but the retry budget users want differs per provider (an aggressive retry loop against a rate-limited Bedrock account makes things worse; a flaky self-hosted proxy may need more than 5). This PR makes the cap and the initial backoff configurable per provider:{ "provider": { "amazon-bedrock": { "options": { "retry": 3, "backoffDelay": 1000 } } } }retry— max attempts (default 5 from fix(opencode): cap session retries with jitter #41939,0disables retries)backoffDelay— initial backoff in ms (default 2000); providerretry-afterheaders still take precedence, and the jitter from fix(opencode): cap session retries with jitter #41939 is preservedBoth options are stripped before SDK construction (like
chunkTimeout) so they never reach the provider client.How did you verify your code works?
dev(keeps the fix(opencode): cap session retries with jitter #41939 jitter + cap behavior and its tests intact).test/session/retry.test.ts:retryraises/lowers the cap;retry: 0never retries;backoffDelaychanges the backoff progression;retry-afterheaders still win.bun test test/session/retry.test.ts→ 59 pass.bun run typecheckclean inpackages/coreandpackages/opencode../script/generate.ts.Screenshots / recordings
N/A (no UI change)
Checklist