fix: retry transient github api failures on cached get requests - #248
Merged
Merged
Conversation
A dropped keep-alive socket surfaces as an octokit RequestError with status 500, which cacheRequest reported as a hard failure with no retry. Callers that read repository config through it then could not tell a network blip from a missing config file: a pull request opened with autoDeploy enabled was treated as a non-autoDeploy repo, so its environment never received the deploy label, and nothing later re-read the config to correct it. Retry idempotent GET requests twice, at 5s and 15s. Writes are excluded so a retried POST cannot duplicate a deployment, and the budget stays under the job queue's 30s lock so a retry cannot outlive a worker restart.
The cached-body refetch and the transient retry are two separate recursive paths through cacheRequest. This pins the attempt budget being preserved across the first and consumed only by the second. Also corrects the retry comment: the delays are bounded by a worker's shutdown grace, not by the job lock, which is renewed while the process runs.
vigneshrajsb
marked this pull request as ready for review
September 21, 2026 18:54
Replaces the two-entry delay schedule and its attempt counter with one constant and a boolean. The retried request is the same idempotent GET, so the only thing the counter bought was a second wait, and a 10s gap already clears the dropped socket that motivated the retry. A failure that outlives it is an outage rather than a blip, and wants a different fix.
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.
Description
cacheRequestas a hard failure with no retry.autoDeployenabled was therefore handled as a non-autoDeploy repo: its environment never received the deploy label, and because config is only read when the PR opens, no later push corrected it.GETthat fails this way is now retried once, 10s later. Writes are excluded, so a retriedPOSTcannot duplicate a deployment, and the wait is short enough that a retry cannot outlive a worker's shutdown grace.Verifying Changes
jestfull suite andeslint --ext .ts src— both green.GETretried then succeeding, a non-GETnever retried, a 304 refetch that hits the transient failure, and the single retry being exhausted.Notes
GitHub: cache request retryinglog line, with the endpoint and status, for anyone watching this in production.