Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(gates): the launchers ask for a GPU process that survives, and one gate reads its own diagnosis

esenginea90bd25b5e41
diff --git a/tools/check-electron-preconditions.mjs b/tools/check-electron-preconditions.mjs
index 57af83643..cb6c89ace 100644
--- a/tools/check-electron-preconditions.mjs
+++ b/tools/check-electron-preconditions.mjs
@@ -77,6 +77,15 @@ for (const rel of tracked('tools/launchers/*.mjs').concat(tracked('tools/render-
if (!/enable-unsafe-swiftshader/.test(src)) {
problems.push(`${rel} — launches Electron without the software-GL fallback`);
}
+ // The software rasteriser is only half of it. The GPU PROCESS keeps a sandbox
+ // ELECTRON_DISABLE_SANDBOX does not reach, and it died at frame 0 on the runner
+ // — one gate spent a fortnight reporting that as the package's own failure.
+ if (!/disable-gpu-sandbox/.test(src)) {
+ problems.push(`${rel} — launches Electron without disabling the GPU process sandbox`);
+ }
+ if (!/in-process-gpu/.test(src)) {
+ problems.push(`${rel} — launches Electron without asking Linux for an in-process GPU`);
+ }
}
if (!mains) problems.push('tools/launchers — found no Electron main at all; this scan is broken');
diff --git a/tools/check-script-failure.mjs b/tools/check-script-failure.mjs
index c060c183c..c007ac00f 100644
--- a/tools/check-script-failure.mjs
+++ b/tools/check-script-failure.mjs
@@ -89,12 +89,19 @@ const GPU_GONE = /GPU device lost|createTexture failed|Failed to create texture/
/**
* What the launcher said the errors WERE, not how many.
*
- * It prints each one indented under its verdict; this kept only the count, so a
- * failure read "errors 3" and left nothing to act on — a gate that saw the
- * answer and reported the arithmetic.
+ * It prints each one indented under its verdict, capped at five, and then keeps
+ * writing at that same indent — how far it got, what the canvas was, "one flat
+ * colour". Taking every indented line therefore took diagnosis for error, which
+ * is what made a wholly environmental failure look partly like the package's.
*/
+const SHOWN = 5;
function errorLines(text) {
- return text.split('\n').filter((l) => /^ {4}\S/.test(l.trimEnd())).map((l) => l.trim());
+ const lines = text.split('\n');
+ const at = lines.findIndex((l) => /^[✓✗] /.test(l.trim()));
+ if (at < 0) return [];
+ const n = Math.min(Number(/errors=(\d+)/.exec(lines[at])?.[1] ?? 0), SHOWN);
+ return lines.slice(at + 1, at + 1 + n)
+ .filter((l) => /^ {4}\S/.test(l.trimEnd())).map((l) => l.trim());
}
/** Boot it headless and report what the page said while doing so. */
diff --git a/tools/launchers/headless-aot-verify.mjs b/tools/launchers/headless-aot-verify.mjs
index 49294fa10..905d77e99 100644
--- a/tools/launchers/headless-aot-verify.mjs
+++ b/tools/launchers/headless-aot-verify.mjs
@@ -26,6 +26,12 @@ const PACKAGE = path.resolve(process.argv[process.argv.length - 1]);
const W = 256, H = 256;
app.commandLine.appendSwitch('enable-unsafe-swiftshader');
+// The GPU process keeps a sandbox of its own, which ELECTRON_DISABLE_SANDBOX
+// does not reach: on a runner with no device it dies before the first frame.
+app.commandLine.appendSwitch('disable-gpu-sandbox');
+// ...and on Linux there is no GPU process at all — one launch per check races
+// the service that answers for WebGL2, and in-process SwiftShader draws the same.
+if (process.platform === 'linux') app.commandLine.appendSwitch('in-process-gpu');
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';
const MIME = {
diff --git a/tools/launchers/headless-cooked-verify.mjs b/tools/launchers/headless-cooked-verify.mjs
index bd2760db2..5c2eb91f8 100644
--- a/tools/launchers/headless-cooked-verify.mjs
+++ b/tools/launchers/headless-cooked-verify.mjs
@@ -23,6 +23,12 @@ const INTERP = path.join(ROOT, 'pipeline', '.cooked-verify-interp');
const W = 256, H = 256;
app.commandLine.appendSwitch('enable-unsafe-swiftshader');
+// The GPU process keeps a sandbox of its own, which ELECTRON_DISABLE_SANDBOX
+// does not reach: on a runner with no device it dies before the first frame.
+app.commandLine.appendSwitch('disable-gpu-sandbox');
+// ...and on Linux there is no GPU process at all — one launch per check races
+// the service that answers for WebGL2, and in-process SwiftShader draws the same.
+if (process.platform === 'linux') app.commandLine.appendSwitch('in-process-gpu');
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';
const MIME = {
diff --git a/tools/launchers/headless-hotupdate-verify.mjs b/tools/launchers/headless-hotupdate-verify.mjs
index 2912b6c38..5b7fb3933 100644
--- a/tools/launchers/headless-hotupdate-verify.mjs
+++ b/tools/launchers/headless-hotupdate-verify.mjs
@@ -27,6 +27,12 @@ const CDN = path.join(ROOT, 'cdn');
const W = 256, H = 256;
app.commandLine.appendSwitch('enable-unsafe-swiftshader');
+// The GPU process keeps a sandbox of its own, which ELECTRON_DISABLE_SANDBOX
+// does not reach: on a runner with no device it dies before the first frame.
+app.commandLine.appendSwitch('disable-gpu-sandbox');
+// ...and on Linux there is no GPU process at all — one launch per check races
+// the service that answers for WebGL2, and in-process SwiftShader draws the same.
+if (process.platform === 'linux') app.commandLine.appendSwitch('in-process-gpu');
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';
const MIME = {
diff --git a/tools/launchers/launch-export.mjs b/tools/launchers/launch-export.mjs
index 80b5480cb..8d9a3ce19 100644
--- a/tools/launchers/launch-export.mjs
+++ b/tools/launchers/launch-export.mjs
@@ -59,6 +59,12 @@ import { inputScript } from './inputScript.mjs';
// Without it Chromium refuses the context outright and the package boots to
// "WebGL2 is not available" — which is a runner without a GPU, not a broken game.
app.commandLine.appendSwitch('enable-unsafe-swiftshader');
+// The GPU process keeps a sandbox of its own, which ELECTRON_DISABLE_SANDBOX
+// does not reach: on a runner with no device it dies before the first frame.
+app.commandLine.appendSwitch('disable-gpu-sandbox');
+// ...and on Linux there is no GPU process at all — one launch per check races
+// the service that answers for WebGL2, and in-process SwiftShader draws the same.
+if (process.platform === 'linux') app.commandLine.appendSwitch('in-process-gpu');
// capturePage pixels go through the OS display profile; pin sRGB so a colour
// judgement reads the same on a wide-gamut machine as on a CI runner.
app.commandLine.appendSwitch('force-color-profile', 'srgb');
diff --git a/tools/launchers/launch-minigame.mjs b/tools/launchers/launch-minigame.mjs
index 7a3440b9b..2036bd321 100644
--- a/tools/launchers/launch-minigame.mjs
+++ b/tools/launchers/launch-minigame.mjs
@@ -29,6 +29,12 @@ import { inputScript } from './inputScript.mjs';
// Headless / GPU-less (CI) WebGL2 falls back to SwiftShader; harmless with a GPU.
app.commandLine.appendSwitch('enable-unsafe-swiftshader');
+// The GPU process keeps a sandbox of its own, which ELECTRON_DISABLE_SANDBOX
+// does not reach: on a runner with no device it dies before the first frame.
+app.commandLine.appendSwitch('disable-gpu-sandbox');
+// ...and on Linux there is no GPU process at all — one launch per check races
+// the service that answers for WebGL2, and in-process SwiftShader draws the same.
+if (process.platform === 'linux') app.commandLine.appendSwitch('in-process-gpu');
app.commandLine.appendSwitch('force-color-profile', 'srgb');
// Both of the above pin a machine's answer to the code's; so does this. A capture
// is in DEVICE pixels, so a scaled display returns a frame the editor's own
diff --git a/tools/launchers/play-through.mjs b/tools/launchers/play-through.mjs
index 4ad087781..c1f1eacfa 100644
--- a/tools/launchers/play-through.mjs
+++ b/tools/launchers/play-through.mjs
@@ -46,6 +46,12 @@ import { onRendererConsole } from '../lib/rendererConsole.mjs';
// Chromium blocklisted WebGL2, the game drew nothing, and the flagship criterion
// reported that its route could not be played.
app.commandLine.appendSwitch('enable-unsafe-swiftshader');
+// The GPU process keeps a sandbox of its own, which ELECTRON_DISABLE_SANDBOX
+// does not reach: on a runner with no device it dies before the first frame.
+app.commandLine.appendSwitch('disable-gpu-sandbox');
+// ...and on Linux there is no GPU process at all — one launch per check races
+// the service that answers for WebGL2, and in-process SwiftShader draws the same.
+if (process.platform === 'linux') app.commandLine.appendSwitch('in-process-gpu');
app.commandLine.appendSwitch('force-color-profile', 'srgb');
const argv = process.argv.slice(2);
diff --git a/tools/launchers/residency-run.mjs b/tools/launchers/residency-run.mjs
index 23dab23f9..f57b90955 100644
--- a/tools/launchers/residency-run.mjs
+++ b/tools/launchers/residency-run.mjs
@@ -31,6 +31,12 @@ import path from 'node:path';
import { onRendererConsole } from '../lib/rendererConsole.mjs';
app.commandLine.appendSwitch('enable-unsafe-swiftshader');
+// The GPU process keeps a sandbox of its own, which ELECTRON_DISABLE_SANDBOX
+// does not reach: on a runner with no device it dies before the first frame.
+app.commandLine.appendSwitch('disable-gpu-sandbox');
+// ...and on Linux there is no GPU process at all — one launch per check races
+// the service that answers for WebGL2, and in-process SwiftShader draws the same.
+if (process.platform === 'linux') app.commandLine.appendSwitch('in-process-gpu');
app.commandLine.appendSwitch('force-color-profile', 'srgb');
app.commandLine.appendSwitch('force-device-scale-factor', '1');