Add BUILDKITE_GIT_CHECKOUT_TIMEOUT timeout to add upper duration on the checkout hook#3794
Open
brandonnovick wants to merge 1 commit intobuildkite:mainfrom
Open
Add BUILDKITE_GIT_CHECKOUT_TIMEOUT timeout to add upper duration on the checkout hook#3794brandonnovick wants to merge 1 commit intobuildkite:mainfrom
brandonnovick wants to merge 1 commit intobuildkite:mainfrom
Conversation
zhming0
requested changes
Apr 15, 2026
Contributor
zhming0
left a comment
There was a problem hiding this comment.
Thank you so much for raising this PR @brandonnovick , we agree with the general direction but we think it's best if we be putting the timeout per attempt.
Please let us know you want to give it an another shot, or alternatively raising a feature request to us.
Lastly, for our curiosity, how often is such git hanging issue happening for you?
Contributor
There was a problem hiding this comment.
Adding a global timeout to checkout is something that we are a bit hesitant about, given there is an retry mechanism underneath the checkout.
However, we think it's very reasonable to add a timeout setting for each retry attempt, it would:
- Kill a hung individual git operation quickly
- Still allow the retry loop to kick in and try again
Unblocking CI is our ultimate goal.
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
Adds a new --git-checkout-timeout flag / BUILDKITE_GIT_CHECKOUT_TIMEOUT environment variable that allows configuring a timeout (in seconds) for the entire git checkout phase. When the timeout is exceeded, the job fails with exit code 95. When unset or set to 0, checkout runs with no timeout (existing behavior).
Context
Long-running or hung git operations (clone, fetch, checkout, submodule update) can cause jobs to hang indefinitely. This is particularly bad in this modern era of GitHub where conditions have been suffering recently. This provides a mechanism to fail fast with a clear exit code when checkout takes too long. This is useful for CI environments where retries are leaned upon heavily , even in the face of needed infrastructure improvements (potential network throttling, etc. )
Changes
env:"BUILDKITE_GIT_CHECKOUT_TIMEOUT" tag
the checkout call; returns shell.ExitError{Code: 95} on timeout
fields are loaded correctly
Testing
pipeline has run automatically.
Contributions
This PR was largely generated by Claude code, but reviewed manually and tweaked by a human