Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): WSL browser tabs show the page the agent drives #27043

Closedjuliusmarmingewants to merge 4 commits intomain fromfix/issue-27035opened View on GitHub

juliusmarmingecommented

Problem

On Windows desktop with a WSL distro as the backend, the browser panel and the agent's preview tools showed two different pages for one tab. The panel drew the URL in the desktop's own Electron webview, signed in with the Windows profile, while preview_open, preview_snapshot and friends drove the WSL server's headless Chromium, which was signed out. The WSL backend starts without the desktop browser channel, so its server never marked its tabs headless, and the desktop treated them as tabs it renders natively.

Change

ServerBrowser.createTab now marks a server tab headless whenever no desktop page was connected to it, not only when a desktop channel exists. A server without the channel can never drive a desktop page, so a native page there is always a second, disconnected one. With the flag set, the desktop streams the server's page, as it already does after a late desktop attach (https://git.cafe/pingdotgg/t3code/pulls/22877), and the user and the agent see the same page. Servers with a desktop channel behave as before. Web and mobile clients already stream server tabs and are unaffected.

The user docs for WSL and for the remote browser now say that WSL tabs run in the distro's headless Chrome and that desktop browser sign-ins do not carry over.

Scope and approval

Fixes pingdotgg/t3code#27035

Verification

  • New test in apps/server/src/preview/ServerBrowser.test.ts, "a server with no desktop channel marks its tabs headless". It uses the real DesktopBrowserChannel layer with no fds, like the WSL backend. It fails on main (expected undefined to be true) and passes here. ServerBrowser.test.ts 31/31.

  • vp run check:changed: format, lint, knip, graphql, typecheck (3 packages) and tests pass.

  • Runtime transcript. Two dev servers with T3CODE_DEV_SEED=0 and fresh databases, before = 960d5761c1 and after = 87a9cdab29, Linux x86_64. Neither has a desktop browser channel. A driver authenticated as a browser session, called preview.open with runtime: "server" for a synthetic thread and a loopback fixture page, waited for the load, then called preview.list, and counted spans in each side's server.trace.ndjson:

    After the page loadedBefore (960d5761c1)After (87a9cdab29)
    snapshot.runtimeserverserver
    snapshot.headlessabsenttrue
    PreviewManager.markHeadless spans01
    resized events with headless: true01
  • cannot-verify windows: the Windows desktop panel with a WSL backend was not run. The server-side state it reads is verified above.

Claude Opus 5.5 (Claude Code) in T3 Code, with Codex gpt-6.1-sol reviews.

