Add retry logic to checkout and submoduleUpdate for partial clone resilience#2392
Open
jasonwbarnett wants to merge 1 commit intoactions:mainfrom
Open
Add retry logic to checkout and submoduleUpdate for partial clone resilience#2392jasonwbarnett wants to merge 1 commit intoactions:mainfrom
jasonwbarnett wants to merge 1 commit intoactions:mainfrom
Conversation
…ilience When using partial clones (filter=blob:none, which is automatically set for sparse checkouts), `git checkout` lazily fetches missing blobs from the promisor remote. If the remote is temporarily unavailable, this network call fails and surfaces as a hard error with no retry. The `fetch`, `getDefaultBranch`, and `lfsFetch` methods already use retryHelper, but `checkout` and `submoduleUpdate` did not, despite both performing network operations: - `checkout`: fetches blobs on-demand from promisor remotes during partial clone checkouts - `submoduleUpdate`: clones/fetches submodule repositories This was observed in production when GitHub's git service had a brief outage, causing the checkout step to fail with: fatal: unable to access '...': Failed to connect to github.com port 443 after 135272 ms: Couldn't connect to server fatal: could not fetch <sha> from promisor remote Wrapping both methods with the existing retryHelper (3 attempts with 10-20s jittered backoff) makes these operations resilient to transient network failures, consistent with how fetch already behaves. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
When using partial clones (
filter=blob:none, which is automatically set for sparse checkouts),git checkoutlazily fetches missing blobs from the promisor remote. If the remote is temporarily unavailable, this network call fails with no retry:This was observed in production during a brief GitHub git service outage. The workflow used
sparse-checkoutwhich triggersfilter=blob:none, making checkout depend on network availability.Root Cause
The
fetch,getDefaultBranch, andlfsFetchmethods ingit-command-manager.tsalready wrap their git calls withretryHelper.execute(), butcheckoutandsubmoduleUpdatedo not — despite both performing network operations:checkout: With partial clones, git lazily fetches missing blobs from the promisor remote during checkoutsubmoduleUpdate: Clones/fetches submodule repositories from their remotesFix
Wrap both
checkout()andsubmoduleUpdate()with the existingretryHelper.execute()(3 attempts, 10-20s jittered backoff), consistent with howfetch()already handles transient failures.Testing
npm test)npm run format)dist/index.jsrebuilt (npm run build)