Repository navigation
feat(browser): let agents drive sign-in and payment popups as pages - #36253
Conversation
|
No actionable comments were generated in the recent review.
|
8d32975 to
f96d802
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Minor · Preserve the immediate opener for nested popup handoff. · browser-manager-queries.ts:64-88
src/main/browser/browser-manager-queries.ts:64-88
Minor · Functional Correctness · Quick win Preserve the immediate opener for nested popup handoff.
When popup A opens popup B, B inherits the root tab's
PopupOwnerContext.getPopupPages()therefore publishes the root tab as B'sopenerBrowserPageId. When B closes,watchPopupClose()retargets the agent and callshandOverAgentActivity()with that root ID, so the agent skips live popup A.Keep the root tab for workspace/profile ownership and nested listing. Store the immediate opener separately and use it for
openerBrowserPageIdand close handoff. Preserve separate root-owner metadata for sidecar adoption so B remains listable even when A is enumerated later.

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
cc44475e-4a94-410d-98db-b4d175af5cd0
Files selected for processing: 6-
skill-guides/orca-cli/references/browser.mdsrc/cli/bundled-skill-guides.tssrc/main/browser/agent-browser-bridge-lifecycle.tssrc/main/browser/agent-browser-bridge-state.tssrc/main/browser/agent-browser-bridge-tabs.tssrc/main/runtime/browser/browser-command-targets.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
-
| // The renderer never registers popups, so waking it for a closed one only stalls. | ||
| if ( | ||
| bridge && | ||
| browserPopupPageWebContentsId(browserPageId) === null && |
There was a problem hiding this comment.
Use collision-aware popup detection.
browserPopupPageWebContentsId() treats every popup-<positive integer> string as a popup. The browser manager also permits a regular tab to keep a popup-shaped ID. If that regular tab is persisted but unmounted, this condition skips ensureBrowserPageActive(). The bridge can then return browser_tab_not_found instead of remounting the regular tab. Use collision-aware popup classification so regular tabs with popup-shaped IDs still activate. (raw.githubusercontent.com)
…ages window.open popups that keep their opener stay native windows, but the agent bridge now lists each one in tab list as popup-<n> with its opener, so --page, tab switch and tab close reach it. When a popup the agent switched into closes, its next command lands on the opener.
…d by implicit tab close
…'s claim when a popup hands back
…close after the popup is gone
…ep tabs under its line cap
f96d802 to
812c441
Compare
ELI5
When a page opens a sign-in or payment popup, the person sees it, but an agent driving Orca's browser could not:
tab listshowed only the original tab and no command could reach the popup, so OAuth flows stalled until someone clicked through by hand. Now each popup shows up intab listnext to the tab that opened it, the agent can snapshot, fill and click in it with--page popup-<n>, and when the popup closes itself the agent carries on in the tab that opened it. The popup window looks and works exactly as before for the person.What Changed
Before:
window.openwith features (OAuth, payment) creates a native child window that keepswindow.opener. Its webContents was tracked only as "owned by tab X" (popupOwnerContextByGuestIdand the route-guest popup registry), so the agent bridge's page registry, which backstab list,--page,tab switchandtab close, never contained it.After:
BrowserManager.getPopupPages()lists live popups as pagespopup-<webContentsId>owned by their opener tab. Workspace, profile and load errors for a popup id resolve through the owner. A tab created with a popup-shaped id keeps it.getRegisteredTabsandtab list(withopenerBrowserPageId). All--pagecommands,tab switch,tab showandtab closetherefore work on popups unchanged.Clicked, not "Tab was closed".tab closeon a popup (by page, index or the routed default) closes its window and returns once it is gone.orca-clibrowser guide tells agents to checktab listwhen a click seems to do nothing.Why
Three ways to reach popups were considered; the coordinator picked the first:
tab listbefore and after an action.window.opener. That needs webview tabs to adopt an existing webContents, a large renderer change that also alters the person's sign-in UX.The fix sits at the owner of popup ownership (BrowserManager) and the owner of agent page routing (the bridge), so local, SSH-routed, client-hosted and sidecar paths share one mechanism.
Linked Issue
Fixes #12718
Fixes #19159
#7034 (closed) asked for
Target.createTargetthrough the CDP proxy. This PR does not add that; tabs are still created withorca tab create.Visual Proof
The browser UI does not change: popups open in the same window with the same origin bar. The behaviour change is in the agent CLI, so here are transcripts from a hidden dev build against a local fixture (an opener page with a "Sign in with Popup" button whose popup posts the username back to
window.openerand callswindow.close()on Approve).Before (main):
The popup existed (CDP showed
page http://127.0.0.1:8792/auth.html Auth Provider), but nothing could address it.After (this branch):
Testing
ORCA_BACKGROUND_LAUNCH=1, own CDP port and profile):--pagedriving, screenshot of the hidden popup,window.openerintact, self-close via Approve,tab switchinto the popup then self-close (3 runs),tab closeby page and by default target with the opener not first, an immediate no-page command aftertab close, and a command against an already-closed popup (instant not-found). Noorca-tab-popup-*agent-browser daemons were left behind.--pagerouting; switch in, the in-flight Approve click still resolves, the agent lands on the opener despite a held person pick, and the session closes;check:code-quality:changedandcheck:react-doctor:changed. Linux, Windows and a real SSH host were not run by hand; CI covers the suites.To try (worktree
/Users/kelvinamoaba/orca/workspaces/orca/browser-popups-for-agents, dev build):window.open(url, 'auth', 'width=500,height=600')button in an Orca tab, thenorca click --element <ref>on it.orca tab listshowspopup-<n> … (popup opened by <tab>);orca snapshot --page popup-<n>, then fill and click inside it.window.close(), then runorca snapshotwith no--page: it lands on the opener.AI Disclosure
Review
Four review rounds with Codex and Claude. Accepted and fixed: SSH
--page popup-<n>scope, Electron-sidecar adoption/order/hand-back, implicittab close, popup load errors, popup-shaped tab id collisions, the 8s wake-up stall, the held-pick hand-over and its idle refresh, andtab closesettling before it returns. Left as is: after a routed popup closes itself over the Electron sidecar, the first command without--pagecan return not-found once before landing on the opener, because orcad pins the last active page; pointer and focus-guard calls for a popup resolve to the opener's pane, which is cosmetic.Agent skill upstream boundary
Notes
openerBrowserPageIdis an optional result field, so older CLIs simply list popups as extra tabs and newer CLIs against an older desktop see no popups.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)