Skip to content

fix(github): stop retrying permanent GraphQL client errors#1529

Open
cleanjunc wants to merge 2 commits into
entrius:testfrom
cleanjunc:fix/graphql-fail-fast
Open

fix(github): stop retrying permanent GraphQL client errors#1529
cleanjunc wants to merge 2 commits into
entrius:testfrom
cleanjunc:fix/graphql-fail-fast

Conversation

@cleanjunc

Copy link
Copy Markdown

Summary

execute_graphql_query retried on any response other than 200, so a permanent client failure such as bad credentials or forbidden access consumed the entire retry budget on backoff sleeps before returning None. No retry can change the outcome of those errors, and the REST helpers in the same module already fail fast on them.

This change adds a shared _is_retryable_response helper. Transient conditions (rate limiting, request timeout, and server errors) keep being retried with backoff, while permanent client errors return immediately with the real status logged. get_github_identity now reuses the same helper, which removes the duplicated status handling it carried before. _is_rate_limited_response also recognizes secondary rate limits and abuse detection through the Retry-After header or the response message, so those stay retryable.

Related Issues

Fixes #1528

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Testing

  • Tests added/updated
  • Manually tested

Added cases in tests/utils/test_github_api_tools.py covering fast fail on auth and forbidden responses, continued retries for rate limiting, secondary rate limits, abuse detection, and server errors, plus the success path. The full module suite and the related validator suites pass (94 tests).

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

execute_graphql_query retries permanent client errors that can never succeed

1 participant