Repository navigation
fix(desktop): remove the Electron token from the built-in browser user agent - #55788
sathwick-p wants to merge 2 commits into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
Looks correct to me. The user agent is set once on the attachment's own opencode-browser-<uuid> partition, so tabs, popups and the proxy's net.request all get it, and the app window is untouched. The regex removes only the Electron/<version> token from Electron's default user agent. I couldn't run the desktop browser panel in this sandbox (no Electron or display), so I checked the code and ran typecheck, bun test src/browser (33 pass) and oxlint on pane.ts in packages/gui-extensions; all are clean. A maintainer with Desktop can confirm by checking navigator.userAgent in the panel.
Public API is unchanged.
No blocking concerns.
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #55730
Type of change
What does this PR do?
The built-in browser's session never set a user agent, so pages got Electron's default, which includes
Electron/<version>. Sites that parse the user agent read that as a separate browser. Medium, for example, sends you to "Start writing in the Medium app" instead of opening the editor.This sets the user agent once on the browser partition, with only the
Electron/token removed. TheOpenCode/<version>token and the real Chrome version stay. Tabs and popups share that partition, so they all pick it up. The app window is unchanged.How did you verify your code works?
bun run dev:desktop, opened the browser panel and checkednavigator.userAgent:... OpenCodeDev/2.0.29 Chrome/152.0.7977.130 Safari/537.36, noElectron/.User-Agentheader the server received matches, so it holds through the browser proxy.bun run check,bun typecheckandbun test src/browserinpackages/gui-extensions, andbun run lint:changedall pass.Screenshots / recordings
Not a UI change.
Checklist