Note
Grok responding on behalf of Julius.
Thanks for the precise repro and timeline. Confirmed in code on main (f570bd21).
What happens
- Fallback after 10s. On a desktop-launched server, a new server tab waits for the desktop's
<webview>to attach (DESKTOP_ATTACH_TIMEOUT = "10 seconds",desktopRenders). If nothing attaches in time,createTabopens its own headless page. Because the agent'spreview_opensetsautomationOwner, that page gets an isolated per-tab context with fresh storage. That's why your sign-in in the panel never reached the agent. Only this headless path sets a fixed viewport (L761-L763,UNATTACHED_FILL_VIEWPORT= 1280×800), so that's theviewportfield you saw. - Why the desktop doesn't attach for a background thread.
ElectronBrowserHostmounts webviews only for threads that have sessions in the client preview store (activePreviewSessionsAtom). Onmain, that store is filled byusePreviewSession, which runs only for the active thread (PreviewSessionSyncinChatView) and in its preview panel. A tab the agent opens on a thread you aren't viewing gets no webview until you come back, which is long after the 10s wait. - Nothing reconciles a late attach. The desktop channel records and publishes
attachedevents (DesktopBrowserChannel.tsL123-L125). ButServerBrowseronly usesawaitAttachedonce, while creating the tab, and otherwise subscribes only todetached. After the tab exists,ensureTabkeeps returning the headless tab. Meanwhile the client decides "native webview vs. stream" only by environment and runtime (rendersServerTabNatively). It never learns that the server fell back to headless, so it mounts its own webview, which loads the URL independently, and the agent can't see it.preview_statusalso doesn't say which page backs the tab:visibleonly counts viewers.
Fix direction
- Open PR #16620 removes the main trigger. A persistent desktop-side subscription hydrates
ElectronBrowserHostfrompreview.list/events, so background threads' tabs get a webview while the server is still waiting. - #16620 doesn't change
ServerBrowserat all, though. Any attach that lands after the 10s timeout, such as from a renderer that isn't ready yet, still produces the same split, with no swap and no signal. To close that gap,ServerBrowserneeds to handle lateattachedevents for tabs that are running headless. It could switch the client to the stream view for those tabs, or move the tab onto the desktop page. Either way, the snapshot orpreview_statusshould say which page backs the tab.
Workaround
Stay on the thread while the agent opens a new browser tab. A tab that has already split stays split for its lifetime, so have the agent open a fresh tab while you're on the thread, and use that one.
Related but distinct: #16701 (default profile, handing human tabs to agents), #16596 (Cloudflare on the headless page), #14171 (agent pinned to another desktop's copy of a tab).