Skip to content

Handle transient GitHub API connection resets with retries#76

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/sentry-error-investigation-57b6
Draft

Handle transient GitHub API connection resets with retries#76
cursor[bot] wants to merge 1 commit intomainfrom
cursor/sentry-error-investigation-57b6

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented Apr 14, 2026

Summary

  • add bounded retry logic to GithubClient._fetch_github() for transient GitHub transport failures (ConnectionError, Timeout)
  • add an explicit request timeout for GitHub API calls to avoid hanging network operations
  • preserve current behavior for non-transient HTTP failures by still raising HTTPError
  • add tests covering retry-until-success and retry-exhaustion paths

Root cause

_fetch_github() used a single, no-timeout requests.get() call. A transient upstream/network reset (Connection reset by peer) caused the request to fail immediately and bubble up as a 500, producing issue SENTRY-GITHUB-ACTIONS-APP-71.

Validation

  • python3 -m pytest -q passes
  • new tests verify exponential backoff retries (1s, 2s) and proper failure on final exhaustion

Risk

  • low risk: retry scope is limited to transient connection/timeout failures and capped at 3 attempts
  • potential tradeoff: worst-case request latency increases on repeated transient failures due to bounded backoff

Fixes SENTRY-GITHUB-ACTIONS-APP-71

Open in Web View Automation 

Co-authored-by: Armen Zambrano G. <armenzg@users.noreply.github.com>
Comment thread src/github_sdk.py
Comment on lines +50 to +54
req = requests.get(
url,
headers=headers,
timeout=self.github_api_timeout_seconds,
)
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