Repository navigation
Conversation
…s late A server tab decides once, at creation, whether to drive the desktop's page. If the desktop panel did not mount it within 10 seconds, it ran headless (isolated storage for agent tabs) and stayed that way after the desktop attached, so the panel showed the person's signed-in page while agents drove a signed-out one under the same tab id. On a late attach, drop the headless page and reconnect to the desktop's, keeping the session and telling stream viewers to reconnect. Fixes pingdotgg#17334 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Contributor
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — The fix is narrowly scoped and tested, but it changes late-attached agents from isolated browser storage to the user's desktop page and existing sign-in state. That authentication-sensitive session handoff warrants human review. You can add or adjust custom eligibility rules. Learn more. |
Open
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #17334
Problem
A server preview tab decides once, in
createTab, whether to drive the desktop's page. It waitsDESKTOP_ATTACH_TIMEOUT(10s) for the desktop to attach. If the Browser panel isn't showing that thread in time, the tab runs headless, and for an agent-owned tab that means an isolated context. When the user later opens the panel, the desktop mounts its own<webview>for the same tab id and sendsattached. Nothing inServerBrowserlistens for that, so the tab never switches over:preview_statusreportsvisible: false.Both show the same tab id and URL. Screenshots and tool output are in the issue.
Fix
DesktopBrowserChannelexposes anattachedstream next todetached.ServerBrowsersubscribes to it. When the desktop attaches a tab that is running headless, including one still being created when the attach arrives, it drops the headless page and reconnects throughfindTab.createTabthen sees the tab attached and connects to the desktop's page. The preview session, tab id, and automation owner are unchanged.dropTabtakes ahandOffflag, so streaming viewers of the dropped headless page getreconnectinstead ofgone. This matches the existing detach path.Agent state in the old isolated context is discarded. Its only effect was the split this PR removes.
Verification
an agent tab that started headless moves to the desktop's page once it mountsinapps/server/src/preview/ServerBrowser.test.ts. An agent opens a tab with no desktop attached (headless), then the fake desktop emitsattached. The test asserts that viewers getreconnect, the server connects to the desktop endpoint, the headless context closes, and the agent still reaches the sametabIdwithout a new headless context.vp test run src/preview/ServerBrowser.test.tspasses (24/24), as do theDesktopBrowserChanneltests.vp run typecheckinapps/serverexits 0.vp lintandvp fmton the changed files are clean.Surfaces: server only. Web and desktop already render the tab natively. This change makes the server's automation follow that page. Mobile, web-only, and remote clients don't attach desktop pages, so the new stream is empty for them.
Model/harness: Claude Opus 5.5 (claude-opus-5-5) via Claude Code in T3 Code.
🤖 Generated with Claude Code