Skip to content

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

Open
mogita wants to merge 1 commit into
mainfrom
feat/cha-2959-retry
Open

feat: add opt-in retry for rate-limited and transport-failed requests#75
mogita wants to merge 1 commit 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.
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