Skip to content

feat: add retry with exponential backoff for API rate limits#149

Merged
mshick merged 4 commits intomainfrom
feat/rate-limit-retry
Mar 13, 2026
Merged

feat: add retry with exponential backoff for API rate limits#149
mshick merged 4 commits intomainfrom
feat/rate-limit-retry

Conversation

@mshick
Copy link
Copy Markdown
Owner

@mshick mshick commented Mar 13, 2026

Summary

Closes #129

  • Add withRetry utility (src/retry.ts) with exponential backoff, jitter, and Retry-After header support — only retries on HTTP 403/429
  • Wrap all GitHub API write operations in comments.ts (createComment, updateComment, deleteComment) with retry
  • Wrap listPullRequestsAssociatedWithCommit in issues.ts with retry

Test plan

  • 7 new unit tests for withRetry (success, 429 retry, 403 retry, exhausted retries, non-retryable errors, no-status errors, Retry-After header)
  • All 24 existing integration tests pass unchanged (retry is transparent on success)
  • Lint passes
  • Build succeeds

mshick added 4 commits March 13, 2026 08:45
Implements exponential backoff with jitter for retryable HTTP errors
(429 and 403). Supports Retry-After header parsing. Includes full
test coverage with 7 test cases.
Import withRetry from ./retry and wrap createComment, updateComment,
and deleteComment API calls to automatically retry on 403/429 rate
limit errors. getExistingComment is left unchanged since it uses
paginate.iterator.
@github-actions
Copy link
Copy Markdown
Contributor

Hello
Goodbye

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 13, 2026

Goodnight
🌕
!

@mshick mshick merged commit 84d6648 into main Mar 13, 2026
5 checks passed
@mshick mshick deleted the feat/rate-limit-retry branch March 13, 2026 12:55
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.

Gracefully handle API rate limit exceeded

1 participant