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_*' ->
'<pkg>/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.
This commit is contained in:
Tianyi Cui
2026-07-28 16:16:10 +08:00
parent 15ed8e5d55
commit 6227b55e4a
+20 -2
View File
@@ -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"