fix(session): make retry cap and backoffDelay configurable per provider - #41699
Open
eyalatox wants to merge 1 commit into
Open
fix(session): make retry cap and backoffDelay configurable per provider#41699eyalatox wants to merge 1 commit into
eyalatox wants to merge 1 commit into
Conversation
Contributor
|
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. |
Author
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
eyalatox
force-pushed
the
feat/provider-retry-config
branch
from
August 12, 2026 11:45
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>
eyalatox
force-pushed
the
feat/provider-retry-config
branch
from
August 12, 2026 11:45
f991a32 to
42e103a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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