Repository navigation
fix(orcad): agent browser commands on an Orca server work like on the desktop - #47136
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
The installed sidecar has no workspace catalog, so its tab replies report worktreeId null. Project the worktree recorded at creation onto list, show, and profile-show results, including popups adopted from their opener.
- Electron sidecar: browser.grab.* RPC names, browser identity get/set served from the sidecar's own setting (advertised only when it has one on a kept profile) - External Chromium: cookie delete by name over a page CDP session, tab profile set to default is a no-op - This-device pages of an orcad host: tab profile set to default is a no-op; other profiles refuse with a sentence
4386896 to
c243fcc
Compare
Carries over #42737 by @eisen0419.
ELI5
On a remote Orca server (orcad), some browser commands an agent runs did less than they do on the desktop, or failed with a confusing error. Now they do the same thing, or refuse with a clear sentence.
What Changed
Before → after, for an agent on an orcad host:
tab list,tab currentandtab profile showon the server's own (Electron helper) tabs returnedworktreeId: null, though orcad knows which workspace each tab was opened for. They now report that workspace. This is fix(orcad): preserve workspace scope on Electron sidecar browser tabs #42737's fix, with its test trimmed to one invariant.cookie deletewas "not supported" when the server's browser is a plain Chromium (ORCA_BROWSER_EXECUTABLE). agent-browser has no delete-by-name command, so orcad now opens a short CDP session on the page (from agent-browser'sget cdp-url) and runs the desktop's owndeleteCookieByName. Same matching rules, same{ deleted }result.tab profile set --profile defaultfailed on pages the server shows on your desktop ("This device"), with "require the desktop Electron provider". These pages are always on the Default profile, so switching to it is now a no-op that succeeds, as on the desktop. Other profiles refuse: "Browser profile work was not found. Pages this server shows on your desktop use the Default profile." On plain Chromium,defaultis a no-op too.browser identity get/setsaid "Update or restart Orca" on orcad. orcad has no identity setting of its own; its Electron helper does. orcad now serves the helper's setting and advertisesbrowser.identity.v1only when the helper has the capability and runs on a kept profile. On a temporary profile, a saved mode would be deleted before the next launch. After a remoteset, the CLI says "restart Orca on that host".browserGrabSetModeand its siblings mapped tobrowser.grabSetModeand so on, which don't exist. They now map tobrowser.grab.*. orcad doesn't advertise grab yet, so nothing calls these today.Why
Each fix reuses the local behaviour instead of adding a remote copy:
deleteCookieByName;The alternative for cookie delete was
cookies set <name> "" --expires 1through agent-browser. But agent-browser'scookies getonly sees the current page's cookies, so--domainand--urldeletes for other hosts would silently miss.Supersedes #42741 by @6fmh, which projected the workspace onto tab rows but not onto
tab profile show. Its compact test shape is what the trimmed test uses.Linked Issue
#42718 is already closed. This finishes the
worktreeId: nullpart for the Electron helper tabs.Found in the remote browser parity audit (M38, M39, M40, NEW-a3, NEW-a7). Related to #42694, but this does not add attaching to an existing Chromium.
Visual Proof
N/A. Agent and CLI output only, no UI. Captured from a real orcad (
pnpm build:orcad) on macOS. Before is main at d6cc268, after is this branch.Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Real orcad on macOS, both engines. The installed app was the Electron helper. Plain Chromium was Playwright's Chrome for Testing under
ORCA_BROWSER_EXECUTABLE. Results are above. I re-ran the Electron helper checks after the last identity change.This-device
tab profile set: a hidden e2e desktop paired to orcad couldn't create desktop pages in my harness (browser_host_page_creation_timeout). That happens on main too, so it isn't from this change. The branch handles default and the refusal at the same point astab profile clone, and resolves the page the same way (resolveTargetClientPage, now shared).electron-sidecar-tab-registry.test.tsfails on main and passes here.pnpm check:changedpasses.Performance
None, because every change runs only when an agent calls these commands.
status.getadds two in-memory checks. Cookie delete opens one short-lived WebSocket per call and closes it.Risk
The riskiest part is the second CDP client for cookie delete on plain Chromium. It attaches to the page target next to agent-browser's own connection and closes in
finally. A failure there returns an error for that one command and doesn't touch agent-browser's session (verified: latercookie getcalls work).Mixed versions:
browser.identity.v1.A plain revert backs this out. An identity mode saved in the helper's profile stays on disk, which matches what a desktop does with its own setting.
Level: Low
AI Disclosure
Review
One review round, Codex and a Claude subagent. Codex found nothing.
Claude's P2: after a remote
identity set, "restart Orca" pointed at the wrong machine. Fixed: the CLI now says "restart Orca on that host".Claude's P3: grab watch and await would lose their stream and signal through the sidecar RPC. Left as is, because orcad never advertises grab, so nothing can reach it.
Not changed: the audit also suggested refusing
storage get/setkeys and values that start with--. I checked live: Orca sends typed commands to agent-browser as batch JSON on stdin, so--cdpand--sessionare stored as literal keys and never parsed as options. A refusal would only break real keys like--theme.Agent skill upstream boundary
Notes
wsagainst a loopback URL that agent-browser reports, with no platform paths.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)