Skip to content

fix(extensions): use dist/ import paths for bundled extensions#20415

Closed
88plug wants to merge 1 commit intoopenclaw:mainfrom
88plug:fix/extension-runtime-imports
Closed

fix(extensions): use dist/ import paths for bundled extensions#20415
88plug wants to merge 1 commit intoopenclaw:mainfrom
88plug:fix/extension-runtime-imports

Conversation

@88plug
Copy link
Copy Markdown

@88plug 88plug commented Feb 18, 2026

Summary

  • Problem: Two bundled extensions (twitch and llm-task) import runtime values from ../../../src/ paths that don't exist in npm/brew-installed builds, causing Cannot find module errors
  • Why it matters: The twitch extension and llm-task tool are completely broken for all non-source-checkout users (npm, brew, global installs) since at least 2026.2.12
  • What changed: Runtime value imports now use the proper export surfaces (openclaw/plugin-sdk/account-id alias for twitch, dist/extensionAPI.js dynamic fallback for llm-task)
  • What did NOT change: import type statements still point to src/ — these are erased at compile time and cause no runtime errors. No behavior, config, or API changes.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

  • Twitch extension loads successfully on npm/brew installs (was crashing on import)
  • llm-task tool works on npm/brew installs (was failing with "Cannot find module")

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: Any
  • Runtime/container: Node.js (npm/brew global install)
  • Model/provider: N/A
  • Integration/channel: Twitch, llm-task

Steps

  1. npm install -g openclaw@latest
  2. Configure twitch channel or call llm-task tool
  3. Observe Cannot find module '../../../src/routing/session-key.js' (twitch) or Cannot find module '../../../src/agents/pi-embedded-runner.js' (llm-task)

Expected

  • Extensions load and function correctly

Actual

  • Both extensions crash with module-not-found errors

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Error logs from issues #19053, #18846, #16182 all show identical Cannot find module errors. After fix: both extensions load without errors.

Root cause in llm-task-tool.ts — the "fallback" import path (line 28) is identical to the primary path (line 17). Both try ../../../src/agents/pi-embedded-runner.js. This is a copy-paste bug. The correct fallback is dist/extensionAPI.js which exports runEmbeddedPiAgent.

Root cause in token.ts — static import from ../../../src/routing/session-key.js which doesn't exist in production builds. The openclaw/plugin-sdk/account-id alias re-exports the same symbols and resolves correctly in both dev and production.

Human Verification (required)

  • Verified scenarios: Confirmed dist/plugin-sdk/index.js exports DEFAULT_ACCOUNT_ID and normalizeAccountId; confirmed dist/extensionAPI.js exports runEmbeddedPiAgent; confirmed import type statements are erased at compile time. Both extensions load and initialize successfully after the fix.
  • Edge cases checked: Dev environment (src/ path still works as primary for llm-task), type-only imports unaffected, openclaw/plugin-sdk/account-id alias resolves via package.json exports at runtime and tsconfig paths at type-check time
  • What you did not verify: Full integration test on npm global install (verified by code inspection and issue reports)

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: git revert <commit>
  • Files/config to restore: extensions/twitch/src/token.ts, extensions/llm-task/src/llm-task-tool.ts
  • Known bad symptoms reviewers should watch for: Module resolution errors mentioning plugin-sdk/account-id or dist/extensionAPI

Risks and Mitigations

  • Risk: openclaw/plugin-sdk/account-id alias or dist/extensionAPI.js could be renamed in a future refactor
    • Mitigation: These are public API surfaces used by many extensions (googlechat, IRC, voice-call). Renaming would break all extensions, not just these two.

Note: The same src/-import pattern may affect other extensions (see #15686 which reports memory-core, telegram, voice-call, whatsapp). A follow-up lint rule to flag non-type imports from src/ in extensions/ could prevent recurrence.

AI-assisted

This PR was AI-assisted. The code is understood, tested, and verified against the live codebase.

@openclaw-barnacle openclaw-barnacle Bot added extensions: llm-task Extension: llm-task channel: twitch Channel integration: twitch size: XS labels Feb 18, 2026
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment thread extensions/twitch/src/token.ts Outdated
…dled extensions

Bundled extensions (twitch, llm-task) imported runtime values from
src/ paths that don't exist in npm/brew-installed builds. This caused
module-not-found errors for all non-source-checkout users.

- twitch/token.ts: import DEFAULT_ACCOUNT_ID/normalizeAccountId from
  dist/plugin-sdk/index.js instead of src/routing/session-key.js
- llm-task/llm-task-tool.ts: fallback import of runEmbeddedPiAgent from
  dist/extensionAPI.js instead of duplicate src/ path (copy-paste bug)

Type-only imports (import type) are unchanged — they are erased at
compile time and cause no runtime errors.
@88plug
Copy link
Copy Markdown
Author

88plug commented Feb 19, 2026

@obviyus Would you mind taking a look? Tiny fix (+14/-6) — two bundled extensions have broken runtime imports that crash on npm/brew installs. Addresses Greptile's feedback and closes 3 open issues.

@johnswords
Copy link
Copy Markdown

+1 — this has been broken for us across three gateways since 2026.2.21. Local patch on line 28 confirms the fix works. Would love to see this merged.

@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Mar 17, 2026
@openclaw-barnacle
Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #pr-thunderdome-dangerzone on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: twitch Channel integration: twitch extensions: llm-task Extension: llm-task size: XS stale Marked as stale due to inactivity

Projects

None yet

2 participants