fix(desktop): break sdk module cycle to restore runtime plugins (fixes #107288) - #109253
Open
Sahilvishnaliya wants to merge 1 commit into
Open
Sahilvishnaliya wants to merge 1 commit into
Sahilvishnaliya wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).