Skip to content

Retry transient GitHub API errors with backoff#8

Merged
dnorth98 merged 2 commits intomainfrom
feature/dnorth/retry-transient-api-errors
Mar 2, 2026
Merged

Retry transient GitHub API errors with backoff#8
dnorth98 merged 2 commits intomainfrom
feature/dnorth/retry-transient-api-errors

Conversation

@dnorth98
Copy link
Copy Markdown
Contributor

@dnorth98 dnorth98 commented Mar 2, 2026

Summary

  • GitHub occasionally returns transient 502/503/504 errors (the infamous "Unicorn" page), which previously caused incomplete results with just a warning log
  • Added api_call_with_retry() wrapper that retries up to 3 times with exponential backoff (2s, 4s, 8s) before giving up
  • Applied retry logic to all 4 API call sites: repo listing, workflow listing, workflow runs pagination, and timing data

Test plan

  • Run against an org and verify normal operation is unaffected
  • Verify retry logging appears at WARNING level when a transient error occurs
  • Confirm the script still falls through to existing error handling if retries are exhausted

🤖 Generated with Claude Code

GitHub occasionally returns 502 "Unicorn" errors for valid API calls.
Previously these were treated as permanent failures, causing incomplete
results. Now all API calls retry up to 3 times with exponential backoff
(2s, 4s, 8s) before giving up.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dnorth98 dnorth98 requested a review from a team as a code owner March 2, 2026 16:19
@dnorth98 dnorth98 requested review from kevintylerstark, phamtriduy and stairsj and removed request for a team March 2, 2026 16:19
Retry warnings were polluting the report output. Successful retries
are not noteworthy — only log them with --verbose. The "giving up"
message stays at WARNING since that indicates incomplete results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dnorth98 dnorth98 merged commit 728d373 into main Mar 2, 2026
4 checks passed
@dnorth98 dnorth98 deleted the feature/dnorth/retry-transient-api-errors branch March 2, 2026 16:30
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