Repository navigation
fix(browser): an agent's next command after tab create uses its new tab, not the user's This-device page - #41953
Conversation
…user's This-device page Pageless agent commands prefer the workspace's active client page, and creating an offscreen or renderer tab never cleared it, so the next command after `orca tab create` acted on the user's page. Yield client selection wherever a create moves the bridge's active tab, as orcad already does.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
On a server set to "This device", an agent that opened a new browser tab and then ran its next command (a snapshot, a click) without naming a page got the user's page instead of its own. Now the agent's new tab becomes the one its next command uses, the same way it already worked on Linux servers.
What Changed
orca serve, the user has a This-device tab open in a workspace. An agent runsorca tab create --url …and thenorca snapshot. The snapshot reads the user's page, andtab currentreports the user's page.tab currentboth report the agent's new tab. The user's page stays open and listed.runtime-browser-client-automation.ts). Creating a server tab moved the agent's routing to the new tab but never cleared that This-device selection.publishCreatedBrowserSessionTabalready decides when a create takes the agent's routing. It now clears the This-device selection in that same place, for the offscreen (headless serve) and renderer paths. It clears only when the create actually activated the new tab and starts active. It clears before the bridge publishes, so paired clients get the cleared row in the same update.yieldSelection(workspaceId)method. The tab-switch path and orcad'syieldClientPageSelectionnow use it instead of their own copies.Why
orcad already takes the selection on create (
orcad-client-page-commands.ts,yieldClientPageSelection), andtab switchalready does on Electron serve. Only Electron serve's create skipped it. Moving the clear into the publication step, next to the bridge activation it has to follow, keeps the two selections changing together instead of adding a second rule elsewhere.Not changed:
activate: falsecreates don't take the selection.Linked Issue
Part of #41682: this PR fixes the part where an agent's next command after
tab createhits the user's This-device page. The rest of #41682 is not fixed here: invisible agent tabs on Linux servers, popups, large screenshots, streamed dialogs, and input. The follow-up PR places agent tabs on the paired desktop.Related to #35156. This PR does not change the server-to-desktop tab visibility half; the follow-up PR covers it.
Visual Proof
N/A, there's no UI change. The proof is from a real paired setup: a headless Electron
orca serveand a hidden paired desktop on "This device", with commands sent through the server's local socket as an agent (local-cli). The user opens/useras a This-device tab, then the agent runsbrowser.tabCreate /agent,browser.tabCurrentand a pagelessbrowser.snapshot.tab current/agentactive/useractive/userTesting
One test in
orca-runtime-browser.test.tscreates a server tab while a This-device page is active. It checks that the workspace has no active client page afterwards, which is the value pageless routing reads. With the yield reverted, it fails with the user's page still active.pnpm check:changedpasses (the related unit tests ran 27 min under the machine's queue, all green).Risk
Level: Low
What could change for users: a person who opens a streamed server tab while an agent is using a This-device page now moves the agent's pageless commands to the new tab. That is how a This-device create or switch already behaves, and how orcad already behaves. A hold for a person's pick on client pages, like #36108's for bridge tabs, is separate work. Older paired desktops and phones aren't affected because no wire format changes. A plain revert backs it out.
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)