From 4838e3934bbae3e577c0520d79a7310710981c5e Mon Sep 17 00:00:00 2001 From: Harold Hunt Date: Fri, 20 Mar 2026 13:15:55 -0400 Subject: [PATCH] Tests: default CI unit lanes to forks (#51145) --- scripts/test-parallel.mjs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/test-parallel.mjs b/scripts/test-parallel.mjs index 2901daad6b5..5bbd4c94ac6 100644 --- a/scripts/test-parallel.mjs +++ b/scripts/test-parallel.mjs @@ -82,17 +82,18 @@ const testProfile = ? rawTestProfile : "normal"; const isMacMiniProfile = testProfile === "macmini"; -// vmForks is still useful for local transform-heavy runs, but do not flip CI -// back to vmForks by default unless you have fresh green evidence on current -// main. The retained Vite/Vitest module graph is the OOM pattern we keep -// tripping over under CI-style pressure. Keep it opt-out via -// OPENCLAW_TEST_VM_FORKS=0, and let users force-enable with =1 for comparison. +// Vitest executes Node tests through Vite's SSR/module-runner pipeline, so the +// shared unit lane still retains transformed ESM/module state even when the +// tests themselves are not "server rendering" a website. vmForks can win in +// ideal transform-heavy cases, but for this repo we measured higher aggregate +// CPU load and fatal heap OOMs on memory-constrained dev machines and CI when +// unit-fast stayed on vmForks. Keep forks as the default unless that evidence +// is re-run and replaced: +// PR: https://github.com/openclaw/openclaw/pull/51145 +// OOM evidence: https://github.com/openclaw/openclaw/pull/51145#issuecomment-4099663958 +// Preserve OPENCLAW_TEST_VM_FORKS=1 as the explicit override/debug escape hatch. const supportsVmForks = Number.isFinite(nodeMajor) ? nodeMajor <= 24 : true; -const preferVmForksByDefault = - !isCI && !isWindows && supportsVmForks && !lowMemLocalHost && testProfile !== "low"; -const useVmForks = - process.env.OPENCLAW_TEST_VM_FORKS === "1" || - (process.env.OPENCLAW_TEST_VM_FORKS !== "0" && preferVmForksByDefault); +const useVmForks = process.env.OPENCLAW_TEST_VM_FORKS === "1" && supportsVmForks; const disableIsolation = process.env.OPENCLAW_TEST_NO_ISOLATE === "1"; const includeGatewaySuite = process.env.OPENCLAW_TEST_INCLUDE_GATEWAY === "1"; const includeExtensionsSuite = process.env.OPENCLAW_TEST_INCLUDE_EXTENSIONS === "1";