From b725b61eb3dfa6ad3a56904256c837ee7b9bc2d6 Mon Sep 17 00:00:00 2001 From: Alexander Mayo Date: Thu, 17 Sep 2026 00:56:30 -0500 Subject: [PATCH] fix(build): the embedded web UI build ran out of heap on the Intel release runner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit desktop-v1.18.68 failed twice on macos-15-intel while arm64 and Windows passed: vite build (the web UI embedded into the sidecar) FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory ~2017 MB, inside JsonStringify (sourcemap output) The build runs vite under node, which defaults to a ~2 GB old-space limit there. It was BORDERLINE, not broken: the identical commit built fine on the same runner an hour earlier, and the three previous Intel builds all passed. That is the worst kind of release failure — it fires at random, and only after the other platforms have built. (Attempt 1's "Unable to connect" was a separate network blip, which is why the first read of it as transient looked right.) The verifier did its job both times: publish went ahead without the x64 assets, and verify-and-promote refused with "manifest is missing darwin-x86_64", so no user was ever offered an incomplete release. Fix: NODE_OPTIONS=--max-old-space-size=4096 for that build, appended to any NODE_OPTIONS already set. Proven to reach the node child through the exact bun-shell + `bun run --cwd … build` path by asking for a value that differs from this machine's default (1234 -> 1282, 6000 -> 6048); a probe using 4096 on a Mac whose default is already ~4.2 GB would have passed without proving anything. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01JwiqN8M84qimu1TjZGSsdQ --- packages/opencode/script/build.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/opencode/script/build.ts b/packages/opencode/script/build.ts index b34a79241287..4918af80618f 100755 --- a/packages/opencode/script/build.ts +++ b/packages/opencode/script/build.ts @@ -27,7 +27,15 @@ const createEmbeddedWebUIBundle = async () => { console.log(`Building Web UI to embed in the binary`) const appDir = path.join(import.meta.dirname, "../../app") const dist = path.join(appDir, "dist") - await $`OPENCODE_CHANNEL=${Script.channel} bun run --cwd ${appDir} build` + // HEAP HEADROOM for vite. The embedded UI build runs under node and sat right at node's default + // ~2 GB old-space limit: on the Intel macOS release runner it died with "Reached heap limit + // Allocation failed - JavaScript heap out of memory" at 2017 MB, inside JSON.stringify of the + // sourcemaps (desktop-v1.18.68, 2026-09-17). The same commit had passed an hour earlier, so it + // was borderline, not broken — and a borderline build fails a release at random, after the + // other platforms have already published. 4 GB leaves real room on a 14 GB runner. Appended, + // not replaced, so any NODE_OPTIONS the caller set still applies. + const nodeOptions = [process.env.NODE_OPTIONS, "--max-old-space-size=4096"].filter(Boolean).join(" ") + await $`OPENCODE_CHANNEL=${Script.channel} NODE_OPTIONS=${nodeOptions} bun run --cwd ${appDir} build` const files = (await Array.fromAsync(new Bun.Glob("**/*").scan({ cwd: dist }))) .map((file) => file.replaceAll("\\", "/")) .filter((file) => !file.endsWith(".map"))