Desktop preview, before and after: the User-Agent each part of a page sees, then WhatsApp Web.




Sites block sign-in in the desktop preview browser because its User-Agent carries the app token and Electron/ (report: https://x.com/PepperonPete/status/2126707108041359771). WhatsApp serves its unsupported-browser page, Entra leaves out passkeys, Google serves its lite sign-in flow, and the GoHighLevel sign-in in #37739 stalls until Electron/ is gone. Main only patched Teams by host. #7110 removed the last global rewrite because session.setUserAgent broke Cloudflare Turnstile with error 600010. The cause turned out to be workers: shared and service workers read Electron's app-wide fallback, not the session, so pages saw two identities.
Preview sessions now set app.userAgentFallback to Chrome's reduced User-Agent (Electron's own string without the app and Electron/ tokens, Chrome/<major>.0.0.0). Every surface, workers included, reports the same value Chromium 152 sends. The app window's default session is pinned to its native User-Agent first, so the T3 window and Settings > Authorized clients still say Electron. The Teams host rewrite is no longer needed and is gone. This also covers the Entra hosts from #30018.
Measured on Linux with a real desktop build (Electron 44.10.1), clean profiles, no credentials typed:
| site | main | this PR |
|---|
| WhatsApp Web | "works with Google Chrome 100+" | QR sign-in |
| Entra authorize page | fIsFidoSupported absent | true |
| Google sign-in | flowName=WebLiteSignIn | GlifWebSignIn |
| Teams | Microsoft sign-in | Microsoft sign-in |
| dash.cloudflare.com/login, 40 s | no Turnstile errors | no Turnstile errors |
| GitHub login | loads | loads |
To show the Turnstile check means something: in the same Electron, session.setUserAgent with this exact string logged [Cloudflare Turnstile] Error: 600010 17 times in 35 s. The fallback logged none. The server-side preview (web and mobile stream it) already presents as Chrome and is unchanged. Mobile has no browser of its own.
Checks: vp test run src/preview/BrowserSession.test.ts (25 pass, existing file extended), desktop typecheck, vp run check:changed.
Not verified: macOS and Windows desktop builds (only Linux was run; the UA rewrite is covered for all three formats in the test). No completed sign-in anywhere, since no accounts were used: GoHighLevel (#37739), More Rewards (#41732), an Entra passkey, and a submitted Turnstile login. The X report names no site, so its exact case is unknown.
Council review#
Rounds: 1
| Delegate | Round 1 |
|---|
| GPT Sol | 9/10 |
| GPT Sol (second seat; Gemini Neon out of quota) | 9/10 |
Opus 5.5 via Claude Code.
🤖 Generated with Claude Code
No actionable comments were generated in the recent review.
Walkthrough
BrowserSession now sets a reduced Chrome User-Agent as Electron’s app-wide fallback while preserving the native User-Agent on the default session when needed. It also removes Teams-specific request rewriting and adds client hints only to eligible requests that lack
sec-ch-ua.Changes: Preview User-Agent handling
apps/desktop/src/preview/BrowserSession.ts,apps/desktop/src/preview/BrowserSession.test.tschromeUserAgentderives a reduced Chrome User-Agent. Session creation updates the app fallback and, when the values differ, sets the default session to the native User-Agent. The request callback adds client hints only to eligible main-frame or subframe requests withoutsec-ch-ua; the Teams-specific rewrite is removed. Tests cover the fallback, preview sessions, workers, and reduced User-Agent formatting.Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Sequence Diagram(s)#
Possibly related issues
Electron/. This change removes that token from the preview User-Agent, but the Windows passkey case is not verified.Suggested reviewers:
juliusmarminge,nasimawabdyMerge Risk:
Minimal · up to
8ad44Preview browser sessions now present a reduced Chrome User-Agent so sites offer their normal sign-in flows, and the app window keeps its native identity. The reviewed change shows no concrete risk to merging. macOS and Windows behavior was not verified.
Pre-merge checks:
4
Full details: Title check
Explanation
The title states the main change: the desktop preview browser now presents a Chrome User-Agent so sites accept sign-in. The raw summary confirms this: preview sessions set app.userAgentFallback to a reduced Chrome User-Agent, and the Teams-specific rewrite is removed. The title follows the conventional commit form and is specific enough for a teammate scanning history.
Full details: Description check
Explanation
The description follows the template's main sections: Problem, Change, Scope, and Verification. It explains the problem with a concrete report of sites blocking sign-in because the preview User-Agent contains the app token and Electron/. It describes the change: preview sessions set app.userAgentFallback to Chrome's reduced User-Agent while the app window keeps its native identity, and the Teams host rewrite is removed. Scope cites prior issues (
#7110,#30018,#37739,#41732) and the X report, but it gives no explicit statement that this is a bug fix rather than a feature. Verification is detailed: it lists the test command and results (25 pass), typecheck, a measured Linux before/after table, and a Turnstile comparison. It also lists unverified items (macOS, Windows, completed sign-ins). Screenshots are embedded for the UI change. The template's required agent attribution line is present (the PR notes Claude Code and the model). The description is thorough and mostly complete, so it passes.Finishing Touches
Generate unit tests (beta)
3933a6ed-6165-460b-8042-dad70a605e35Reviewing files that changed from the base of the PR and between 4acea8cbcfcd5a6f5da26e2c3dcfa9ed3461469e and 8ad44667b74cb2b8fa4e78efe151b64dd410fee6.
apps/desktop/src/preview/BrowserSession.test.tsapps/desktop/src/preview/BrowserSession.tsIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.