From 61ac4ec8a0dbe8605aee36120862d7486d557cbf Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 5 Jul 2026 07:08:42 -0700 Subject: [PATCH] fix(plugins): keep openclaw chunks native in jiti (#88384) * fix(plugins): keep OpenClaw chunks native in jiti Co-authored-by: Vincent Koc * docs(changelog): move plugin fix to unreleased --------- Co-authored-by: Peter Steinberger --- CHANGELOG.md | 1 + src/plugins/sdk-alias.test.ts | 1 + src/plugins/sdk-alias.ts | 3 +++ 3 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e1f188c4407..eb9d4e2efa84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Docs: https://docs.openclaw.ai - **WhatsApp restart recovery:** stop automatic restart loops after logged-out or connection-replaced disconnects until the account reconnects. (#78511) Thanks @openperf. - **Local Gateway CLI auth:** keep loopback CLI token/password calls off durable device scopes so read probes cannot block later write/admin commands behind a stale pairing baseline. (#95997) Thanks @vincentkoc. +- **Plugin module identity:** keep OpenClaw package chunks on Node's native module graph when jiti transforms plugin entries, preventing duplicate evaluation and class identity drift. (#88384) Thanks @vincentkoc. - **iMessage group warnings:** suppress the false drop-all startup warning when an effective group sender allowlist can admit groups, and point true empty-allowlist configurations at the correct remedy. (#100046) - **Control UI mobile login:** keep Gateway recovery guidance visible after connection failures, make the disconnected gate scroll safely on constrained screens, and improve mobile keyboard and tap-target behavior. (#100208) diff --git a/src/plugins/sdk-alias.test.ts b/src/plugins/sdk-alias.test.ts index d686689f5bc5..a4861461d099 100644 --- a/src/plugins/sdk-alias.test.ts +++ b/src/plugins/sdk-alias.test.ts @@ -2034,6 +2034,7 @@ describe("plugin sdk alias helpers", () => { const options = buildPluginLoaderJitiOptions({}); expect(options.tryNative).toBe(true); + expect(options.nativeModules).toEqual(["openclaw"]); expect(options.interopDefault).toBe(true); expect(options.extensions).toContain(".js"); expect(options.extensions).toContain(".ts"); diff --git a/src/plugins/sdk-alias.ts b/src/plugins/sdk-alias.ts index ddced1d9dfa9..2e6a6b2466ba 100644 --- a/src/plugins/sdk-alias.ts +++ b/src/plugins/sdk-alias.ts @@ -2031,6 +2031,9 @@ export function buildPluginLoaderJitiOptions( // Prefer Node's native sync ESM loader for built dist/*.js modules so // bundled plugins and plugin-sdk subpaths stay on the canonical module graph. tryNative: true, + // When jiti must transform a plugin entry, keep OpenClaw's own package + // chunks on the native module graph instead of re-evaluating them in jiti. + nativeModules: ["openclaw"], extensions: [".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".js", ".mjs", ".cjs", ".json"], ...(hasAliases ? {