Skip to content

fix(core): allow OpenAI SDK in Tauri webview#67

Merged
oratis merged 1 commit into
mainfrom
fix/openai-allow-browser
May 28, 2026
Merged

fix(core): allow OpenAI SDK in Tauri webview#67
oratis merged 1 commit into
mainfrom
fix/openai-allow-browser

Conversation

@oratis

@oratis oratis commented May 28, 2026

Copy link
Copy Markdown
Owner

Summary

The OpenAI SDK's dangerouslyAllowBrowser guard fires in the Tauri webview, blocking the desktop REPL with × Failed to start: It looks like you're running in a browser-like environment.

Set the flag to true when constructing the DeepSeek client. The guard exists to prevent shipping API keys in webpages served to untrusted browsers — DeepCode never matches that case (CLI / VS Code extension / Tauri desktop all run on the user's own machine with the key in storage they control). In Node the flag is a no-op (the underlying typeof window check never trips), so this only affects the Tauri webview.

Test plan

  • pnpm --filter @deepcode/core build succeeds
  • pnpm --filter @deepcode/core test — all 478 tests pass
  • All 7 workspace typecheck + 533 tests green via pre-commit
  • Rebuilt + signed + notarized DMG can complete a chat turn (verifying after build completes)

🤖 Generated with Claude Code

…: true)

The OpenAI SDK refuses to construct in a "browser-like" environment by
default, to prevent users from accidentally shipping API keys in pages
served to untrusted browsers. In the DeepCode Tauri desktop app the
renderer trips this guard even though the key is loaded from local
Tauri-keychain storage (never exposed to a real browser). The CLI and
VS Code extension run in Node, where the guard never trips anyway, so
turning the flag on unconditionally is a no-op there and only matters
inside the Tauri webview.

Fixes the "× Failed to start: It looks like you're running in a
browser-like environment" error in the desktop REPL.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@oratis oratis merged commit 9f4a5b9 into main May 28, 2026
1 of 3 checks passed
@oratis oratis deleted the fix/openai-allow-browser branch May 28, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant