fix(frontend): make workbench Run work over non-localhost HTTP - #414
Merged
Conversation
crypto.randomUUID is only exposed in secure contexts (HTTPS or localhost), so opening the workbench by IP from a remote machine made every query fail with "crypto.randomUUID is not a function". Route the three id call sites through a generateId helper that falls back to building a v4 UUID from crypto.getRandomValues, which is available in insecure contexts. Fixes #413 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CeoyVWAJhRngvgvQvN7jVx
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the workbench “Run” failure when the frontend is accessed over non-localhost HTTP by removing direct reliance on crypto.randomUUID (secure-context only) and routing ID generation through a safe helper.
Changes:
- Added
generateId()helper that usescrypto.randomUUID()when available, otherwise generates an RFC 4122 v4 UUID viacrypto.getRandomValues. - Updated JSON-RPC request IDs to use
generateId()in the tool execution client. - Updated result/error tab IDs in the workbench tool detail view to use
generateId().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| frontend/src/lib/utils.ts | Adds generateId() with a randomUUID → getRandomValues fallback for non-secure contexts. |
| frontend/src/components/views/ToolDetailView.tsx | Routes result and error tab ID generation through generateId(). |
| frontend/src/api/tools.ts | Routes JSON-RPC request id generation through generateId(). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Fixes #413
Opening the workbench by IP from a remote machine rendered fine, but the Run button failed with
TypeError: crypto.randomUUID is not a function.crypto.randomUUIDis only exposed in secure contexts (HTTPS or localhost), whilecrypto.getRandomValuesis available everywhere.This adds a
generateId()helper infrontend/src/lib/utils.tsthat usescrypto.randomUUIDwhen present and otherwise builds an RFC 4122 v4 UUID fromcrypto.getRandomValues, and routes the three call sites through it (JSON-RPC request id inapi/tools.ts, result/error tab ids inToolDetailView.tsx).Verified with
pnpm run buildinfrontend/(typecheck + Vite build pass).🤖 Generated with Claude Code
https://claude.ai/code/session_01CeoyVWAJhRngvgvQvN7jVx
Generated by Claude Code