Skip to content

fix(opencode): cap exponential retry backoff to 30s max#17834

Open
TomRoyls wants to merge 1 commit intoanomalyco:devfrom
TomRoyls:fix/retry-backoff-cap
Open

fix(opencode): cap exponential retry backoff to 30s max#17834
TomRoyls wants to merge 1 commit intoanomalyco:devfrom
TomRoyls:fix/retry-backoff-cap

Conversation

@TomRoyls
Copy link
Copy Markdown

@TomRoyls TomRoyls commented Mar 16, 2026

Issue for this PR

Closes #8769

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The retry logic had two fallback paths for exponential backoff:

  1. Unbounded: RETRY_INITIAL_DELAY * Math.pow(RETRY_BACKOFF_FACTOR, attempt - 1) — no cap
  2. Capped: Math.min(..., RETRY_MAX_DELAY_NO_HEADERS) — 30s max

When response headers were present but didn't contain retry-after-ms or retry-after, the code fell through to the unbounded path. After 13 retries this results in 4+ hour delays.

This removes the unbounded fallback so all cases use the capped version (30s max).

How did you verify your code works?

Ran the retry tests: all 18 pass.

Screenshots / recordings

N/A - no UI changes

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Removes the unbounded exponential backoff fallback when response
headers are present but don't contain retry-after info. Now all
fallback paths use the capped backoff (30s max) from
RETRY_MAX_DELAY_NO_HEADERS.

Fixes anomalyco#8769
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Mar 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Retry: allow user to change "exponential backoff" to "fixed interval"

1 participant