Skip to content

refactor(retry): Caller-supplied retry gating#1413

Open
pxrl wants to merge 4 commits into
masterfrom
pxrl/retryGeneric
Open

refactor(retry): Caller-supplied retry gating#1413
pxrl wants to merge 4 commits into
masterfrom
pxrl/retryGeneric

Conversation

@pxrl

@pxrl pxrl commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

There's a downstream need to handle retries intelligently - both for regular HTTPS queries, but also for arbitrary promises that hide the underlying requests. Upgrade retry() to allow the caller to supply a handler that determines whether a failed request should be retried or not.

This can be used intelligently to evaluate (for example) HTTP(S) failures - i.e. to discriminate on the resulting status.

pxrl added 2 commits April 20, 2026 20:36
There's a downstream need to handle retries intelligently - both for
regular HTTPS queries, but also for arbitrary promises that hide the
underlying requests. Upgrade retry() to allow the caller to supply a
handler that determines whether a failed request should be retried or
not.

This can be used intelligently to evaluate (for example) HTTP(S)
failures - i.e. to discriminate on the resulting status.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 538175da22

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/common.ts Outdated
Comment on lines +249 to +250
export function retry<T>(call: () => Promise<T>, options: RetryOptions = {}): Promise<T> {
const resolved: Required<RetryOptions> = { ...DEFAULT_RETRY_OPTIONS, ...options };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Accept legacy positional retry parameters

retry is part of the public utils surface, but this change replaces (call, times, delayS) with an options object without any runtime compatibility path. In JavaScript consumers (or previously compiled JS artifacts) that still call retry(fn, 5, 0.2), the numeric second argument is silently ignored by object spread, so the function now uses defaults (retries=2, delaySeconds=1) and drops the caller’s retry budget and delay; that can cause premature failures or much longer retry latency after upgrading.

Useful? React with 👍 / 👎.

@nicholaspai nicholaspai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, having a universal retry util will go a long way

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.

2 participants