Repository navigation
fix(cache): cap remote cache uploads, retry transient errors, and use HTTP/1.1 - #1016
Merged
Merged
Conversation
fspy benchmarklinuxmacoswindows |
… HTTP/1.1 Co-authored-by: Gemini 4 Neon <noreply@google.com>
Co-authored-by: Gemini 4 Neon <noreply@google.com>
…cap to vt Keep vt_remote_cache a single-attempt HTTP/1.1 protocol client that surfaces retry hints on Error, and own retry, 429 cooldowns, per-kind outage circuit breakers, upload concurrency capping, and unified header+stream download retries in vt::session::cache::remote. Co-authored-by: Gemini 4 Neon <noreply@google.com>
…agePhase enums Co-authored-by: Gemini 4 Neon <noreply@google.com>
… tests Co-authored-by: Gemini 4 Neon <noreply@google.com>
…rver tap Co-authored-by: Gemini 4 Neon <noreply@google.com>
…ut to 10s Co-authored-by: Gemini 4 Neon <noreply@google.com>
… retry bounds Co-authored-by: Gemini 4 Neon <noreply@google.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4b5fb17. Configure here.
…aker Co-authored-by: Gemini 4 Neon <noreply@google.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.

Motivation
During remote-caching dogfooding in
voidzero-dev/void(2026-11-12 – 2026-11-25), 7 of 208read-writepushes dropped remote cache uploads and 2 Windows jobs had fetch failures:HTTP status 503when up to 20 tasks launched remote cache uploads concurrently with no cap against Cloudflare Worker's per-isolateAdmissionlimit (stores = 2,storeWaitMs = 30s).network erroruploads and 2× fetch failures (all Windows), including 28 simultaneous fetch failures after a 31s stall alongside a failing upload, because all concurrent fetches, downloads, and uploads multiplexed over a single HTTP/2 connection.503/429/5xx or network errors.Changes
crates/vt_remote_cache):reqwest'shttp2feature (droppingh2fromCargo.lock) and enforced.http1_only(), withpool_idle_timeout(30s),reqwest's default 15s TCP keep-alive, and a 10s per-attemptFETCH_TIMEOUTonPOST /fetch.vt_remote_cache::Clienta thin, single-attempt wire client and surfacedError::retry_hint() -> RetryHint(Permanent,Transient,RateLimited { retry_after },Outage) so impossible predicate combinations are unrepresentable.429-only cooldowns, and outage circuit breakers (crates/vt/src/session/cache/remote.rs,crates/vt/src/session/cache/remote/retry.rs):Semaphore(MAX_CONCURRENT_STORES = 4) inRemoteEndpoint::storeheld across retries, bounding burst pressure and open file handles while keeping background uploads cancellable on Ctrl-C.408,429, and5xx(excluding501/505/511) with[0.5x, 1.0x]equal jitter: up to 3 retries (60s retry budget) forstore, and up to 2 retries (15s retry budget) forfetchanddownload.download_checkedheader and mid-stream archive retries in oneretry::runloop (passingcancel_tokenintoretry::runsodownload_oncealways joins its blocking check task and closes the.tmphandle on cancel; never retryingWriteArchive,CorruptArchive, or cancellation).RateLimitgates honor integerRetry-After(clamped to 10s, floored at the attempt's backoff, with random wake-up spread) only on429, intentionally ignoringRetry-Afteron503.OutageBreakers (modeled withOutagePhase::{Closed, Open, HalfOpen}, opening for 30s after 3 consecutive exhausted outage failures, probing with one single-attempt request, and preserving open state if a probe is cancelled) bound worst-case stalls when an endpoint is down without letting store failures block reads.packages/tools/src/remote-cache,crates/vt_bin/tests/e2e_snapshots/fixtures/remote_cache_resilience):remote-cache-server's tap proxy with per-run fault injection (--fault,--always-fail), a zero-sleepPromisegate (--hold-stores,--release-after-fetches), and--summaryoutput, plus internalVP_RUN_INTERNAL_REMOTE_CACHE_NO_BACKOFFfor zero-sleep retries in tests.crates/vt_remote_cache/README.md,packages/tools/README.md, andCHANGELOG.md.Note
Medium Risk
Changes default remote cache networking, concurrency, and failure handling for all read-write users; behavior is heavily tested but mistakes could affect cache hit rates or upload reliability in CI.
Overview
Hardens remote cache traffic after production issues with uncapped upload bursts, HTTP/2 connection sharing, and no retries on transient failures.
The low-level
vt_remote_cacheclient now uses pooled HTTP/1.1 only (dropping thehttp2dependency), adds a 10s fetch timeout and 30s pool idle timeout, and exposesError::retry_hint()so callers can classify failures without embedding retry logic in the wire client.Session-level orchestration wraps each endpoint in a
RemoteEndpointwith at most 4 concurrent uploads, jittered exponential backoff for reads vs stores, shared429cooldowns (reads and stores tracked separately), and per-kind outage circuit breakers that can short-circuit with “remote cache temporarily unavailable.” Fetch, blob download, and store paths all flow through a newretrymodule; downloads retry as a single loop while still joining the archive check task on cancel.Test and dogfooding support:
VP_RUN_INTERNAL_REMOTE_CACHE_NO_BACKOFFfor deterministic retries, an expandedremote-cache-servertap (--fault,--always-fail,--hold-stores,--summary), and ignored e2e fixtures for retry, circuit breaking, and upload caps.Reviewed by Cursor Bugbot for commit 2bdf5b8. Bugbot is set up for automated code reviews on this repo. Configure here.