feat(core): add automatic retry with exponential backoff#2
Merged
AllyMurray merged 2 commits intoAllyMurray:mainfrom Feb 16, 2026
Merged
feat(core): add automatic retry with exponential backoff#2AllyMurray merged 2 commits intoAllyMurray:mainfrom
AllyMurray merged 2 commits intoAllyMurray:mainfrom
Conversation
Add opt-in retry mechanism for transient failures (network errors, 429, 5xx) with configurable exponential backoff and jitter. - RetryOptions/RetryContext types with constructor + per-request config - Retry loop wraps fetch block inside get() with full interceptor re-run - Respects Retry-After header as delay floor - Custom retryCondition/onRetry callbacks - 100% test coverage maintained (35 new tests) - New retries.mdx guide, updated API docs and sidebar Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move RetryOptions/RetryContext/HttpErrorContext to types/ to fix circular import between types/ and http-client/ - Extract executeFetch() private method from get() to reduce nesting and eliminate definite assignment assertions - Re-check enforceServerCooldown() between retry attempts - Return RetryContext from isRetryableRequest to deduplicate construction - Add nock.cleanAll/vi.restoreAllMocks to test setup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
RetryOptionsinterfaceRetry-Afterheader as delay floor, re-runs interceptors on each attemptFiles Changed
packages/core/src/http-client/http-client.tsRetryOptions/RetryContexttypes, retry loop inget(), private helperspackages/core/src/types/http-client.tsretryoption toHttpClientContract.get()packages/core/src/http-client/http-client.test.tsdocs-site/src/content/docs/guides/retries.mdxdocs-site/astro.config.mjsdocs-site/src/content/docs/api/http-client.mdxretryto options tables.changeset/add-retry-feature.mdTest plan
pnpm build— all packages build cleanlypnpm test— 256 tests pass (223 existing + 35 new)pnpm lint— no lint errorspnpm test:coverage— 100% coverage maintained🤖 Generated with Claude Code