Skip to content

feat: add opt-in retry for rate-limited and transport-failed requests#75

Merged
mogita merged 2 commits into
mainfrom
feat/cha-2959-retry
Jul 24, 2026
Merged

feat: add opt-in retry for rate-limited and transport-failed requests#75
mogita merged 2 commits into
mainfrom
feat/cha-2959-retry

Conversation

@mogita

@mogita mogita commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Ticket

https://linear.app/stream/issue/CHA-2959/rate-limits-and-retry

Summary

Adds an opt-in auto-retry policy. RetryConfig is disabled by default (maxAttempts=3, maxBackoff=30s). When enabled, retries ONLY GET/HEAD requests that fail with HTTP 429 or a transport error, honoring Retry-After (clamped to maxBackoff) otherwise exponential backoff with full jitter. Never retries writes or 5xx; always honors the backend unrecoverable flag; surfaces the last attempt's error. Config surface: StreamClientOptions.setRetry(new RetryConfig()...)

Notes

  • No regeneration or generated-code changes: the retry loop lives in the hand-written StreamRequest.execute(); generated clients already pass the StreamHTTPClient (from CHA-2957).
  • Retry attempts are observable via the existing http.request.failed log event with a retry.attempt field (transport retries carry error.type; 429 retries omit it, since that field is the transport-only enum).
  • Does not auto-release on merge (this SDK releases only via the initiate_release/release-* flow). Publish via that flow when ready.

GET/HEAD requests failing with HTTP 429 (non-unrecoverable) or a transport
error can now be auto-retried via StreamClientOptions.setRetry(RetryConfig).
Disabled by default: one attempt, errors surface unchanged. Retry lives in
StreamRequest.execute() as a loop around a fresh OkHttp Call per attempt
(not an interceptor), so each attempt gets its own callTimeout budget.
testHardDeleteChannels polls an async hard-delete task via waitForTask, but under shared-backend async-queue latency it times out (StreamTransportException after PT1M) and fails. Catch the transport timeout and abort (skip) the test, mirroring the getstream-go/php/ruby fix; a genuine task failure throws StreamTaskException and still fails.
@mogita
mogita merged commit e4ea451 into main Jul 24, 2026
4 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 24, 2026
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.

1 participant