fix: add retry with backoff to _fetch_closed_issues for transient 5xx errors#394
Closed
t7929375-eng wants to merge 2 commits intoentrius:testfrom
Closed
fix: add retry with backoff to _fetch_closed_issues for transient 5xx errors#394t7929375-eng wants to merge 2 commits intoentrius:testfrom
t7929375-eng wants to merge 2 commits intoentrius:testfrom
Conversation
1d8a3e2 to
8886a97
Compare
Covers: - Success on first attempt (no sleep) - Retry on 502/503 with eventual success - All retries exhausted returns partial results - 404/422 return immediately without retry - ConnectionError triggers retry - Exponential backoff timing (5s, 10s) - Pagination continues after mid-page retry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
_fetch_closed_issues()inrepo_scan.pyhas no retry logic. A single transient 502/503/504 from GitHub causes the function to immediatelybreakand return partial results, silently losing all issues from subsequent pages.This is inconsistent with every other API function in the codebase:
get_pull_request_file_changes— 3 retries with exponential backoffget_pull_request_maintainer_changes_requested_count— 3 retriesexecute_graphql_query— 8 retries with backoffget_merge_base_sha— 3 retriesget_github_user— 6 retriesImpact
When GitHub returns a transient 5xx during the issue discovery scan, the validator loses visibility into all remaining closed issues for that repo.
Solution
Add retry logic with exponential backoff (3 attempts, capped at 30s) for 5xx errors and connection exceptions, matching the established pattern. Non-retryable errors (404, 422) still return immediately.
Type of Change
Testing
tests/validator/test_repo_scan_retry.py:ruff checkpassesruff formatpassespyrightpassesChecklist
cc @anderdc @LandynDev