fix(server): WSL browser tabs show the page the agent drives #27043
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 realDesktopBrowserChannellayer with no fds, like the WSL backend. It fails on main (expected undefined to be true) and passes here.ServerBrowser.test.ts31/31.vp run check:changed: format, lint, knip, graphql, typecheck (3 packages) and tests pass.Runtime transcript. Two dev servers with
T3CODE_DEV_SEED=0and fresh databases, before = 960d5761c1 and after = 87a9cdab29, Linux x86_64. Neither has a desktop browser channel. A driver authenticated as a browser session, calledpreview.openwithruntime: "server"for a synthetic thread and a loopback fixture page, waited for the load, then calledpreview.list, and counted spans in each side'sserver.trace.ndjson:After the page loaded Before (960d5761c1) After (87a9cdab29) snapshot.runtimeserverserversnapshot.headlessabsent truePreviewManager.markHeadlessspans0 1 resizedevents withheadless: true0 1 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
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: fix/issue-27035
- File: .coderabbit.config.ts
- Commit: 479d1d4
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Team
- Run ID:
df3c6486-26f6-4727-a9f1-d16f4e1c063f
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.tsapps/server/src/preview/ServerBrowser.tsdocs/user/install.mddocs/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
Priority:Layer / File(s) Summary Mark tabs headless without a desktop page
apps/server/src/preview/ServerBrowser.ts,apps/server/src/preview/ServerBrowser.test.tscreateTabmarks 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.mdThe 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. NormalEstimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested labels:
bugfixSuggested reviewers:
t3dotgg,macroscopeapp
Merge Risk:
Minimal · up to479d1-
The server-owned browser page is correctly streamed when no desktop page is connected, with no identified merge-blocking risk.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly and concisely describes the main fix: WSL browser tabs now show the page driven by the agent. Description check 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… Linked Issues check Issue #27035requires the desktop panel and agent tools to use one page and profile, or to identify separate runtimes.ServerBrowser.createTabnow marks tabs headless whenever no desktop page connec…Out of Scope Changes check 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 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
#27035requires the desktop panel and agent tools to use one page and profile, or to identify separate runtimes.ServerBrowser.createTabnow 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
-
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Codex Live turn WebSocket decoded 21.6 KiB 21.6 KiB 0 B (0.0%) 24.4 KiB ✅ Codex Live turn messages 2 2 0 (0.0%) 8 ✅ Claude Total thread wire 5.0 KiB 5.1 KiB +6 B (+0.1%) 6.8 KiB ✅ Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Claude Live turn WebSocket wire 1.3 KiB 1.3 KiB +6 B (+0.5%) 2.0 KiB ✅ Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅ Claude Live turn messages 2 2 0 (0.0%) 8 ✅ Baseline:
7a4f5b6· PR result:479d1d4· Source CI: successScenario 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.
juliusmarminge added labelsbugfix
juliusmarminge added labelspr:gate-failed
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 throughpreview_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_listreportedruntime: "server"withoutheadless;preview_statusreportedvisible: falsedespite 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, andpreview_statusreportedvisible: 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.
- Opened example.com through
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 reportsLinux x86_64.One small question on the fix:
markHeadlessruns after the tab is published. Without a desktop channel, the outcome is already known at open. Would settingheadlessin 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.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.
juliusmarminge closed this
juliusmarminge removed labelspr:gate-failed
Sign in to join this conversation.
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).