Skip to content

fix(desktop): break sdk module cycle to restore runtime plugins (fixes #107288) - #109253

Open
Sahilvishnaliya wants to merge 1 commit into
NousResearch:mainfrom
Sahilvishnaliya:fix/107288-desktop-plugin-sdk-tdz-cycle
Open

Sahilvishnaliya wants to merge 1 commit into
NousResearch:mainfrom
Sahilvishnaliya:fix/107288-desktop-plugin-sdk-tdz-cycle

Conversation

@Sahilvishnaliya

Copy link
Copy Markdown
Contributor

Problem

In #107212 (\61afcde8f9), a module cycle was introduced when \�pp/settings/plugins-settings.tsx\ was moved to \�pp/skills/, which is re-exported by \sdk/index.ts.

The cycle:
\sdk/index.ts -> app/skills/index.tsx -> app/skills/plugins-tab.tsx -> contrib/runtime-loader.ts -> sdk/runtime.ts -> sdk/index.ts\

Because of this cycle, Rolldown evaluated \sdk/runtime.ts\ before the _HERMES_PLUGIN_SDK_\ namespace was defined. When
untime-loader.ts:113\ called \installPluginSdk(), \Object.keys(undefined)\ threw \TypeError: Cannot convert undefined or null to object, crashing every single runtime (disk) plugin unconditionally.

Fix

Made \discoverRuntimePlugins\ lazily loaded via dynamic import (\import('@/contrib/runtime-loader').then(...)) in all UI components (\plugins-tab.tsx, \controller.tsx, \plugin-install-modal.tsx). This drops the static import edges, breaking the module cycle entirely so Rolldown can safely order the chunks.

Fixes #107288, #107721, #107352, #107336, #107312, and #107291 (which are all reports of the exact same crash).

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/desktop Electron desktop app (apps/desktop/*) comp/plugins Plugin system and bundled plugins labels Sep 12, 2026

This branch has not been deployed

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

Labels

comp/desktop Electron desktop app (apps/desktop/*) comp/plugins Plugin system and bundled plugins P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: #107212 puts sdk/index.ts in a module cycle — every runtime (disk) desktop plugin fails with "Cannot convert undefined or null to object"

3 participants