From 0620fa908d26f5f55418415f0622a6e413571d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Mon, 25 May 2026 19:17:22 +0000 Subject: [PATCH] fix(engine): use static import for os.totalmem in ESM config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace dynamic require("os") with static import — require is undefined in native ESM, causing the try/catch to silently return the 16GB fallback on every machine. The cache scaling was dead code. --- packages/engine/src/config.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/engine/src/config.ts b/packages/engine/src/config.ts index 84c13dfde0..29296e7dab 100644 --- a/packages/engine/src/config.ts +++ b/packages/engine/src/config.ts @@ -6,6 +6,8 @@ * fallbacks for backward compatibility during migration. */ +import { totalmem } from "os"; + /** * Full engine configuration. All fields are wired through the config * object; env vars serve as backward-compatible fallbacks resolved @@ -209,11 +211,7 @@ export const DEFAULT_CONFIG: EngineConfig = { }; function getSystemTotalMb(): number { - try { - return Math.floor(require("os").totalmem() / (1024 * 1024)); - } catch { - return 16384; - } + return Math.floor(totalmem() / (1024 * 1024)); } function memoryAdaptiveCacheLimit(): number {