Skip to content

Commit 641708e

Browse files
committed
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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTcGpX2RVXH9BXATkDJLdm
1 parent 15c2c83 commit 641708e

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

  • crates/socket-patch-cli/tests/cargo_e2e_matrix

‎crates/socket-patch-cli/tests/cargo_e2e_matrix/mod.rs‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,20 @@ pub fn skip(suite: &str, why: &str) -> bool {
8080
true
8181
}
8282

83+
/// `net.retry` for the children of a [`required`] leg. Cargo retries only
84+
/// the transfers it classifies as spurious (connect failures, timeouts,
85+
/// 5xx) and backs off ~1s, 3.5s, 6.5s, 9.5s, then 10s per attempt, so 10
86+
/// rides out a ~80s crates.io / runner network blip where the default 3
87+
/// gave up after ~11s and failed the leg (a fresh-CARGO_HOME baseline build
88+
/// hit "Could not connect to static.crates.io" in the lock-v4 leg).
89+
const REQUIRED_NET_RETRY: &str = "10";
90+
8391
/// A `cargo` child with the fixture's private `CARGO_HOME`, the pinned
8492
/// toolchain, and no ambient `CARGO_TARGET_DIR` (shared-build-cache setups
85-
/// would redirect child builds out of the fixture).
93+
/// would redirect child builds out of the fixture). On a [`required`] leg
94+
/// it also widens cargo's own network retry (an explicit ambient
95+
/// `CARGO_NET_RETRY` wins); an optional run keeps the default so an
96+
/// offline machine still skips quickly.
8697
pub fn cargo_command(cwd: &Path, cargo_home: &Path) -> Command {
8798
let mut cmd = Command::new("cargo");
8899
cmd.current_dir(cwd)
@@ -91,6 +102,9 @@ pub fn cargo_command(cwd: &Path, cargo_home: &Path) -> Command {
91102
if let Some(tc) = toolchain() {
92103
cmd.env("RUSTUP_TOOLCHAIN", tc);
93104
}
105+
if required() && env_nonempty("CARGO_NET_RETRY").is_none() {
106+
cmd.env("CARGO_NET_RETRY", REQUIRED_NET_RETRY);
107+
}
94108
cmd
95109
}
96110

0 commit comments

Comments
 (0)