fix(github-graphql): lower shrinkPageSize floor from 25 to 5 - #45460
Merged
secustor merged 2 commits intoAug 25, 2026
Conversation
NickAnge
marked this pull request as ready for review
August 25, 2026 16:16
viceice
approved these changes
Aug 25, 2026
secustor
approved these changes
Aug 25, 2026
Contributor
|
🎉 This PR is included in version 44.45.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Changes
shrinkPageSize()walked100 → 50 → 25and then gave up. For repositories with many tags,refs(first: 25)with nested tag / annotated-tag target resolution still exceeds GitHub's 10-second GraphQL execution limit, so the query is terminated server-side (502 / 504). The resultingExternalHostErrorwas re-thrown as an unrecoverable failure instead of being retried with a smaller page.GitHub Support confirmed these are query execution timeouts — the query runs for exactly 10 seconds and is killed by their GraphQL backend — and recommended reducing the
refs(first: ...)page size.This PR extends the ladder to
100 → 50 → 25 → 10 → 5. The step list is now a singlepageSizesconstant, andshrinkPageSize()advances through it by index rather than via a chain ofifbranches, so adding or removing a step is a one-line change.Behaviour is unchanged for every repository that already succeeds at 25 or above — the extra steps are only reached after 25 has failed.
Note for reviewers
hasReachedQueryLimit()is a flatqueryCount >= 100, which is an item ceiling that varies with page size: 2,500 items atfirst: 25, but only 500 atfirst: 5. So a repository large enough to need the smallest page is also the one most likely to be truncated by the query cap.I deliberately left that out of this PR to keep the change minimal, since it is a separate design decision. Happy to fold in either option if you have a preference:
Context
Please select one of the following:
Discussion: #45248 (maintainer reply: "PR welcome")
Related: #16343, which introduced the shrink mechanism in 2022 with 25 as the floor.
AI assistance disclosure
Did you use AI tools to create any part of this pull request?
Claude Opus 5, via Claude Code, wrote the code change, the test suite, and this description. Every test was verified to fail on
mainand pass with the change (see below), and the diff was reviewed by @NickAnge before pushing.Use of AI in replying to PR comments
Who answers review comments:
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via:
The
Page shrinkingsuite now covers every rung of the ladder instead of just the first two. It is table-driven overattempts → resulting page size, plus two behavioural cases:shrinks page size when a later page fails— new. Page 1 succeeds at 100, page 2 fails, and the retry reuses the same cursor at 50, so shrinking works mid-pagination too.re-throws if shrinking did not help— now derives the attempt count from the ladder instead of hard-coding three.The three new/changed cases fail on
mainand pass with the fix:pnpm check --all lib/util/github/graphqlandpnpm type-checkare clean.These tests mock the HTTP layer, so they cover the retry logic rather than the premise that
first: 5fits inside the 10s limit. The repository where we hit this is private, so I could not reproduce the timeout publicly. Happy to find a large enough public repo if you want that confirmed before merging.