From 6227b55e4aef8c13be8caa3159e3a0ddd6126624 Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Tue, 28 Jul 2026 16:16:10 +0800 Subject: [PATCH] fix(ci): retry the Wine lane's pnpm install on the hoisted-linker rename race The wine blocking job flaked with ERR_PNPM_ENOENT rename '_tmp_*' -> '/node_modules/esbuild' during workspace snapshot + pnpm install (runs 30334004123 and 30340039598), and a plain rerun passed. Root cause is upstream pnpm/pnpm#12880: the hoisted linker's parallel linkers race to rename their _tmp_* staging directory onto the same nested package path, and the loser exits although an identical re-install succeeds. Only this lane uses nodeLinker: hoisted, so only this lane hits it. snapshot_and_install now retries exactly that log signature up to two times, wiping the scratch tree's node_modules first (the snapshot itself contains none, so the wipe restores the pre-install state) and logging each retry with the upstream issue. Any other install failure still fails on the first attempt, and a race that survives the final attempt still fails loud with the install log tail. --- scripts/wine-windows-gates.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/scripts/wine-windows-gates.sh b/scripts/wine-windows-gates.sh index 8b6dcd8a0a..7706a88a4b 100755 --- a/scripts/wine-windows-gates.sh +++ b/scripts/wine-windows-gates.sh @@ -125,8 +125,26 @@ supportedArchitectures: os: [current, win32] cpu: [current, x64] EOF - (cd "$scratch/tree" && pnpm install --frozen-lockfile --ignore-scripts > "$scratch/logs/install.log" 2>&1) \ - || { tail -40 "$scratch/logs/install.log" >&2; return 1; } + # The hoisted linker — used only by this lane — has an upstream rename + # race (pnpm/pnpm#12880): parallel linkers staging a nested package copy + # (observed on the tree's nested esbuild versions) rename their _tmp_* + # directory onto a path another racer already claimed, and the loser + # exits ERR_PNPM_ENOENT although an identical re-install succeeds. + # Exactly that signature earns up to two retries on a clean tree — the + # snapshot contains no node_modules, so wiping them restores the + # pre-install state; any other failure, or the race still standing after + # the final attempt, fails loud with the log tail. + local attempt + for attempt in 1 2 3; do + (cd "$scratch/tree" && pnpm install --frozen-lockfile --ignore-scripts > "$scratch/logs/install.log" 2>&1) \ + && return 0 + grep -q 'ERR_PNPM_ENOENT.*rename.*_tmp_' "$scratch/logs/install.log" || break + (( attempt < 3 )) || break + echo "wine-windows-gates: pnpm hoisted-linker rename race (pnpm/pnpm#12880) on install attempt $attempt; retrying on a clean tree" >&2 + find "$scratch/tree" -name node_modules -type d -prune -exec rm -rf {} + + done + tail -40 "$scratch/logs/install.log" >&2 + return 1 } mkdir "$scratch/tree"