From c741688d1a77584aded529ee2ce48b6cb4817f97 Mon Sep 17 00:00:00 2001 From: Garrison Snelling Date: Tue, 21 Jul 2026 19:01:52 +0000 Subject: [PATCH 1/2] fix: use stateful mode for cloud-run and handle missing packages Cloud Run's default ephemeral mode (sandbox do) creates a fresh sandbox for each command with no filesystem persistence. Switch to stateful mode (sandbox run/exec/delete) with write=true and allowEgress=true for persistent sessions that support the benchmark's clone+install+typecheck workload. Also fix the benchmark script to handle minimal package lists (e.g. cloud-run gVisor images that lack python3-setuptools and unzip): - Split apt/dnf install into required (must succeed) and optional (can fail) package groups - Add Python zipfile fallback for unpacking bun when unzip is unavailable --- benchmarks/sandbox/providers.ts | 8 +++++++- benchmarks/scripts/dax-benchmark.sh | 26 +++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/benchmarks/sandbox/providers.ts b/benchmarks/sandbox/providers.ts index 2048c655..3928ea06 100644 --- a/benchmarks/sandbox/providers.ts +++ b/benchmarks/sandbox/providers.ts @@ -57,7 +57,13 @@ export const providers: ProviderConfig[] = [ { name: 'cloud-run', requiredEnvVars: ['CLOUD_RUN_SANDBOX_URL', 'CLOUD_RUN_SANDBOX_SECRET'], - createCompute: () => cloudRun({ sandboxUrl: process.env.CLOUD_RUN_SANDBOX_URL!, sandboxSecret: process.env.CLOUD_RUN_SANDBOX_SECRET! }), + createCompute: () => cloudRun({ + sandboxUrl: process.env.CLOUD_RUN_SANDBOX_URL!, + sandboxSecret: process.env.CLOUD_RUN_SANDBOX_SECRET!, + executionMode: 'stateful', + write: true, + allowEgress: true, + }), }, { name: 'cloudflare', diff --git a/benchmarks/scripts/dax-benchmark.sh b/benchmarks/scripts/dax-benchmark.sh index 0689f765..6fcbfd8d 100755 --- a/benchmarks/scripts/dax-benchmark.sh +++ b/benchmarks/scripts/dax-benchmark.sh @@ -138,13 +138,21 @@ prepare() { case "$PKG_MANAGER" in apt) "${SUDO[@]}" apt-get update -qq + # Required packages — must succeed. "${SUDO[@]}" env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \ - bash build-essential ca-certificates curl git python3 python3-setuptools unzip + bash build-essential ca-certificates curl git python3 + # Optional packages — not available on all minimal images (e.g. cloud-run). + "${SUDO[@]}" env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \ + python3-setuptools unzip 2>/dev/null || true ;; dnf) "${SUDO[@]}" dnf makecache --quiet + # Required packages — must succeed. + "${SUDO[@]}" dnf install -y --allowerasing \ + bash gcc gcc-c++ make ca-certificates curl git python3 + # Optional packages — not available on all minimal images. "${SUDO[@]}" dnf install -y --allowerasing \ - bash gcc gcc-c++ make ca-certificates curl git python3 python3-setuptools unzip + python3-setuptools unzip 2>/dev/null || true ;; apk) # build-base is Alpine's meta-package for gcc/g++/make/libc-dev. @@ -189,7 +197,19 @@ download_bun() { } unpack_bun() { - unzip -q -j "$ROOT/bun.zip" "$BUN_INTERNAL_PATH" -d "$BUN_INSTALL/bin" + if command -v unzip >/dev/null 2>&1; then + unzip -q -j "$ROOT/bun.zip" "$BUN_INTERNAL_PATH" -d "$BUN_INSTALL/bin" + else + # Fallback for minimal images without unzip (e.g. cloud-run gVisor). + python3 -c " +import zipfile, os, sys +with zipfile.ZipFile('$ROOT/bun.zip') as z: + data = z.read('$BUN_INTERNAL_PATH') + os.makedirs('$BUN_INSTALL/bin', exist_ok=True) + with open(os.path.join('$BUN_INSTALL/bin', 'bun'), 'wb') as f: + f.write(data) +" + fi chmod +x "$BUN_INSTALL/bin/bun" } From e2330dde9940851a81baa0771488d9684d71712c Mon Sep 17 00:00:00 2001 From: garrison Date: Mon, 27 Jul 2026 21:07:17 +0000 Subject: [PATCH 2/2] fix(dax): keep optional apt packages from failing the whole install apt-get installs nothing when any argument is unknown, so filter unavailable optional packages instead of splitting them into a second install pass, and extract bun via a heredoc-quoted Python fallback when unzip is absent. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- benchmarks/scripts/dax-benchmark.sh | 45 +++++++++++++++++------------ 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/benchmarks/scripts/dax-benchmark.sh b/benchmarks/scripts/dax-benchmark.sh index 6fcbfd8d..fb8c5479 100755 --- a/benchmarks/scripts/dax-benchmark.sh +++ b/benchmarks/scripts/dax-benchmark.sh @@ -138,21 +138,27 @@ prepare() { case "$PKG_MANAGER" in apt) "${SUDO[@]}" apt-get update -qq - # Required packages — must succeed. - "${SUDO[@]}" env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \ - bash build-essential ca-certificates curl git python3 - # Optional packages — not available on all minimal images (e.g. cloud-run). - "${SUDO[@]}" env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \ - python3-setuptools unzip 2>/dev/null || true + # python3-setuptools and unzip are missing from some minimal images (e.g. + # cloud-run's gVisor rootfs), and apt-get installs *nothing* when any + # argument is unknown, so drop unavailable ones instead of losing the + # whole transaction. unzip has a Python fallback in unpack_bun(). + local packages=(bash build-essential ca-certificates curl git python3) + local optional + for optional in python3-setuptools unzip; do + if apt-cache show "$optional" >/dev/null 2>&1; then + packages+=("$optional") + fi + done + "${SUDO[@]}" env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq "${packages[@]}" ;; dnf) "${SUDO[@]}" dnf makecache --quiet - # Required packages — must succeed. "${SUDO[@]}" dnf install -y --allowerasing \ bash gcc gcc-c++ make ca-certificates curl git python3 - # Optional packages — not available on all minimal images. - "${SUDO[@]}" dnf install -y --allowerasing \ - python3-setuptools unzip 2>/dev/null || true + local optional + for optional in python3-setuptools unzip; do + "${SUDO[@]}" dnf install -y --allowerasing "$optional" || true + done ;; apk) # build-base is Alpine's meta-package for gcc/g++/make/libc-dev. @@ -200,15 +206,16 @@ unpack_bun() { if command -v unzip >/dev/null 2>&1; then unzip -q -j "$ROOT/bun.zip" "$BUN_INTERNAL_PATH" -d "$BUN_INSTALL/bin" else - # Fallback for minimal images without unzip (e.g. cloud-run gVisor). - python3 -c " -import zipfile, os, sys -with zipfile.ZipFile('$ROOT/bun.zip') as z: - data = z.read('$BUN_INTERNAL_PATH') - os.makedirs('$BUN_INSTALL/bin', exist_ok=True) - with open(os.path.join('$BUN_INSTALL/bin', 'bun'), 'wb') as f: - f.write(data) -" + # Fallback for minimal images without unzip (e.g. cloud-run's gVisor rootfs). + python3 - "$ROOT/bun.zip" "$BUN_INTERNAL_PATH" "$BUN_INSTALL/bin" <<'PY' +import os, shutil, sys, zipfile + +archive, member, dest_dir = sys.argv[1:4] +os.makedirs(dest_dir, exist_ok=True) +with zipfile.ZipFile(archive) as z, z.open(member) as src: + with open(os.path.join(dest_dir, 'bun'), 'wb') as dst: + shutil.copyfileobj(src, dst) +PY fi chmod +x "$BUN_INSTALL/bin/bun" }