Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): preview browser presents as Chrome so sites accept sign-in #45049

Mergedmaria-rcksmerged 1 commit intomain fromrefs/pull/45049/headmerged by maria-rcks View on GitHub

maria-rckscommented

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

before: every surface of the desktop preview sends T3CodeBeta/0.0 and Electron/44.10.1 in its User-Agent

after: page, fetch, dedicated, shared and service workers all send Chrome/152.0.0.0 with no app or Electron token

before: WhatsApp Web in the desktop preview shows "WhatsApp works with Google Chrome 100+"

after: WhatsApp Web in the desktop preview shows its "Scan to log in" QR page

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:

sitemainthis PR
WhatsApp Web"works with Google Chrome 100+"QR sign-in
Entra authorize pagefIsFidoSupported absenttrue
Google sign-inflowName=WebLiteSignInGlifWebSignIn
TeamsMicrosoft sign-inMicrosoft sign-in
dash.cloudflare.com/login, 40 sno Turnstile errorsno Turnstile errors
GitHub loginloadsloads

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

DelegateRound 1
GPT Sol9/10
GPT Sol (second seat; Gemini Neon out of quota)9/10

Opus 5.5 via Claude Code.

🤖 Generated with Claude Code

    1. tanstack-source added labelsbug

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Explain Change →

      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

      Layer / File(s)Summary
      Set preview User-Agent and handle request headers
      apps/desktop/src/preview/BrowserSession.ts, apps/desktop/src/preview/BrowserSession.test.ts
      chromeUserAgent derives 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 without sec-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)

      sequenceDiagram
        participant BrowserSession
        participant ElectronApp
        participant DefaultSession
        participant PreviewRequest
        BrowserSession->>ElectronApp: Read userAgentFallback
        BrowserSession->>DefaultSession: Set native User-Agent when values differ
        BrowserSession->>ElectronApp: Set reduced Chrome User-Agent fallback
        PreviewRequest->>BrowserSession: Provide URL and request headers
        BrowserSession-->>PreviewRequest: Add client hints when eligible and sec-ch-ua is absent

      Possibly related issues

      • Issue 30014: The issue reports that Entra hides passkeys when the outgoing User-Agent contains Electron/. This change removes that token from the preview User-Agent, but the Windows passkey case is not verified.
      • Issue 37739: The issue reports GoHighLevel sign-in failure and suggests the User-Agent may be involved. This change uses a reduced Chrome identity, but GoHighLevel is listed as unverified.

      Suggested reviewers: juliusmarminge, nasimawabdy

      Merge Risk: Minimal · up to 8ad44

      Preview 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: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe 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 r…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Description checkPassedThe 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 …
      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)

      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between 4acea8cbcfcd5a6f5da26e2c3dcfa9ed3461469e and 8ad44667b74cb2b8fa4e78efe151b64dd410fee6.

      Files selected for processing: 2

      • apps/desktop/src/preview/BrowserSession.test.ts
      • apps/desktop/src/preview/BrowserSession.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

    3. maria-rcks merged this79355c0

    4. maria-rcks closed this

Sign in to join this conversation.