Repository navigation
fix(preview): Browser pane navigates when the desktop backend has no browser channel - #35424
Conversation
…tabs headless Fails on main: in WSL-only mode the desktop starts its backend without browser fds, the server never marks its tabs headless, and the desktop draws a local page the address bar cannot navigate (#17009). AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…browser channel In WSL-only mode the desktop starts its backend without the desktop browser fds, so the server never marked its tabs headless. The desktop then drew its own local page that typed URLs never reached, while agents drove a separate headless page. Mark every tab the desktop does not draw headless, so the pane streams the server's page. Fixes #17009 AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Server-backed browser tabs are now marked headless even when no desktop browser channel exists, allowing the preview pane to render the page actually being controlled. Desktop-connected tabs remain unchanged, and the change is limited to rendering selection. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 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.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…browser channel (pingdotgg#35424) (cherry picked from commit 4c255bc)
Since #22877, ServerBrowser.setUpTab marked a tab headless only when the desktop browser channel was available (
!desktop && desktopChannel.available). In WSL-only mode the desktop starts its only backend without the browser fds, so the channel is unavailable and primary-environment server tabs stayed non-headless. rendersServerTabNatively then had Electron draw its own local page, which typed URLs never reached, while the server ran a separate headless page for agents. The fix drops thedesktopChannel.availablecondition, so every tab the desktop does not draw (no channel, attach timeout, or adopted popup) is marked headless and the pane streams the server's page. When the channel is present and the desktop attaches, nothing changes. On servers with no desktop at all (plaint3, remote), tabs now carry headless: true. Nothing reads the flag outside the native-render check, which already needs an Electron primary environment, so there is no visible change there. I chose this over PR #31172, which reads the fd config in PreviewManager.open, because it keeps the decision in the one place that already makes it. The repro test 'a server started without the desktop browser channel marks its tabs headless' fails on the base ('expected undefined to be true') and passes with the fix. No new regex or parser. I did not re-run the desktop app on this branch; the repro step already reproduced the bug end to end there.Fixes #17009
Reproduction on main
Commit origin/main f03db4f. WSL itself is not available on Linux, so I simulated WSL-only mode exactly at its root cause: I commented out desktopBrowserFd/desktopBrowserControlFd in the Linux primary backend config (apps/desktop/src/backend/DesktopBackendConfiguration.ts L518-519, local only, not committed) and ran the real desktop app (
T3CODE_DEV_SEED=0 headless-desktop vp run dev:desktop), driving it over CDP. Steps: created a project, opened a thread, Open a surface -> Browser, typedexample.comand pressed Enter. The address field cleared back to 'Search or enter URL', example.com appeared under 'Recently used', and no page loaded; clicking the listed local server localhost:7568 also did nothing. Control: I restored the two lines (Electron and the backend restarted with the fds) and ran the same steps: the tab loaded 'Example Domain' at https://example.com/. Failing test: apps/server/src/preview/ServerBrowser.test.ts, 'a server started without the desktop browser channel marks its tabs headless', runs ServerBrowser with the real DesktopBrowserChannel layer and no fds; on main the opened tab has headless undefined instead of true.Evidence
Real Linux Electron desktop under Xvfb, with both desktop browser channel fds omitted to simulate the WSL-only backend condition. Fresh synthetic data, light theme, identical 484×780 Browser-pane crops. Steps: open Browser from a new-thread view, type
example.com, press Enter; then click the listedlocalhost:7568server from a new-tab pane.Capture driver · Seed script · Synthetic local page · Observations
AI-assisted; verified with the tests and tools listed above.
Not shown:
Tests
cd apps/server && vp test run src/preview/ServerBrowser.test.ts src/preview/Manager.test.ts: 79/79 passed. With the fix stashed, the repro test fails with 'expected undefined to be true'. vp run check:changed: format, lint, knip, typecheck (3 packages) and tests (2 files) all passed.
Not in this change
AI-assisted; verified with the tests and tools listed above.