From 24e96bd8c14863879b5e1ab4d4e112e3bf9536e2 Mon Sep 17 00:00:00 2001 From: Alix-007 Date: Thu, 16 Jul 2026 13:35:24 +0800 Subject: [PATCH] fix(qa-lab): prevent Slack desktop bootstrap hangs (#108161) * fix(qa-lab): bound Slack installer downloads * fix(qa-lab): bound Slack installer retry window --- .../slack-desktop-smoke.runtime.test.ts | 19 +++++++++++++++++-- .../src/mantis/slack-desktop-smoke.runtime.ts | 12 ++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/extensions/qa-lab/src/mantis/slack-desktop-smoke.runtime.test.ts b/extensions/qa-lab/src/mantis/slack-desktop-smoke.runtime.test.ts index 33640ce7d861..0ca104634269 100644 --- a/extensions/qa-lab/src/mantis/slack-desktop-smoke.runtime.test.ts +++ b/extensions/qa-lab/src/mantis/slack-desktop-smoke.runtime.test.ts @@ -200,14 +200,29 @@ describe("mantis Slack desktop smoke runtime", () => { expect(remoteScript).toContain("build-essential python3"); expect(remoteScript).toContain("node_supports_type_stripping"); expect(remoteScript).toContain("scripts/crabbox-untrusted-bootstrap.sh"); - expect(remoteScript).toContain("https://nodejs.org/dist/v$node_version"); + expect(remoteScript).toContain( + "curl -fsSL --connect-timeout 10 --max-time 120 https://deb.nodesource.com/setup_22.x", + ); + expect(remoteScript).toContain( + 'curl -fsSL --connect-timeout 10 --max-time 120 --retry 3 --retry-max-time 120 --retry-all-errors "$node_base_url/SHASUMS256.txt"', + ); + expect(remoteScript).toContain( + 'curl -fsSL --connect-timeout 10 --max-time 120 --retry 3 --retry-max-time 120 --retry-all-errors "$node_base_url/$node_archive"', + ); expect(remoteScript).toContain('grep " $node_archive$" SHASUMS256.txt | sha256sum -c -'); expect(remoteScript).toContain('export PATH="$node_root/bin:$PATH"'); expect(remoteScript).toContain("packageManager ??"); expect(remoteScript).toContain("[0-9a-f]{128}"); expect(remoteScript).toContain('console.log(match[1] + " " + match[2])'); expect(remoteScript).toContain('active_pnpm_version="$(pnpm --version 2>/dev/null || true)"'); - expect(remoteScript).toContain("https://registry.npmjs.org/pnpm/-/pnpm-$pnpm_version.tgz"); + expect(remoteScript).toContain( + "curl -fsSL --connect-timeout 10 --max-time 120 --retry 3 --retry-max-time 120 --retry-all-errors", + ); + expect(remoteScript).toContain('"https://registry.npmjs.org/pnpm/-/pnpm-$pnpm_version.tgz"'); + expect(remoteScript?.match(/--connect-timeout 10 --max-time 120/gu)?.length).toBe(4); + expect(remoteScript?.match(/--retry 3 --retry-max-time 120 --retry-all-errors/gu)?.length).toBe( + 3, + ); expect(remoteScript).toContain('sha512sum "$pnpm_archive"'); expect(remoteScript).toContain('chmod +x "$pnpm_cli"'); expect(remoteScript).toContain('ln -sfn "$pnpm_cli" "$pnpm_bin_dir/pnpm"'); diff --git a/extensions/qa-lab/src/mantis/slack-desktop-smoke.runtime.ts b/extensions/qa-lab/src/mantis/slack-desktop-smoke.runtime.ts index 71db37e28538..04dbab66e065 100644 --- a/extensions/qa-lab/src/mantis/slack-desktop-smoke.runtime.ts +++ b/extensions/qa-lab/src/mantis/slack-desktop-smoke.runtime.ts @@ -596,7 +596,7 @@ if [ -n "\${OPENCLAW_LIVE_OPENAI_KEY:-}" ] && [ -z "\${OPENAI_API_KEY:-}" ]; the fi if ! command -v node >/dev/null 2>&1; then sudo apt-get update -y >"$out/node-apt.log" 2>&1 - curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - >>"$out/node-apt.log" 2>&1 + curl -fsSL --connect-timeout 10 --max-time 120 https://deb.nodesource.com/setup_22.x | sudo -E bash - >>"$out/node-apt.log" 2>&1 sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs >>"$out/node-apt.log" 2>&1 fi if ! command -v scrot >/dev/null 2>&1; then @@ -726,9 +726,11 @@ run_mantis_remote_body() { node_tmp="$(mktemp -d)" node_archive="node-v$node_version-linux-$node_arch.tar.xz" node_base_url="https://nodejs.org/dist/v$node_version" - curl -fsSL --retry 3 --retry-all-errors "$node_base_url/SHASUMS256.txt" \ + # Retry quick transient failures within 120 seconds, but do not start + # another long transfer after an attempt consumes that full deadline. + curl -fsSL --connect-timeout 10 --max-time 120 --retry 3 --retry-max-time 120 --retry-all-errors "$node_base_url/SHASUMS256.txt" \ -o "$node_tmp/SHASUMS256.txt" - curl -fsSL --retry 3 --retry-all-errors "$node_base_url/$node_archive" \ + curl -fsSL --connect-timeout 10 --max-time 120 --retry 3 --retry-max-time 120 --retry-all-errors "$node_base_url/$node_archive" \ -o "$node_tmp/$node_archive" (cd "$node_tmp" && grep " $node_archive$" SHASUMS256.txt | sha256sum -c -) rm -rf "$node_root" @@ -757,7 +759,9 @@ console.log(match[1] + " " + match[2]); pnpm_root="$out/pnpm-$pnpm_version" pnpm_archive="$pnpm_root/pnpm.tgz" mkdir -p "$pnpm_root" - curl -fsSL --retry 3 --retry-all-errors \ + # Retry quick transient failures within 120 seconds, but do not start + # another long transfer after an attempt consumes that full deadline. + curl -fsSL --connect-timeout 10 --max-time 120 --retry 3 --retry-max-time 120 --retry-all-errors \ "https://registry.npmjs.org/pnpm/-/pnpm-$pnpm_version.tgz" \ -o "$pnpm_archive" downloaded_pnpm_sha512="$(sha512sum "$pnpm_archive" | awk '{print $1}')"