From e3bab80bda66fbab5c65a46fe55cebedbfa4dabb Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Fri, 19 Jun 2026 01:50:54 +0200 Subject: [PATCH] fix(e2e): give cleanup smoke build heap headroom --- scripts/docker/cleanup-smoke/run.sh | 13 +++++++++++++ test/scripts/docker-build-helper.test.ts | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/scripts/docker/cleanup-smoke/run.sh b/scripts/docker/cleanup-smoke/run.sh index 2fcc3374f92..ea1468b665b 100755 --- a/scripts/docker/cleanup-smoke/run.sh +++ b/scripts/docker/cleanup-smoke/run.sh @@ -43,6 +43,19 @@ print_log_tail() { read_positive_int_env OPENCLAW_CLEANUP_SMOKE_LOG_PRINT_BYTES 65536 >/dev/null +ensure_cleanup_smoke_node_options() { + local current="${NODE_OPTIONS:-}" + case " $current " in + *" --max-old-space-size="* | *" --max-old-space-size "* | *" --max_old_space_size="* | *" --max_old_space_size "*) + ;; + *) + current="${current:+$current }--max-old-space-size=8192" + ;; + esac + export NODE_OPTIONS="$current" +} +ensure_cleanup_smoke_node_options + echo "==> Build" if ! pnpm build >/tmp/openclaw-cleanup-build.log 2>&1; then print_log_tail /tmp/openclaw-cleanup-build.log diff --git a/test/scripts/docker-build-helper.test.ts b/test/scripts/docker-build-helper.test.ts index 2266e52ab66..cad552f67fa 100644 --- a/test/scripts/docker-build-helper.test.ts +++ b/test/scripts/docker-build-helper.test.ts @@ -246,6 +246,19 @@ docker_build_transient_failure "$LOG_PATH" expect(cleanupRun).not.toContain("cat /tmp/openclaw-cleanup-"); }); + it("gives cleanup-smoke builds enough Node heap while preserving explicit callers", () => { + const cleanupRun = readFileSync(CLEANUP_SMOKE_RUN_PATH, "utf8"); + + expect(cleanupRun).toContain("ensure_cleanup_smoke_node_options()"); + expect(cleanupRun).toContain("export NODE_OPTIONS=\"$current\""); + expect(cleanupRun).toContain("--max-old-space-size=8192"); + expect(cleanupRun).toContain("*\" --max-old-space-size=\"*"); + expect(cleanupRun).toContain("*\" --max_old_space_size=\"*"); + expect(cleanupRun.indexOf("ensure_cleanup_smoke_node_options")).toBeLessThan( + cleanupRun.indexOf("pnpm build >/tmp/openclaw-cleanup-build.log"), + ); + }); + it("rejects invalid cleanup-smoke log byte limits", () => { const workDir = mkdtempSync(join(tmpdir(), "openclaw-cleanup-smoke-log-invalid-"));