fix(ui/tabs): crypto.randomUUID fallback for non-secure contexts - #177
Merged
Conversation
`crypto.randomUUID()` is only defined in secure contexts (HTTPS / localhost). LAN-IP HTTP access — exactly how external testers reach a self-hosted OpenAlice — gets `undefined`, so opening the very first tab threw `TypeError: crypto.randomUUID is not a function` on a fresh tester session. Build a v4 id ourselves using `crypto.getRandomValues` (available over HTTP) when `randomUUID` is missing, with a `Math.random` last resort. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Playwright MCP saves accessibility snapshots and console logs under `.playwright-mcp/` whenever an agent uses the browser tools for verification — they're per-session debug artifacts, not source. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Browser tab id generation crashed for testers accessing OpenAlice over a
plain-HTTP LAN-IP URL —
crypto.randomUUIDis only defined in securecontexts. Fix is a self-contained UUIDv4 fallback in
ui/src/tabs/store.tsthat uses
crypto.getRandomValues(which IS available over HTTP) andfalls back to
Math.randomif even that is missing. Also adds a.playwright-mcp/entry to.gitignorefor the session-scoped browserdebug artifacts that the Playwright MCP server drops when an agent runs
end-to-end verification.
Per-session contributions
2026-05-12 — Crypto.randomUUID secure-context fix
newId()inui/src/tabs/store.tsnow feature-testscrypto.randomUUIDand synthesizes a v4 id from
crypto.getRandomValues(orMath.random)when it is undefined.
TypeError: crypto.randomUUID is not a functionon first page load. The regression landed with the workspace store
in
b1f1ec8/82aecd9— local dev (http://localhost:3002) is asecure context so it went unnoticed; LAN-IP HTTP access is not.
.playwright-mcp/to.gitignoreso Playwright MCP's per-sessionconsole logs / accessibility snapshots stop polluting untracked status.
0814b1d,42c4e7bFull commit log
Test plan
npx tsc --noEmitclean (root +ui/package)pnpm test— 86 files / 1675 tests pass from repo rootgrep getRandomValues dist/ui/assets/index-*.js)crypto.randomUUIDdeleted at runtime, clickingMarket → Browse Marketscreates a tab with a valid v4 id and zero console errors. Same gesture before the fix throwsTypeError: crypto.randomUUID is not a functionatopenOrFocus.🤖 Generated with Claude Code