Repository navigation
fix(app,gui-plugins): port renderer UUID generation to HTTP-safe uuid() - #60462
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
The fix works. Over plain HTTP from a LAN IP (isSecureContext false, crypto.randomUUID undefined), Open file throws crypto.randomUUID is not a function on the base and opens the picker tab with this change. I checked with the issue's reproduction script against servers run from source in both checkouts. The new e2e test passes here and fails on the base.
Public API: unchanged. @opencode/util/uuid is a new internal module, available through the existing ./* export.
One thing to fix: the moved packages/util/src/uuid.test.ts still has import { uuid } from "./uuid". packages/util uses nodenext resolution, so tsc --noEmit there now fails with TS2835 (the base passes). Changing the import to ./uuid.js, like the package's other tests do, fixes it.
There was a problem hiding this comment.
The fix still works: I rebuilt from this head and re-ran the issue's script over plain HTTP from a LAN IP. Open file opens the picker, and nothing is thrown. Pointing the app's callers straight at @opencode/util/uuid and removing the shim is clean, and tsc -b in packages/app passes. The public API is unchanged.
Still open from last time: packages/util/src/uuid.test.ts imports ./uuid, so tsc --noEmit in packages/util still fails with TS2835. It needs ./uuid.js.
The new typing change in createCommentSessionState (packages/app/src/composer/comments.tsx) only changes types and has nothing to do with this fix, so it can be dropped to keep the change focused.
There was a problem hiding this comment.
The new commits look good. Over plain HTTP from a LAN IP, /btw showed "Failed to send command … crypto.randomUUID is not a function" on the base. With this change there's no error and the side chat opens. Open file still opens the picker. tsc -b passes in packages/app and packages/gui-plugins, and oxlint finds nothing in the changed plugin files. The only direct randomUUID() calls left are in desktop main-process code. The public API is unchanged. Nothing new to raise.




Fixes #59791
Supersedes #59860
uuid()to@opencode/util/uuid(packages/util/src/uuid.ts): Moves theisSecureContextandcrypto.randomUUIDcompatibility helper and its unit tests out of@opencode/appinto@opencode/util/uuid, updating@opencode/appcallers directly so@opencode/gui-pluginsand@opencode/appshare one module with no re-export shim.crypto.randomUUID()call touuid()(packages/gui-plugins,packages/app):packages/gui-plugins/src/file/renderer.tsx: Side-panelfile:open:<id>launcher tabs (+→ Open file andCtrl+Alt+P) on wide viewports.packages/gui-plugins/src/btw/model.ts:/btwside-panel quick chat IDs.packages/gui-plugins/src/terminal/panel.tsx: Terminal selection Quote composer attachment IDs.packages/app/src/runtime/plugin/host-apis.tsx: Window plugin hostctx.notify(...)deduplication keys.packages/gui-plugins/src/browser/comment.ts,connection.ts,ssh/dialog.tsx, andpackages/app/src/voice/transport.ts: Desktop-gated renderer IDs so zero rawcrypto.randomUUID()calls remain in shipped window code.packages/app/AGENTS.md,packages/gui-plugins/AGENTS.md): Instructs contributors and agents never to call[SecureContext]-onlycrypto.randomUUID()directly in renderer/browser code and to useuuid()from@opencode/util/uuid.packages/app/e2e/regression/review.spec.ts): Verifies multiple Open file launcher tabs open whenisSecureContextisfalseandcrypto.randomUUIDisundefined.Visual
Added by the opencode bot (AI-generated).
Fixes #55777
Related: #46168