fix(git): retry transient upstream clone and fetch failures - #37
Merged
rolandjitsu merged 2 commits intoSep 16, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #37 +/- ##
==========================================
+ Coverage 96.37% 96.69% +0.32%
==========================================
Files 6 6
Lines 1682 1846 +164
==========================================
+ Hits 1621 1785 +164
Misses 61 61 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rolandjitsu
reviewed
Sep 14, 2026
Owner
|
Thanks for your contribution @hzqst . I've left a couple of minor comments. Also, please check https://github.com/rolandjitsu/git-cache-proxy/blob/main/CONTRIBUTING.md#commit-messages and fixup the commit. |
Contributor
Author
will fix soon |
Avoid failing requests immediately on transient upstream network errors. Retry recognized failures with bounded backoff while preserving mirror freshness and per-repository serialization. Assisted-by: Codex:gpt-6-astra
hzqst
force-pushed
the
fix/upstream-network-retries
branch
from
September 14, 2026 15:15
6cdc8f9 to
c2ae72a
Compare
Owner
|
@hzqst one of the CI jobs is failing - the dependency check. |
Assisted-by: Codex:gpt-6-astra
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.
What kind of change does this PR introduce?
Summary
Related issue: #35
A transient upstream TLS interruption currently fails a clone/fetch request immediately with HTTP 502, even when a cached mirror exists. This caused intermittent release failures on self-hosted Windows runners using git-cache-proxy 0.1.11 in Docker on WSL2.
During the incident, the client received
upstream fetch failedand HTTP 502. The proxy logged the underlying error while fetching an existing public repository:Related incident: HLND2T/CS2_VibeSignatures#956
This change adds a shared retry helper for upstream
git clone --mirrorandgit fetch:C. Log retry metadata and error categories without exposing raw upstream stderr.Exhausted retries still return 502; there is no fallback to stale refs. The retry policy does not apply to LFS or local upload-pack, and does not impose a new transfer timeout. It adds at most seven seconds of backoff, excluding time spent in Git operations.
Deployed this implementation in my WSL2 docker and have not observed the HTTP 502 problem again since then.
Tests
Added diagnostic classification tests and integration tests using real local Git repositories, injected failures, and Tokio's paused clock. Coverage includes transient recovery, retry exhaustion, permanent failures, clone staging cleanup, freshness after failure, concurrent request coalescing, and large stderr output.
Validation on the source corresponding to commit
6cdc8f9:cargo test --all-features --locked: all 65 tests passed.src/git.rs, exceeding the 80% local coverage gate.Checklist
cargo fmt --all --check,cargo clippy --all-targets --all-features --locked -- -D warnings,cargo test --all-featuresAssisted-by:trailer (The commit uses a Conventional Commit subject, but currently carriesCo-Authored-By: Codex <codex@openai.com>rather than the requiredAssisted-by)Breaking change?
No. Flags, environment variables, and the on-disk cache layout are unchanged; no migration is required. Recognized transient upstream failures may take longer to return an error because they now receive a bounded number of retries.