You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove Electron token from built-in browser user agent #55730
The built-in desktop browser sends Electron's default user agent, which includes an Electron/ token:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) OpenCode/2.0.29 Chrome/152.0.7977.130 Electron/44.4.5 Safari/537.36
Some sites check the user agent and treat Electron/ as a separate, unsupported browser. Medium is one example. When I'm logged in, clicking Write redirects to /m-write ("Start writing in the Medium app"), and /p/<id>/edit redirects to the public story. The editor page reports "browser": "electron" and "supportsDesktopEdit": false. The same account works in regular Chrome, so the user agent is the cause, not the account, login, or window width.
Cause: packages/gui-extensions/src/browser/pane.ts creates the opencode-browser-<id> session but never calls setUserAgent, so Electron's default is used.
Suggested fix: when the browser session is created, call setUserAgent on it with only the Electron/… token removed. The OpenCode/… token and the real Chrome version stay. With that change, common parsers such as ua-parser-js and Bowser detect Chrome instead of Electron. This only touches the browser partition, not the app window.
I'm happy to open a PR for this.
Plugins
none
OpenCode version
Desktop 2.0.29
Steps to reproduce
Open the built-in browser in OpenCode Desktop.
Run navigator.userAgent in the page and note that it contains Electron/.
Sign in to Medium and click Write. You land on https://medium.com/m-write ("Start writing in the Medium app").
Open https://medium.com/p/<story-id>/edit. You get the public story instead of the editor.
Do the same in regular Chrome with the same account. The editor opens.
Thanks for the detailed report. I couldn't run OpenCode Desktop's built-in browser in this sandbox, so I haven't watched it happen. The code does match what you describe, though. In packages/gui-extensions/src/browser/pane.ts, the opencode-browser-<id> partition is created without a setUserAgent call, so pages get Electron's default user agent, Electron/… token included. That's still the case on the latest dev (81200db). A maintainer with the desktop app will need to confirm it. Since you offered, a PR along the lines you suggested could help: strip only the Electron/ token on the browser partition and leave the app window alone.
Activity
opencode-agent commentedon Oct 15, 2026
Thanks for the detailed report. I couldn't run OpenCode Desktop's built-in browser in this sandbox, so I haven't watched it happen. The code does match what you describe, though. In
packages/gui-extensions/src/browser/pane.ts, theopencode-browser-<id>partition is created without asetUserAgentcall, so pages get Electron's default user agent,Electron/…token included. That's still the case on the latestdev(81200db). A maintainer with the desktop app will need to confirm it. Since you offered, a PR along the lines you suggested could help: strip only theElectron/token on the browser partition and leave the app window alone.quanliew28 commentedon Nov 7, 2026
yes, please remove 'electron' UA token from the browser, i was unable to access website via opencode browser.