Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Frontend CI: back off for minutes before giving up on the Bun download (#17221)

Daniel Hana72288a809c7
diff --git a/.github/workflows/studio-frontend-ci.yml b/.github/workflows/studio-frontend-ci.yml
index 9aaf5777e8a..74cd3927792 100644
--- a/.github/workflows/studio-frontend-ci.yml
+++ b/.github/workflows/studio-frontend-ci.yml
@@ -264,8 +264,10 @@ jobs:
set -euo pipefail
BUN_VERSION="1.4.3"
BUN_SHA256="3e730528d89775f03f87f05c06787c4df4099d0a37f3f252e7b829cb23816e18"
+ # GitHub release assets 504 in bursts lasting minutes. Without --retry-delay curl backs
+ # off exponentially (1, 2, 4, ... s), so 8 retries wait about four minutes in total.
curl --proto '=https' --tlsv1.2 -fsSL \
- --retry 5 --retry-delay 3 --retry-connrefused --retry-all-errors \
+ --retry 8 --retry-connrefused --retry-all-errors \
-o "$RUNNER_TEMP/bun.zip" \
"https://github.com/oven-sh/bun/releases/download/bun-v${BUN_VERSION}/bun-linux-x64.zip"
echo "${BUN_SHA256} $RUNNER_TEMP/bun.zip" | sha256sum -c -
diff --git a/tests/test_bun_download_retries.py b/tests/test_bun_download_retries.py
new file mode 100644
index 00000000000..47eabf5f341
--- /dev/null
+++ b/tests/test_bun_download_retries.py
@@ -0,0 +1,45 @@
+"""The frontend CI Bun download must outlast a minutes-long burst of 504s from GitHub releases."""
+
+from __future__ import annotations
+
+import re
+import shlex
+from pathlib import Path
+
+import yaml
+
+ROOT = Path(__file__).resolve().parents[1]
+WORKFLOW = ROOT / ".github" / "workflows" / "studio-frontend-ci.yml"
+STEP = "Typecheck through bun check"
+
+
+def _curl_args():
+ jobs = yaml.safe_load(WORKFLOW.read_text(encoding = "utf-8"))["jobs"]
+ runs = [
+ s["run"] for job in jobs.values() for s in job.get("steps", []) if s.get("name") == STEP
+ ]
+ assert len(runs) == 1, f"expected one {STEP!r} step, found {len(runs)}"
+ script = re.sub(r"\\\n", " ", runs[0])
+ curls = [line for line in script.splitlines() if line.strip().startswith("curl ")]
+ assert len(curls) == 1, curls
+ return shlex.split(curls[0])
+
+
+def _backoff_seconds(args):
+ """Total wait curl spends between attempts on a server that keeps failing."""
+ retries = int(args[args.index("--retry") + 1]) if "--retry" in args else 0
+ if "--retry-delay" in args:
+ return retries * int(args[args.index("--retry-delay") + 1])
+ # curl doubles from one second, capped at ten minutes per wait.
+ return sum(min(2**i, 600) for i in range(retries))
+
+
+def test_the_bun_download_backs_off_for_minutes():
+ args = _curl_args()
+ assert "--retry-all-errors" in args, "a 504 is only retried with --retry-all-errors"
+ assert _backoff_seconds(args) >= 240, args
+
+
+def test_the_backoff_reader_matches_curl():
+ assert _backoff_seconds(["curl", "--retry", "3"]) == 7
+ assert _backoff_seconds(["curl", "--retry", "5", "--retry-delay", "3"]) == 15