Repository navigation
Conversation
Constraint: Plain HTTP LAN clients do not expose crypto.randomUUID. Rejected: Global crypto polyfill | Existing createBrowserUuid keeps the fallback scoped to renderer identifiers. Confidence: high Scope-risk: narrow Directive: Use createBrowserUuid for renderer IDs that must work outside secure contexts. Tested: pnpm lint; pnpm typecheck; focused Vitest 31 passed after rebase. Not-tested: full pnpm test; pnpm build
📝 WalkthroughWalkthroughThe refresh hook now imports and calls 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Flagging overlap rather than closing: #22516 now covers this bug end to end — every The AI Vault request-token test from #20465 has been ported into #22516, so that coverage is not lost. A maintainer should close this in favour of #22516 unless it covers something #22516 misses — if it does, please say so on #22516. |
|
Closing as superseded by #22516, which is merged and present on I checked this PR's scope and discussion against the merged implementation. The replacement explicitly supersedes this PR and covers its requested behavior. Thanks for the contribution; the branch is preserved. |
Summary
createBrowserUuid()fallback for the AI Vault scan request token.crypto.randomUUIDunavailable.Root cause: browsers do not expose
crypto.randomUUIDin non-secure contexts such as a LAN or Tailscale web client served over plain HTTP. The AI Vault refresh hook called it unconditionally during render, so the right-sidebar error boundary replaced the panel before any session request could start.Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused verification:
vitest run --config config/vitest.config.ts src/renderer/src/components/right-sidebar/ai-vault-session-refresh.test.ts src/renderer/src/lib/non-secure-context-crypto.repro.test.ts— 2 files, 31 tests passed after rebasing onto currentmainand again after the full build.TypeError: crypto.randomUUID is not a functionatai-vault-session-refresh.ts.The full test suite was attempted after the rebase, but this local sandbox forbids the Unix/TCP socket and DNS operations used by many integration tests (
listen EPERM,ENOTFOUND), causing repeated 30–60 second infrastructure timeouts. The run was stopped after more than 12 minutes rather than reporting those environment failures as change-related results. Full lint, full typecheck, full desktop/web/native build, and the focused regression surface pass.AI Review Report
The review checked the render-time failure path, hook cleanup, request-token stability, existing UUID fallback behavior, and test isolation. No change-specific findings remained.
Cross-platform compatibility was reviewed for macOS, Linux, and Windows. The change introduces no shortcuts, labels, paths, shell behavior, native modules, or Electron-specific branches. SSH hosts and folder workspaces are unaffected because the token is created in the renderer before the existing IPC/runtime request.
Supported agents and integrations are unaffected. The change only replaces renderer-side request-token generation before the existing provider-neutral AI Vault API call; it does not branch on agent type, integration, Git provider, workspace type, or runtime transport.
Performance risk is negligible:
createBrowserUuid()runs once per hook instance through the existinguseRefinitialization path, matching the previous UUID call's frequency. It adds no polling, I/O, subscription, or hot-path work. UI quality review is not applicable because there is no visual, layout, or interaction change beyond preventing the sidebar crash.Security Audit
No new input, command execution, path handling, authentication, secret, dependency, or IPC surface is introduced. The request token is a cancellation/correlation identifier rather than an authorization credential. In the affected non-secure browser context, the existing helper uses
crypto.getRandomValues; its finalMath.randomfallback is unchanged and remains limited to non-security-sensitive UI identifiers.Notes
mainremains affected, so this focused fix may need a trivial rebase if that PR lands first.pnpm buildcompleted successfully, including desktop, web, relay, CLI, and macOS native targets.