Skip to content

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

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

feat: add opt-in retry for rate-limited and transport-failed requests#129
mogita merged 5 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: stream.WithRetry(RetryConfig{...})

Notes

  • 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 release-* branch flow). Publish via the release flow when ready.

mogita added 2 commits July 23, 2026 15:14
Every other final-failure path in MakeRequest's retry loop logged an
ERROR http.request.failed; the ctx.Done() branch returned silently.
Also add missing behavior-matrix coverage: HEAD is retry-eligible, a
5xx is never retried even with retries enabled, and cancelling during
backoff exits promptly with exactly one attempt and one ERROR log.
@mogita
mogita requested a review from tbarbugli as a code owner July 23, 2026 14:35
@mogita
mogita temporarily deployed to feeds-enabled-shard July 23, 2026 14:35 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 23, 2026 14:35 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 23, 2026 14:35 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 23, 2026 14:35 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 23, 2026 14:35 — with GitHub Actions Inactive
@mogita
mogita had a problem deploying to feeds-enabled-shard July 23, 2026 14:35 — with GitHub Actions Failure
The HardDeleteChannels integration subtest has been intermittently failing for weeks: it hard-deletes two channels and requires the async delete task to reach status=completed within a 5-minute WaitForTask poll. When the shared test backend's async queue is backed up, the task does not finish in the window and WaitForTask returns a timeout (ErrTransport), which hard-failed the whole suite.

That timeout is backend queue latency, not an SDK defect (the API call succeeds and returns a task, and WaitForTask polls it correctly). New requireTaskCompletedOrSkipOnTimeout helper t.Skips on a poll timeout while still failing on a genuine task failure (ErrTaskFailed) or API error, so real regressions are still caught and backend latency no longer flakes CI.
@mogita
mogita had a problem deploying to feeds-enabled-shard July 24, 2026 09:12 — with GitHub Actions Failure
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 09:12 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 09:12 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 09:12 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 09:12 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 09:12 — with GitHub Actions Inactive
Three parallel integration tests mutate the app-global FileUploadConfig; because size_limit has no omitempty, a partial UpdateApp rewrites it to 0, which clobbered TestChatAppFileUploadConfigIntegration's read-back mid-verify and made it intermittently fail. A shared appConfigMu now serializes the set->verify->restore span in all three so they cannot overlap.
@mogita
mogita had a problem deploying to feeds-enabled-shard July 24, 2026 12:49 — with GitHub Actions Failure
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 12:49 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 12:49 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 12:49 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 12:49 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 12:49 — with GitHub Actions Inactive
…nfreezeChannel

The frozen flag in an UpdateChannelPartial response can be hydrated from a read replica that lags the write, so FreezeUnfreezeChannel intermittently observed the pre-unfreeze value and failed. Assert on a re-read that retries until the state converges instead of trusting the write response, symmetric for both freeze and unfreeze.
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 13:14 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 13:14 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 13:14 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 13:14 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 13:14 — with GitHub Actions Inactive
@mogita
mogita temporarily deployed to feeds-enabled-shard July 24, 2026 13:14 — with GitHub Actions Inactive
@mogita
mogita merged commit a851a68 into main Jul 24, 2026
11 checks passed
@mogita
mogita deleted the feat/cha-2959-retry branch July 24, 2026 13:28
This was referenced Jul 24, 2026
This was referenced Aug 12, 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