🤖 Generated with Claude Code

    1. Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — WSL browser tabs now stream the server page the agent controls instead of displaying a separate desktop page. This changes default rendering and the visible sign-in context, requiring human acceptance of that user-experience change.

      Notes:

      • Diff unchanged. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review.

      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between 7a4f5b6188fed54ddc866723e39446a198b5835c and 479d1d449a3fbf53313a810e12592e149d6452b0.

      Files selected for processing: 4
      • apps/server/src/preview/ServerBrowser.test.ts
      • apps/server/src/preview/ServerBrowser.ts
      • docs/user/install.md
      • docs/user/remote-access.md

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

      Walkthrough

      The server now marks tabs headless when no desktop page is connected, including when the desktop channel is unavailable. The installation and remote-access documentation describes browser behavior in WSL environments.

      Changes: WSL browser handling

      Layer / File(s)Summary
      Mark tabs headless without a desktop page
      apps/server/src/preview/ServerBrowser.ts, apps/server/src/preview/ServerBrowser.test.ts
      createTab marks a tab headless when no desktop page was connected, including when the desktop channel is unavailable. A test checks the headless status.
      Describe browser behavior in WSL
      docs/user/install.md, docs/user/remote-access.md
      The installation documentation describes headless Chrome use inside the selected WSL distro and notes that desktop-browser sign-ins do not carry over. The remote-access documentation describes when the desktop app displays tabs directly or streams them from the host.
      Priority: Normal

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Suggested labels: bugfix

      Suggested reviewers: t3dotgg, macroscopeapp

      Merge Risk: Minimal · up to 479d1

      The server-owned browser page is correctly streamed when no desktop page is connected, with no identified merge-blocking risk.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main fix: WSL browser tabs now show the page driven by the agent.
      Description checkPassedThe description includes the problem, change, scope and issue reference, focused verification results, runtime evidence, and the unverified Windows-panel limitation. It matches the repository template…
      Linked Issues checkPassedIssue #27035 requires the desktop panel and agent tools to use one page and profile, or to identify separate runtimes. ServerBrowser.createTab now marks tabs headless whenever no desktop page connec…
      Out of Scope Changes checkPassedThe changed server code and test implement the WSL tab-selection fix for issue #27035. The WSL and remote-browser documentation explains the resulting runtime and sign-in behavior. No unrelated implem…
      Full details: Description check

      Explanation

      The description includes the problem, change, scope and issue reference, focused verification results, runtime evidence, and the unverified Windows-panel limitation. It matches the repository template and provides sufficient detail.

      Full details: Linked Issues check

      Explanation

      Issue #27035 requires the desktop panel and agent tools to use one page and profile, or to identify separate runtimes. ServerBrowser.createTab now marks tabs headless whenever no desktop page connects, including when the desktop channel is unavailable. This selects the server page for desktop streaming in the WSL case. The new test, a server with no desktop channel marks its tabs headless, verifies the WSL condition. The change keeps the existing behavior when a desktop page connects. The documentation states that WSL tabs use distro Chrome and do not use desktop-browser sign-ins.

      Full details: Out of Scope Changes check

      Explanation

      The changed server code and test implement the WSL tab-selection fix for issue #27035. The WSL and remote-browser documentation explains the resulting runtime and sign-in behavior. No unrelated implementation or documentation change is shown.

      Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    3. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      CodexLive turn WebSocket decoded21.6 KiB21.6 KiB0 B (0.0%)24.4 KiB✅
      CodexLive turn messages220 (0.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.1 KiB+6 B (+0.1%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.3 KiB1.3 KiB+6 B (+0.5%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.9 KiB21.9 KiB0 B (0.0%)24.4 KiB✅
      ClaudeLive turn messages220 (0.0%)8✅

      Baseline: 7a4f5b6 · PR result: 479d1d4 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 108.5 KiB
      • Claude decoded thread snapshot: 108.8 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    4. juliusmarminge added labelsbugfix

    5. juliusmarminge added labelspr:gate-failed

    6. Additional Windows/WSL verification for the gap noted in this PR's description: the same condition change fixed this on my actual Windows desktop with a Linux x64 WSL backend, T3 Code 0.1.6.

      Before:

      • Opened example.com through preview_open, then navigated the same tab to a bol.com product page and search results through preview_navigate.
      • The address bar changed and agent-side reads returned the new page, but the desktop panel continued showing the initial page.
      • Opening a fresh tab showed the correct initial page again, but navigating that tab reproduced the frozen view.
      • t3_preview_list reported runtime: "server" without headless; preview_status reported visible: false despite the panel being open. The panel had normal browser controls, without the streamed-view control button.

      After applying the equivalent if (!desktop) change locally and restarting:

      • Verified that the running WSL executable matched the patched file's SHA-256.
      • New sessions reported runtime: "server", headless: true, and preview_status reported visible: true.
      • Opened the product page and navigated the same tab to search results. The privacy dialog could be dismissed through the agent tools, and I visually confirmed that the panel now updated with the agent's actions.

      Verification scope: this was a local hotfix to the bundled 0.1.6 WSL runtime, not a build of this PR's head. The initial executable-only patch was restored by T3 at restart; the successful run used a patched local runtime archive with its checksum updated. No account sign-in or cookie sharing was tested. This provides real Windows/WSL evidence for the server-side condition change, rather than full validation of every change in this PR.

      Investigated and verified with GPT-6 Astra through the Codex harness in T3 Code; visual confirmation by the desktop user.

    7. Also reproduces on 0.1.8-nightly.20261104.4192 (Windows desktop, WSL2, x64). A value typed into the visible panel stays empty for the agent's tools, and the agent's page reports Linux x86_64.

      One small question on the fix: markHeadless runs after the tab is published. Without a desktop channel, the outcome is already known at open. Would setting headless in the first snapshot avoid a short window where the desktop mounts its own webview? I haven't tested whether this window is visible in practice.

    8. Thanks for the earlier fix, Julius. Closing this in favor of #31172 by THEtheChad, which makes the same channel-less tabs headless and also marks them before publication. This branch has been stale since October 29 while main has changed the affected files; the other PR was updated on November 10.

    9. juliusmarminge closed this

    10. juliusmarminge removed labelspr:gate-failed

Sign in to join this conversation.