From 9486f6e37934875acf0ef72eed8f7c1c26114826 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Thu, 19 Mar 2026 16:07:39 -0700 Subject: [PATCH] fix(build): suppress singleton smoke deprecation noise --- scripts/test-built-plugin-singleton.mjs | 35 +++++++++++++++++++++++++ src/agents/context.ts | 7 +++++ 2 files changed, 42 insertions(+) diff --git a/scripts/test-built-plugin-singleton.mjs b/scripts/test-built-plugin-singleton.mjs index 04e11c5f900..070f3b4341d 100644 --- a/scripts/test-built-plugin-singleton.mjs +++ b/scripts/test-built-plugin-singleton.mjs @@ -5,6 +5,41 @@ import path from "node:path"; import { fileURLToPath, pathToFileURL } from "node:url"; import { stageBundledPluginRuntime } from "./stage-bundled-plugin-runtime.mjs"; +const warningFilterKey = Symbol.for("openclaw.warning-filter"); + +function installProcessWarningFilter() { + if (globalThis[warningFilterKey]?.installed) { + return; + } + + const originalEmitWarning = process.emitWarning.bind(process); + process.emitWarning = (...args) => { + const [warningArg, secondArg, thirdArg] = args; + const warning = + warningArg instanceof Error + ? { + name: warningArg.name, + message: warningArg.message, + code: warningArg.code, + } + : { + name: typeof secondArg === "string" ? secondArg : secondArg?.type, + message: typeof warningArg === "string" ? warningArg : undefined, + code: typeof thirdArg === "string" ? thirdArg : secondArg?.code, + }; + + if (warning.code === "DEP0040" && warning.message?.includes("punycode")) { + return; + } + + return Reflect.apply(originalEmitWarning, process, args); + }; + + globalThis[warningFilterKey] = { installed: true }; +} + +installProcessWarningFilter(); + const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); const smokeEntryPath = path.join(repoRoot, "dist", "plugins", "build-smoke-entry.js"); assert.ok(fs.existsSync(smokeEntryPath), `missing build output: ${smokeEntryPath}`); diff --git a/src/agents/context.ts b/src/agents/context.ts index 279433f0c76..841432e873e 100644 --- a/src/agents/context.ts +++ b/src/agents/context.ts @@ -140,6 +140,13 @@ const SKIP_EAGER_WARMUP_PRIMARY_COMMANDS = new Set([ ]); function shouldEagerWarmContextWindowCache(argv: string[] = process.argv): boolean { + // Keep this gate tied to the real OpenClaw CLI entrypoints. + // + // This module can also land inside shared dist chunks that are imported from + // plugin-sdk/library surfaces during smoke tests and plugin loading. If we do + // eager warmup for those generic Node script imports, merely importing the + // built plugin-sdk can call ensureOpenClawModelsJson(), which cascades into + // plugin discovery and breaks dist/source singleton assumptions. if (!isLikelyOpenClawCliProcess(argv)) { return false; }