Skip to content

feat: add retry utility with exponential backoff#5

Merged
dsm20 merged 3 commits intomainfrom
test-inline-results
Apr 30, 2026
Merged

feat: add retry utility with exponential backoff#5
dsm20 merged 3 commits intomainfrom
test-inline-results

Conversation

@dsm20
Copy link
Copy Markdown
Owner

@dsm20 dsm20 commented Apr 27, 2026

Adds a retry utility with exponential backoff and jitter for testing comprehension gate inline results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Comprehension Gate

Answer the questions below in order to merge.

Q1. Under what condition will the withRetry function rethrow the lastError wrapped in a RetryError immediately after the first failed attempt, without any further retries?

  • A) If maxRetries is set to 0 and the shouldRetry function returns true for the initial error.
  • B) If maxRetries is set to 1 and the shouldRetry function returns false for the initial error.
  • C) If maxRetries is set to 0 and the shouldRetry function returns false for the initial error.
  • D) If maxRetries is set to 1 and the shouldRetry function is not provided, implying default true.

Q2. Consider the exponential backoff with jitter implemented in withRetry. If baseDelayMs is 1000, what is the minimum possible delay before the third retry attempt (i.e., after the second failure)?

  • A) 1500 ms
  • B) 3000 ms
  • C) 2250 ms
  • D) 5000 ms

Q3. What is the primary purpose of the isRetryable function provided in src/retry.mjs?

  • A) To be used as a default onRetry callback to log specific error types.
  • B) To determine if an error should trigger a retry attempt when passed to the shouldRetry option of withRetry.
  • C) To categorize errors for reporting purposes, indicating whether they are transient or permanent.
  • D) To explicitly prevent retries for client-side errors (e.g., 4xx HTTP status codes).

Reply in a format like this:

1. A
2. C
3. B

Questions are based on commit a4a6e94. Pushing new commits regenerates the questions.

Result — PASSED

Score: 3/3 | Q1: PASS | Q2: PASS | Q3: PASS

Comprehension gate passed — this PR is cleared to merge.

@dsm20
Copy link
Copy Markdown
Owner Author

dsm20 commented Apr 28, 2026

  1. C
  2. B
  3. B

@dsm20 dsm20 merged commit a4beae6 into main Apr 30, 2026
2 checks passed
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