fix(line): pre-export clashing symbols to prevent jiti TypeError on startup#53221
Conversation
Greptile SummaryThis PR fixes a startup crash ( The fix pre-exports all 15 conflicting value symbols as named exports before the
Confidence Score: 5/5
Reviews (1): Last reviewed commit: "fix(line): pre-export clashing symbols t..." | Re-trigger Greptile |
17f23bf to
afeeae6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: afeeae6b12
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
extensions/line/index.test.ts
Outdated
| const jiti = createJiti(import.meta.url, { | ||
| fsCache: false, | ||
| moduleCache: false, | ||
| tryNative: false, | ||
| }); |
There was a problem hiding this comment.
Configure Jiti aliases in LINE runtime-api load test
This test instantiates Jiti without the plugin-sdk alias map, so openclaw/plugin-sdk/* resolves to extensions/line/node_modules/openclaw/dist/... by default. In a clean checkout (for example pnpm test:extensions/pnpm test:extension where dist/ is not prebuilt), that path is missing and the test fails with Cannot find module .../dist/plugin-sdk/core.js, which makes the new regression test fail even when runtime-api behavior is correct. Mirror the Matrix test pattern by passing buildPluginLoaderJitiOptions(resolvePluginSdkScopedAliasMap(...)).
Useful? React with 👍 / 👎.
…tartup When jiti CJS-transforms extensions/line/runtime-api.ts, both export * from "openclaw/plugin-sdk/line-runtime" and the subsequent export * from individual source files attempt to define the same 13 symbols via Object.defineProperty with configurable:false. The second call throws TypeError: Cannot redefine property. The root cause is that src/plugin-sdk/line-runtime.ts re-exports these symbols directly from the extension source files, creating a circular path back to the same files that runtime-api.ts star-exports. Fix: add named pre-exports for all symbols that plugin-sdk/line-runtime re-exports from this extension. Named exports register in jiti's _exportNames map at transform time; the star re-export's hasOwnProperty guard then skips them, preventing the duplicate Object.defineProperty. export * reordering cannot fix this: _exportNames is only populated by named exports, not by export *, so the guard never fires regardless of order. This is the same class of bug as the Matrix plugin crash described in issues openclaw#50868, openclaw#52780, and openclaw#52891, and uses the same fix pattern as PR openclaw#50919.
fbaa85e to
7ea8175
Compare
|
Landed via temp rebase onto main.
Thanks @Drickon! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ea81758da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const alias = Object.fromEntries( | ||
| ${JSON.stringify(pluginSdkSubpaths)}.map((name) => [ | ||
| "openclaw/plugin-sdk/" + name, | ||
| path.join(root, "dist", "plugin-sdk", name + ".js"), |
There was a problem hiding this comment.
Use source-aware plugin SDK aliasing in Jiti load test
The test aliases openclaw/plugin-sdk/* to dist/plugin-sdk/*.js, which makes it depend on a prebuilt dist/ tree that is not present in a clean source test run. Fresh evidence: running pnpm test -- extensions/line/index.test.ts -t "loads through Jiti without duplicate export errors" on this commit fails with Cannot find module '/workspace/openclaw/dist/plugin-sdk/core.js', so the new regression test fails before it can validate the duplicate-export fix. Please switch this test to the same source-aware alias setup used elsewhere (for example via buildPluginLoaderJitiOptions(resolvePluginSdkScopedAliasMap(...))).
Useful? React with 👍 / 👎.
…tartup (openclaw#53221) * fix(line): pre-export clashing symbols to prevent jiti TypeError on startup When jiti CJS-transforms extensions/line/runtime-api.ts, both export * from "openclaw/plugin-sdk/line-runtime" and the subsequent export * from individual source files attempt to define the same 13 symbols via Object.defineProperty with configurable:false. The second call throws TypeError: Cannot redefine property. The root cause is that src/plugin-sdk/line-runtime.ts re-exports these symbols directly from the extension source files, creating a circular path back to the same files that runtime-api.ts star-exports. Fix: add named pre-exports for all symbols that plugin-sdk/line-runtime re-exports from this extension. Named exports register in jiti's _exportNames map at transform time; the star re-export's hasOwnProperty guard then skips them, preventing the duplicate Object.defineProperty. export * reordering cannot fix this: _exportNames is only populated by named exports, not by export *, so the guard never fires regardless of order. This is the same class of bug as the Matrix plugin crash described in issues openclaw#50868, openclaw#52780, and openclaw#52891, and uses the same fix pattern as PR openclaw#50919. * test: add LINE runtime-api Jiti regression (openclaw#53221) (thanks @Drickon) * test: stabilize LINE Jiti regression (openclaw#53221) (thanks @Drickon) * test: harden LINE Jiti regression (openclaw#53221) (thanks @Drickon) * chore: retrigger PR checks (openclaw#53221) --------- Co-authored-by: Peter Steinberger <[email protected]>
…tartup (openclaw#53221) * fix(line): pre-export clashing symbols to prevent jiti TypeError on startup When jiti CJS-transforms extensions/line/runtime-api.ts, both export * from "openclaw/plugin-sdk/line-runtime" and the subsequent export * from individual source files attempt to define the same 13 symbols via Object.defineProperty with configurable:false. The second call throws TypeError: Cannot redefine property. The root cause is that src/plugin-sdk/line-runtime.ts re-exports these symbols directly from the extension source files, creating a circular path back to the same files that runtime-api.ts star-exports. Fix: add named pre-exports for all symbols that plugin-sdk/line-runtime re-exports from this extension. Named exports register in jiti's _exportNames map at transform time; the star re-export's hasOwnProperty guard then skips them, preventing the duplicate Object.defineProperty. export * reordering cannot fix this: _exportNames is only populated by named exports, not by export *, so the guard never fires regardless of order. This is the same class of bug as the Matrix plugin crash described in issues openclaw#50868, openclaw#52780, and openclaw#52891, and uses the same fix pattern as PR openclaw#50919. * test: add LINE runtime-api Jiti regression (openclaw#53221) (thanks @Drickon) * test: stabilize LINE Jiti regression (openclaw#53221) (thanks @Drickon) * test: harden LINE Jiti regression (openclaw#53221) (thanks @Drickon) * chore: retrigger PR checks (openclaw#53221) --------- Co-authored-by: Peter Steinberger <[email protected]>
…tartup (openclaw#53221) * fix(line): pre-export clashing symbols to prevent jiti TypeError on startup When jiti CJS-transforms extensions/line/runtime-api.ts, both export * from "openclaw/plugin-sdk/line-runtime" and the subsequent export * from individual source files attempt to define the same 13 symbols via Object.defineProperty with configurable:false. The second call throws TypeError: Cannot redefine property. The root cause is that src/plugin-sdk/line-runtime.ts re-exports these symbols directly from the extension source files, creating a circular path back to the same files that runtime-api.ts star-exports. Fix: add named pre-exports for all symbols that plugin-sdk/line-runtime re-exports from this extension. Named exports register in jiti's _exportNames map at transform time; the star re-export's hasOwnProperty guard then skips them, preventing the duplicate Object.defineProperty. export * reordering cannot fix this: _exportNames is only populated by named exports, not by export *, so the guard never fires regardless of order. This is the same class of bug as the Matrix plugin crash described in issues openclaw#50868, openclaw#52780, and openclaw#52891, and uses the same fix pattern as PR openclaw#50919. * test: add LINE runtime-api Jiti regression (openclaw#53221) (thanks @Drickon) * test: stabilize LINE Jiti regression (openclaw#53221) (thanks @Drickon) * test: harden LINE Jiti regression (openclaw#53221) (thanks @Drickon) * chore: retrigger PR checks (openclaw#53221) --------- Co-authored-by: Peter Steinberger <[email protected]>
…tartup (openclaw#53221) * fix(line): pre-export clashing symbols to prevent jiti TypeError on startup When jiti CJS-transforms extensions/line/runtime-api.ts, both export * from "openclaw/plugin-sdk/line-runtime" and the subsequent export * from individual source files attempt to define the same 13 symbols via Object.defineProperty with configurable:false. The second call throws TypeError: Cannot redefine property. The root cause is that src/plugin-sdk/line-runtime.ts re-exports these symbols directly from the extension source files, creating a circular path back to the same files that runtime-api.ts star-exports. Fix: add named pre-exports for all symbols that plugin-sdk/line-runtime re-exports from this extension. Named exports register in jiti's _exportNames map at transform time; the star re-export's hasOwnProperty guard then skips them, preventing the duplicate Object.defineProperty. export * reordering cannot fix this: _exportNames is only populated by named exports, not by export *, so the guard never fires regardless of order. This is the same class of bug as the Matrix plugin crash described in issues openclaw#50868, openclaw#52780, and openclaw#52891, and uses the same fix pattern as PR openclaw#50919. * test: add LINE runtime-api Jiti regression (openclaw#53221) (thanks @Drickon) * test: stabilize LINE Jiti regression (openclaw#53221) (thanks @Drickon) * test: harden LINE Jiti regression (openclaw#53221) (thanks @Drickon) * chore: retrigger PR checks (openclaw#53221) --------- Co-authored-by: Peter Steinberger <[email protected]>
…tartup (openclaw#53221) * fix(line): pre-export clashing symbols to prevent jiti TypeError on startup When jiti CJS-transforms extensions/line/runtime-api.ts, both export * from "openclaw/plugin-sdk/line-runtime" and the subsequent export * from individual source files attempt to define the same 13 symbols via Object.defineProperty with configurable:false. The second call throws TypeError: Cannot redefine property. The root cause is that src/plugin-sdk/line-runtime.ts re-exports these symbols directly from the extension source files, creating a circular path back to the same files that runtime-api.ts star-exports. Fix: add named pre-exports for all symbols that plugin-sdk/line-runtime re-exports from this extension. Named exports register in jiti's _exportNames map at transform time; the star re-export's hasOwnProperty guard then skips them, preventing the duplicate Object.defineProperty. export * reordering cannot fix this: _exportNames is only populated by named exports, not by export *, so the guard never fires regardless of order. This is the same class of bug as the Matrix plugin crash described in issues openclaw#50868, openclaw#52780, and openclaw#52891, and uses the same fix pattern as PR openclaw#50919. * test: add LINE runtime-api Jiti regression (openclaw#53221) (thanks @Drickon) * test: stabilize LINE Jiti regression (openclaw#53221) (thanks @Drickon) * test: harden LINE Jiti regression (openclaw#53221) (thanks @Drickon) * chore: retrigger PR checks (openclaw#53221) --------- Co-authored-by: Peter Steinberger <[email protected]>
…tartup (openclaw#53221) * fix(line): pre-export clashing symbols to prevent jiti TypeError on startup When jiti CJS-transforms extensions/line/runtime-api.ts, both export * from "openclaw/plugin-sdk/line-runtime" and the subsequent export * from individual source files attempt to define the same 13 symbols via Object.defineProperty with configurable:false. The second call throws TypeError: Cannot redefine property. The root cause is that src/plugin-sdk/line-runtime.ts re-exports these symbols directly from the extension source files, creating a circular path back to the same files that runtime-api.ts star-exports. Fix: add named pre-exports for all symbols that plugin-sdk/line-runtime re-exports from this extension. Named exports register in jiti's _exportNames map at transform time; the star re-export's hasOwnProperty guard then skips them, preventing the duplicate Object.defineProperty. export * reordering cannot fix this: _exportNames is only populated by named exports, not by export *, so the guard never fires regardless of order. This is the same class of bug as the Matrix plugin crash described in issues openclaw#50868, openclaw#52780, and openclaw#52891, and uses the same fix pattern as PR openclaw#50919. * test: add LINE runtime-api Jiti regression (openclaw#53221) (thanks @Drickon) * test: stabilize LINE Jiti regression (openclaw#53221) (thanks @Drickon) * test: harden LINE Jiti regression (openclaw#53221) (thanks @Drickon) * chore: retrigger PR checks (openclaw#53221) --------- Co-authored-by: Peter Steinberger <[email protected]>
…tartup (openclaw#53221) * fix(line): pre-export clashing symbols to prevent jiti TypeError on startup When jiti CJS-transforms extensions/line/runtime-api.ts, both export * from "openclaw/plugin-sdk/line-runtime" and the subsequent export * from individual source files attempt to define the same 13 symbols via Object.defineProperty with configurable:false. The second call throws TypeError: Cannot redefine property. The root cause is that src/plugin-sdk/line-runtime.ts re-exports these symbols directly from the extension source files, creating a circular path back to the same files that runtime-api.ts star-exports. Fix: add named pre-exports for all symbols that plugin-sdk/line-runtime re-exports from this extension. Named exports register in jiti's _exportNames map at transform time; the star re-export's hasOwnProperty guard then skips them, preventing the duplicate Object.defineProperty. export * reordering cannot fix this: _exportNames is only populated by named exports, not by export *, so the guard never fires regardless of order. This is the same class of bug as the Matrix plugin crash described in issues openclaw#50868, openclaw#52780, and openclaw#52891, and uses the same fix pattern as PR openclaw#50919. * test: add LINE runtime-api Jiti regression (openclaw#53221) (thanks @Drickon) * test: stabilize LINE Jiti regression (openclaw#53221) (thanks @Drickon) * test: harden LINE Jiti regression (openclaw#53221) (thanks @Drickon) * chore: retrigger PR checks (openclaw#53221) --------- Co-authored-by: Peter Steinberger <[email protected]>
Problem
extensions/line/runtime-api.tscrashes on startup with:Root cause
src/plugin-sdk/line-runtime.tsre-exports 15 symbols directly from thisextension's source files (bot-access, download, probe, send, template-messages).
runtime-api.tsalso star-exports those same source files. When jitiCJS-transforms the barrel, both star-exports call
Object.definePropertyfor the same property with
configurable: false. The second call throws.Why reordering
export *does not fix itjiti's
_exportNamesdedup guard only fires for symbols registered bynamed exports.
export *never populates_exportNames, so the guardnever fires regardless of which star-export comes first.
Fix
Named pre-exports for all 15 symbols that
line-runtime.tsre-exportsfrom this extension. Named exports register in
_exportNamesat ASTtransform time; the
export * from "openclaw/plugin-sdk/line-runtime"star-export then skips them via the
hasOwnPropertyguard.A comment in the file cross-references
src/plugin-sdk/line-runtime.tsas the authoritative list, so future additions stay in sync.
Related
Same root cause as #50868, #52780, #52891. Same fix pattern as #50919
(which correctly diagnosed the mechanism for Matrix). The Matrix barrel
has since been updated on
main; this applies the complete fix to LINE.