Conversation
Host queue turns and operations were identified with `crypto.randomUUID()`, which browsers expose only in secure contexts. The remote page that LAN mode serves over plain HTTP, and older WebViews, therefore failed every send with "crypto.randomUUID is not a function" (regression from GCWing#3180). Derive a v4 UUID from `crypto.getRandomValues`, which those environments still provide, and keep the secure-context call unchanged. Co-authored-by: OpenBitFun <318544290+bitfun-ai@users.noreply.github.com>
|
@GCWing CI is green — Frontend Build, Rust Build Check (macOS/Ubuntu/Windows), CLI Tests (macOS/Ubuntu/Windows), Build Impact, Repository Object Sizes and Shell Deploy Scripts all pass (the two skipped jobs are impact-selected off for a frontend-only change). This is ready for your review and merge. Context for review: a regression from #3180. |
Summary
Fixes a regression from #3180 (host-owned mobile message queues): the queue identified turns and operations with
crypto.randomUUID(), which browsers expose only in secure contexts.crypto.randomUUID is not a functionbanner, and nothing is queued.src/shared/dialog-queue/HostDialogQueue.ts(newId) was the only unguardedcrypto.randomUUIDcall on these paths. Every other call site in the repo already guards it (CloudAccountClient.generateRequestId,copyToClipboard's explicit "insecure contexts (HTTP)" fallback, and the manytypeofchecks inweb-ui).http://<lan-ip>:9700,RemoteConnectDialog/build_lan_relay_url), sorandomUUIDis missing in every browser there. Old in-app browsers / WebViews over the official HTTPS relay hit the same gap.crypto.getRandomValues, which insecure contexts still expose, and leave the secure-context call unchanged.Fixes #3180 (regression introduced there).
Type and Areas
Type: regression fix
Areas: web UI, mobile web (shared module
src/shared/dialog-queue, used by the remote page and the desktop composer)Motivation / Impact
A user controlling a machine over LAN could reach the session and receive assistant output, but nothing they typed could be queued — every send died locally in JS. The same shared module now also backs desktop composer sends, so an old Linux WebKit build fails identically. No host, relay, protocol, or wording change; only the id source when
randomUUIDis absent.Verification
cd src/mobile-web && node --test tests/host-dialog-queue.test.mjs— 14/14 pass, including the new case that stubs acryptowithoutrandomUUIDand asserts both the queuedturnIdand the promoteoperationIdare v4 UUIDs.HEADvs this commit, samecryptostub): pre-fix rejects withcrypto.randomUUID is not a function; fixed accepts and returnsc1ab8814-ec71-4ace-bed8-9d2284309a7e.pnpm --dir src/mobile-web run type-check— pass.pnpm --dir src/web-ui run type-check— pass (afterpnpm --dir src/web-ui run gen:types).pnpm --dir src/web-ui exec vitest run src/flow_chat/components/HostPendingQueuePanel.test.tsx— 4/4 pass.test:host-queue(no Chromium on this host), and the wholetest:host-queuesuite is not part of the Frontend Build job. CI covers type-check/build for this change.Reviewer Notes
randomUUIDbranch is what already ran there.CloudAccountClient.generateRequestId) rather than a new shared util, to keep the diff reviewable; happy to extract it if you prefer one owner for id generation.bitfun-aiaccount. Testing level: fully tested for the changed module (unit + focused suites + type-checks above); no end-to-end LAN run.Checklist