Skip to content

fix: retry transient GraphQL errors beyond HTTP 502 - #2915

Draft
CodeByPeace wants to merge 1 commit into
googleapis:mainfrom
CodeByPeace:fix/retry-transient-graphql-errors
Draft

CodeByPeace wants to merge 1 commit into
googleapis:mainfrom
CodeByPeace:fix/retry-transient-graphql-errors

Conversation

@CodeByPeace

@CodeByPeace CodeByPeace commented Oct 4, 2026 •

Copy link
Copy Markdown

Fixes #2905

This is a draft until a maintainer answers my comment on the issue.

What was wrong: Both GraphQL retry loops, in github.ts and github-api.ts, only retried when the status was 502. A GraphQL error returned with HTTP 200 has no status, so it was thrown after one request. HTTP 500, 503 and 504 also stopped after one request.

What changed: I added one shared check, isTransientGraphqlError, in github-api.ts. Both loops now use it. It retries HTTP 500, 502, 503 and 504, and the two error messages named in the issue. Everything else is thrown at once, as before. The log line now says transient GraphQL error instead of 502 error.

How I tested: I wrote a failing test for the HTTP 200 case first and watched it fail. I added tests for 500, 503 and 504, a test that a normal query error is not retried, and direct tests of the check. I ran npm test, 1226 passing, and npm run fix with no errors. I ran these myself.

Limits: The batch size halving that already ran on 502 now runs for the other transient errors too. I did not add a loop test for the copy in github-api.ts, only tests of the check it uses.

Left alone: rate limit, auth and query errors, the retry count and the sleep times. There are no mutations in src, so nothing that creates a release or PR is retried.

AI use: written with Claude Sonnet 5.5. I ran and checked every command and test myself.

  • Make sure to open an issue as a bug/issue before writing your code. The issue already existed. I commented on it just before opening this PR, so the design was not agreed first.
  • Ensure the tests and linter pass. Run locally, CI has not run yet.
  • Code coverage does not decrease. I did not measure it.
  • Appropriate docs were updated. No docs needed changing.

Both GraphQL retry loops only retried on HTTP 502. A GraphQL error returned with HTTP 200 has no status, so it was thrown at once. Add one shared check that also treats HTTP 500, 503 and 504 and the two transient error messages from the issue as retryable. Other errors are handled as before.

Fixes googleapis#2905
@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Oct 4, 2026
@google-cla

google-cla Bot commented Oct 4, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retry transient read-only GraphQL failures beyond HTTP 502

1 participant