From 641708e77e334acc2e2f0e97e4667d280db65bfb Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 13 Oct 2026 00:57:57 +0000 Subject: [PATCH] Widen cargo net retry in required e2e legs The cargo-vex-matrix lock-v4 leg failed on PR #1449 (run 38307581268, attempt 1; green on re-run of the same SHA) when a fresh-CARGO_HOME baseline `cargo build` could not connect to static.crates.io. Cargo classifies that error as spurious, but its default net.retry of 3 gives up after ~12s, and SOCKET_PATCH_CARGO_E2E_REQUIRED turns the failed fixture build into a failed leg. In the merge queue the same blip evicts an entry. Set CARGO_NET_RETRY=10 (~80s of cargo's own backoff) on the children of cargo_e2e_matrix::cargo_command when the leg is required and the caller has not set CARGO_NET_RETRY. Optional local runs keep the default so an offline machine still skips quickly. Only transfers cargo itself treats as transient are retried; checksum and resolver failures still fail at once. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01GTcGpX2RVXH9BXATkDJLdm --- .../tests/cargo_e2e_matrix/mod.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/socket-patch-cli/tests/cargo_e2e_matrix/mod.rs b/crates/socket-patch-cli/tests/cargo_e2e_matrix/mod.rs index f58f8fcf8..06af021e5 100644 --- a/crates/socket-patch-cli/tests/cargo_e2e_matrix/mod.rs +++ b/crates/socket-patch-cli/tests/cargo_e2e_matrix/mod.rs @@ -80,9 +80,20 @@ pub fn skip(suite: &str, why: &str) -> bool { true } +/// `net.retry` for the children of a [`required`] leg. Cargo retries only +/// the transfers it classifies as spurious (connect failures, timeouts, +/// 5xx) and backs off ~1s, 3.5s, 6.5s, 9.5s, then 10s per attempt, so 10 +/// rides out a ~80s crates.io / runner network blip where the default 3 +/// gave up after ~11s and failed the leg (a fresh-CARGO_HOME baseline build +/// hit "Could not connect to static.crates.io" in the lock-v4 leg). +const REQUIRED_NET_RETRY: &str = "10"; + /// A `cargo` child with the fixture's private `CARGO_HOME`, the pinned /// toolchain, and no ambient `CARGO_TARGET_DIR` (shared-build-cache setups -/// would redirect child builds out of the fixture). +/// would redirect child builds out of the fixture). On a [`required`] leg +/// it also widens cargo's own network retry (an explicit ambient +/// `CARGO_NET_RETRY` wins); an optional run keeps the default so an +/// offline machine still skips quickly. pub fn cargo_command(cwd: &Path, cargo_home: &Path) -> Command { let mut cmd = Command::new("cargo"); cmd.current_dir(cwd) @@ -91,6 +102,9 @@ pub fn cargo_command(cwd: &Path, cargo_home: &Path) -> Command { if let Some(tc) = toolchain() { cmd.env("RUSTUP_TOOLCHAIN", tc); } + if required() && env_nonempty("CARGO_NET_RETRY").is_none() { + cmd.env("CARGO_NET_RETRY", REQUIRED_NET_RETRY); + } cmd }