fix(vscode): use node:crypto randomUUID for webview view IDs#2207
Open
StackOverFlow11 wants to merge 1 commit into
Open
fix(vscode): use node:crypto randomUUID for webview view IDs#2207StackOverFlow11 wants to merge 1 commit into
StackOverFlow11 wants to merge 1 commit into
Conversation
|
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.
Related Issue
No linked issue — this is a clear, reproducible crash reported by a user; the problem is explained below.
Problem
Extension builds up to 0.5.10 declare
"engines": { "vscode": "^1.70.0" }, so the marketplace happily installs them on older VS Code releases (e.g. 1.85.2, whose extension host runs Node 18).KimiWebviewProvider.resolveWebviewView()/createPanel()call the globalcrypto.randomUUID(), which only exists in extension hosts running Node >= 20. On those clients the call throws before the sidebar renders, and the user just sees:Observed on VS Code 1.85.2 with extension 0.5.10 (window
renderer.log):mainhas since raisedengines.vscodeto^1.100.0, so new installs are gated — but older VS Code clients are still served the broken 0.5.x builds, and relying on an implicit Web Crypto global in extension-host code stays fragile (it is not part of thenoderuntime contract the code actually runs against). This may also be worth cherry-picking if a 0.5.x hotfix is ever published.What changed
apps/vscode/src/KimiWebviewProvider.ts: importrandomUUIDfromnode:crypto(available since Node 14.17) instead of the globalcrypto, matching the existing pattern inapps/vscode/src/runtime/reverse-rpc.ts. Behavior is identical on supported VS Code versions; the code no longer depends on the runtime exposing Web Crypto as a global.Verified:
pnpm typecheck,pnpm exec oxlint src/KimiWebviewProvider.ts(0 errors), and the extension test suite (14 files, 297 tests, all passing).Checklist
gen-changesetsskill, or this PR needs no changeset. (No changeset — the VS Code extension is versioned and released outside the changesets flow.)gen-docsskill, or this PR needs no doc update. (No user-facing docs change.)