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 on-device crash check builds for the ABI the device reports

esenginec0cf93815906
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fdebb1262..56e208d92 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,8 @@ published separately; it ships inside the editor.
### Fixed
+- **The on-device crash check runs on whatever Android you have.** It built its test handler for arm64 no matter what was attached, so an emulator — the only Android most machines can offer — was pushed a binary it cannot execute and the check failed for a reason that had nothing to do with the crash handler. It asks the device which ABI it runs now, which is why a release criterion that read "needs a phone plugged in" is answered here: the record came back with its phase and a backtrace.
+
- **A packaged native game gets the subsystems its project uses.** Every optional subsystem reaches an App through one registry, and the native factory read none of it — it named Spine and DragonBones by hand and stopped there. So a game on a phone ran with no navigation, no tilemaps and no replication while the same game worked on the web: `enemy-ai` threw on a null nav surface, `celestial-heights` refused its own tilemap data, and `multiplayer-arena` threw on a null net role. Found by booting all 52 examples on an emulator.
- **Nothing claims a model cannot see when nobody has said so.** Attaching a picture to a model whose sight is unconfirmed said "this endpoint does not accept images", and the turn itself told the agent it "cannot carry images" — both of which read as the vendor having answered. They now say what is true of the turn: no image is being sent. The attachment notice keeps the two apart, because a vendor saying no is a reason to pick another model and nobody having said is a reason to go and find out.
diff --git a/pipeline/tests/native-template.test.ts b/pipeline/tests/native-template.test.ts
index 39072527d..ea13f3a0a 100644
--- a/pipeline/tests/native-template.test.ts
+++ b/pipeline/tests/native-template.test.ts
@@ -423,3 +423,34 @@ describe('the platforms templates are published for', () => {
}
});
});
+
+/**
+ * The crash-record check builds for the device it found.
+ *
+ * It named one ABI, so an x86_64 emulator — the only Android most machines can
+ * offer — was pushed a binary it cannot execute, and a release criterion that
+ * an emulator CAN answer read as "needs a phone plugged in".
+ */
+describe('the on-device crash record check', () => {
+ const src = readFileSync(path.resolve(__dirname, '../../tools/verify-bootlog-crash.mjs'), 'utf8');
+
+ it('has an NDK driver for every ABI an Android device reports', () => {
+ // The TRIPLE, not the ABI name: `x86_64` also appears in the host-platform
+ // ternary, so looking for the key matched a line that compiles nothing.
+ const triples = {
+ 'arm64-v8a': 'aarch64-linux-android',
+ 'armeabi-v7a': 'armv7a-linux-androideabi',
+ x86_64: 'x86_64-linux-android',
+ x86: 'i686-linux-android',
+ };
+ const missing = Object.entries(triples)
+ .filter(([, triple]) => !src.includes(`'${triple}'`))
+ .map(([abi]) => abi);
+ expect(missing, 'a device reporting one of these gets no compiler').toEqual([]);
+ });
+
+ it('asks the device rather than assuming a phone', () => {
+ expect(src).toContain('ro.product.cpu.abi');
+ expect(src, 'the driver is still pinned to one ABI').not.toMatch(/aarch64-linux-android33-clang/);
+ });
+});
diff --git a/tools/releaseGate.mjs b/tools/releaseGate.mjs
index 6b8b662cc..2bb917097 100644
--- a/tools/releaseGate.mjs
+++ b/tools/releaseGate.mjs
@@ -200,7 +200,7 @@ export const CRITERIA = [
{
id: 'a-crash-leaves-something-the-player-can-send',
host: 'device',
- why: '--require-device reads `adb devices` on the machine it runs on, and the Device Farm path uploads a bundle rather than attaching one — so no runner here can answer it; a release captain with a phone plugged in and `pnpm run gate:run --host device` can',
+ why: '--require-device reads `adb devices` on the machine it runs on, and the Device Farm path uploads a bundle rather than attaching one — so no runner here can answer it. An EMULATOR answers it too, measured: the handler builds for whatever ABI the device reports, faults, and the record comes back with its phase and a backtrace',
says: 'the boot record survives a crash on a real device, with the phase and a backtrace',
// `--require-device` on purpose: without it the tool skips where there is no
// phone, which is right on a laptop and is a false pass under a release.
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index d91c989c3..5c07f8ce3 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -704,6 +704,8 @@ export const NOTED = {
{ note: "The build says what the start screen's logo costs the page." },
'feat(agent): a person can record which models their account has seen take an image':
{ note: 'You can tell the editor which models your account has seen take an image.' },
+ 'fix(gates): the on-device crash check builds for the ABI the device reports':
+ { note: 'The on-device crash check runs on whatever Android you have.' },
'fix(native): every App factory installs the optional subsystems from the registry':
{ note: 'A packaged native game gets the subsystems its project uses.' },
'fix(agent): nothing claims a model cannot see when nobody has said so':
diff --git a/tools/verify-bootlog-crash.mjs b/tools/verify-bootlog-crash.mjs
index 3f6ea9860..665c5452a 100644
--- a/tools/verify-bootlog-crash.mjs
+++ b/tools/verify-bootlog-crash.mjs
@@ -1,17 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
-//
-// Prove the boot record survives a crash, on a device.
-//
-// The record exists so that a game that dies on someone else's phone leaves
-// something they can send. That claim is only worth making if the handler has
-// been watched doing it: this builds the real BootLog.cpp for arm64 with the
-// NDK, pushes it, faults on purpose, and reads the file back.
-//
-// node tools/verify-bootlog-crash.mjs (needs an adb device + NDK)
-//
-// Skips with a message when there is no device or no NDK, so it can be run
-// anywhere without pretending to have checked something it did not.
+/**
+ * @file The boot record survives a crash, watched doing it on a device.
+ *
+ * Builds the real BootLog.cpp with the NDK for the ABI the device reports,
+ * pushes it, faults on purpose, and reads the file back. Skips (not passes)
+ * without a device or an NDK: `node tools/verify-bootlog-crash.mjs`.
+ */
import { execFileSync } from 'node:child_process';
import { existsSync, mkdirSync, readdirSync } from 'node:fs';
@@ -33,7 +28,27 @@ function adbPath() {
return existsSync(inSdk) ? inSdk : exe;
}
-function ndkClang() {
+/** The NDK driver for what the DEVICE runs. An x86_64 emulator — the only
+ * Android most machines can offer — cannot execute an arm64 binary, and would
+ * fail for a reason that has nothing to do with the handler. */
+const NDK_TRIPLE = {
+ 'arm64-v8a': 'aarch64-linux-android',
+ 'armeabi-v7a': 'armv7a-linux-androideabi',
+ x86_64: 'x86_64-linux-android',
+ x86: 'i686-linux-android',
+};
+
+function deviceAbi(adb) {
+ try {
+ return execFileSync(adb, ['shell', 'getprop', 'ro.product.cpu.abi'], { encoding: 'utf8' }).trim();
+ } catch {
+ return '';
+ }
+}
+
+function ndkClang(abi) {
+ const triple = NDK_TRIPLE[abi];
+ if (!triple) return null;
const ndkRoot = process.env.ANDROID_NDK_HOME
|| (() => {
const dir = path.join(sdkRoot(), 'ndk');
@@ -45,7 +60,7 @@ function ndkClang() {
const host = process.platform === 'win32' ? 'windows-x86_64'
: process.platform === 'darwin' ? 'darwin-x86_64' : 'linux-x86_64';
const exe = process.platform === 'win32' ? '.cmd' : '';
- const clang = path.join(ndkRoot, 'toolchains', 'llvm', 'prebuilt', host, 'bin', `aarch64-linux-android33-clang++${exe}`);
+ const clang = path.join(ndkRoot, 'toolchains', 'llvm', 'prebuilt', host, 'bin', `${triple}33-clang++${exe}`);
return existsSync(clang) ? clang : null;
}
@@ -77,13 +92,14 @@ function unavailable(why) {
}
const adb = adbPath();
-const clang = ndkClang();
-if (!clang) unavailable('no Android NDK found');
if (!device(adb)) unavailable('no adb device attached');
+const abi = deviceAbi(adb);
+const clang = ndkClang(abi);
+if (!clang) unavailable(abi ? `no Android NDK for ${abi}` : 'no Android NDK found');
mkdirSync(OUT, { recursive: true });
const bin = path.join(OUT, 'bootlog_crash_test');
-console.log('building the record + handler for arm64…');
+console.log(`building the record + handler for ${abi}…`);
// `shell: true` because the NDK's Windows driver is a .cmd, which node refuses
// to spawn directly (EINVAL) — the same reason every Windows toolchain wrapper
// has to be invoked through a shell.