From d65b4b0e5dda08f6f9c8387277f51a088b87339c Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Apr 2026 15:06:40 +0000 Subject: [PATCH] fix(marmot-interop): retry gradle :cli:installDist on transient 503s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit jitpack.io and dl.google.com both return 503 on a non-trivial fraction of cold-cache fetches, and Gradle disables the whole repository for the rest of the build the moment a single 503 lands — so one bad roll aborts the entire harness before any test gets to run. Wrap the gradle invocation in a 4-attempt retry loop; each attempt resumes from Gradle's local cache so only the still-missing artifacts get re-fetched. In practice the retry completes in seconds when jitpack is the only flake, and the whole preflight still wall-clocks well under the first attempt's runtime. Existing success path is unchanged. https://claude.ai/code/session_018kSBco5VVfctkW6vAm7NzA --- tools/marmot-interop/headless/setup.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/marmot-interop/headless/setup.sh b/tools/marmot-interop/headless/setup.sh index c58658a65..9f79f3c10 100644 --- a/tools/marmot-interop/headless/setup.sh +++ b/tools/marmot-interop/headless/setup.sh @@ -19,12 +19,25 @@ preflight() { done # Build `amy` via gradle if missing. + # + # jitpack.io and dl.google.com both return transient 503s on a non-trivial + # fraction of cold-cache fetches, and Gradle disables the entire repository + # for the rest of the build the moment a single 503 lands — so one bad + # roll aborts the whole harness. Retry a few times; each attempt resumes + # from Gradle's cache so only the still-missing artifacts get re-fetched. if [[ ! -x "$AMY_BIN" ]]; then if [[ "$NO_BUILD" -eq 1 ]]; then fail_msg "amy not found at $AMY_BIN and --no-build set"; exit 1 fi - step "building :cli:installDist" - ( cd "$REPO_ROOT" && ./gradlew :cli:installDist ) 2>&1 | tee -a "$LOG_FILE" + local attempt max_attempts=4 + for attempt in $(seq 1 $max_attempts); do + step "building :cli:installDist (attempt $attempt/$max_attempts)" + if ( cd "$REPO_ROOT" && ./gradlew :cli:installDist ) 2>&1 | tee -a "$LOG_FILE" \ + && [[ -x "$AMY_BIN" ]]; then + break + fi + [[ "$attempt" -lt "$max_attempts" ]] && warn "gradle build failed (likely transient jitpack/Google 503) — retrying" + done fi [[ -x "$AMY_BIN" ]] || { fail_msg "amy still missing after build"; exit 1; } info "amy: $AMY_BIN"