Skip to content

fix(line): pre-export clashing symbols to prevent jiti TypeError on startup#53221

Merged
steipete merged 5 commits intoopenclaw:mainfrom
Drickon:fix/jiti-cjs-extension-barrel-exports
Mar 24, 2026
Merged

fix(line): pre-export clashing symbols to prevent jiti TypeError on startup#53221
steipete merged 5 commits intoopenclaw:mainfrom
Drickon:fix/jiti-cjs-extension-barrel-exports

Conversation

@Drickon
Copy link
Copy Markdown
Contributor

@Drickon Drickon commented Mar 23, 2026

Problem

extensions/line/runtime-api.ts crashes on startup with:

TypeError: Cannot redefine property: isSenderAllowed

Root cause

src/plugin-sdk/line-runtime.ts re-exports 15 symbols directly from this
extension's source files (bot-access, download, probe, send, template-messages).
runtime-api.ts also star-exports those same source files. When jiti
CJS-transforms the barrel, both star-exports call Object.defineProperty
for the same property with configurable: false. The second call throws.

Why reordering export * does not fix it

jiti's _exportNames dedup guard only fires for symbols registered by
named exports. export * never populates _exportNames, so the guard
never fires regardless of which star-export comes first.

Fix

Named pre-exports for all 15 symbols that line-runtime.ts re-exports
from this extension. Named exports register in _exportNames at AST
transform time; the export * from "openclaw/plugin-sdk/line-runtime"
star-export then skips them via the hasOwnProperty guard.

A comment in the file cross-references src/plugin-sdk/line-runtime.ts
as 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.

@openclaw-barnacle openclaw-barnacle bot added channel: line Channel integration: line size: XS labels Mar 23, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 23, 2026

Greptile Summary

This PR fixes a startup crash (TypeError: Cannot redefine property: isSenderAllowed) in extensions/line/runtime-api.ts caused by jiti's CJS transform attempting to call Object.defineProperty twice — with configurable:false — for symbols that are re-exported by both the export * from "openclaw/plugin-sdk/line-runtime" barrel and the direct export * statements in the same file.

The fix pre-exports all 15 conflicting value symbols as named exports before the line-runtime star-export. Named exports register the symbols in jiti's _exportNames map at transform time; the subsequent star-export skips any already-registered name via its hasOwnProperty guard, eliminating the double-define error.

  • The pre-export list is complete: all value exports from bot-access.ts (4 symbols), download.ts (1), probe.ts (1), template-messages.ts (1), and send.ts (8) are covered.
  • The inline comment accurately describes the jiti mechanism and cross-references src/plugin-sdk/line-runtime.ts as the authoritative list for future maintenance.
  • The PR description mentions "13 symbols" but the implementation correctly pre-exports 15 — a minor inaccuracy in the description only, with no impact on correctness.

Confidence Score: 5/5

  • This PR is safe to merge — it applies a well-understood, targeted fix with complete symbol coverage and no behavioural changes.
  • The fix is mechanically sound and provably complete: every value symbol that src/plugin-sdk/line-runtime.ts re-exports from extension source files is now pre-exported by name in runtime-api.ts, covering all 15 conflicting symbols across all five source files involved. The approach is identical to the already-merged Matrix fix (fix: resolve duplicate property definition in Matrix plugin #50919). No logic is changed — only the export ordering mechanism is corrected. The explanatory comment aids future maintenance.
  • No files require special attention.

Reviews (1): Last reviewed commit: "fix(line): pre-export clashing symbols t..." | Re-trigger Greptile

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +8 to +12
const jiti = createJiti(import.meta.url, {
fsCache: false,
moduleCache: false,
tryNative: false,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

steipete added a commit to Drickon/openclaw that referenced this pull request Mar 24, 2026
steipete added a commit to Drickon/openclaw that referenced this pull request Mar 24, 2026
steipete added a commit to Drickon/openclaw that referenced this pull request Mar 24, 2026
Drickon and others added 5 commits March 23, 2026 19:11
…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.
@steipete steipete force-pushed the fix/jiti-cjs-extension-barrel-exports branch from fbaa85e to 7ea8175 Compare March 24, 2026 02:13
@steipete steipete merged commit 715b135 into openclaw:main Mar 24, 2026
8 checks passed
@steipete
Copy link
Copy Markdown
Contributor

steipete commented Mar 24, 2026

Landed via temp rebase onto main.

  • Gate: pnpm check; pnpm test -- extensions/line/index.test.ts; pnpm test:extension line
  • PR head: Drickon@7ea8175
  • Merge commit: 715b135
  • Note: GitHub did not re-enqueue the pull_request workflows after the final force-pushes, so the post-rebase local gates above were used before the admin squash merge.

Thanks @Drickon!

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

yujuntea pushed a commit to yujuntea/openclaw that referenced this pull request Mar 24, 2026
…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]>
hzq001 pushed a commit to hzq001/openclaw that referenced this pull request Mar 24, 2026
…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]>
furaul pushed a commit to furaul/openclaw that referenced this pull request Mar 24, 2026
…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]>
tiagonix pushed a commit to tiagonix/openclaw that referenced this pull request Mar 24, 2026
…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]>
netandreus pushed a commit to netandreus/openclaw that referenced this pull request Mar 25, 2026
…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]>
npmisantosh pushed a commit to npmisantosh/openclaw that referenced this pull request Mar 25, 2026
…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]>
godlin-gh pushed a commit to YouMindInc/openclaw that referenced this pull request Mar 27, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: line Channel integration: line size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants