Skip to content

fix(orcad): agent browser commands on an Orca server work like on the desktop - #47136

Merged
AmoabaKelvin merged 5 commits into
mainfrom
fix/orcad-agent-browser-verb-gaps
Nov 22, 2026
Merged

AmoabaKelvin merged 5 commits into
mainfrom
fix/orcad-agent-browser-verb-gaps

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

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.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​27 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​27
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​318 $\color{#cf222e}{\Huge{\mathbf{−}}}$​52 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​266

What Changed

Before → after, for an agent on an orcad host:

  • Tabs said they belonged to no workspace. tab list, tab current and tab profile show on the server's own (Electron helper) tabs returned worktreeId: 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 delete was "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's get cdp-url) and runs the desktop's own deleteCookieByName. Same matching rules, same { deleted } result.
  • tab profile set --profile default failed 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, default is a no-op too.
  • browser identity get/set said "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 advertises browser.identity.v1 only 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 remote set, the CLI says "restart Orca on that host".
  • Grab RPC names (latent): browserGrabSetMode and its siblings mapped to browser.grabSetMode and so on, which don't exist. They now map to browser.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:

  • workspace scope comes from the page record orcad already keeps;
  • cookie delete reuses deleteCookieByName;
  • identity forwards to the helper's own store and RPC.

The alternative for cookie delete was cookies set <name> "" --expires 1 through agent-browser. But agent-browser's cookies get only sees the current page's cookies, so --domain and --url deletes 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: null part 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.

# Electron helper engine, `tab create --worktree path:<repo> --headless` then:
before: tab list → "worktreeId": null          tab profile show → "worktreeId": null
after:  tab list → "worktreeId": "<repo-id>::<path>"   tab profile show → same

before: browser identity get → incompatible_runtime "The running Orca runtime does not support browser identity management…"
after:  browser identity get → {"identity":{"state":"missing","appliedMode":"native",…}}
        browser identity set --mode clean → restartRequired: true; after an orcad restart appliedMode is "clean"
        and an engine tab's navigator.userAgent has no Orca/Electron token

# External Chromium engine:
before: cookie delete --name a → browser_command_unavailable "browserCookieDelete is not supported by this browser provider."
after:  cookie delete --name a → {"deleted": true}, cookie get no longer lists it; --name zzz → {"deleted": false}
        httpOnly cookie via --url → {"deleted": true}; --domain=bad/domain → invalid_argument
before: tab profile set --profile default → browser_profile_unavailable
after:  tab profile set --profile default → {"profileId":"default","profileLabel":"Default"}; --profile work still refused

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 as tab profile clone, and resolves the page the same way (resolveTargetClientPage, now shared).

  • electron-sidecar-tab-registry.test.ts fails on main and passes here.

  • pnpm check:changed passes.

Performance

None, because every change runs only when an agent calls these commands. status.get adds 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: later cookie get calls work).

Mixed versions:

  • The CLI only calls identity when the host advertises browser.identity.v1.
  • An older installed app as the helper doesn't advertise it, so orcad doesn't either, and the old message stays.
  • An older orcad keeps today's refusals.
  • No wire shapes change.

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/set keys and values that start with --. I checked live: Orca sends typed commands to agent-browser as batch JSON on stdin, so --cdp and --session are stored as literal keys and never parsed as options. A refusal would only break real keys like --theme.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: the CDP client uses ws against a loopback URL that agent-browser reports, with no platform paths.
  • SSH and remote: this is the orcad path. The desktop and Electron serve still use their own identity store first.
  • Mobile: no change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The changes add runtime browser identity support through the local identity-mode store or an Electron sidecar. External Chromium gains page-scoped CDP cookie deletion and a response for the default profile. Sidecar tab and result rewriting now projects worktree IDs. Client page profile commands use shared page-resolution and profile metadata helpers.

Merge Risk: Minimal · up to c243f

This change brings several remote browser commands closer to desktop behavior: tab workspace reporting, cookie deletion on plain Chromium, default-profile handling, and identity get/set. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the orcad browser-command parity fix and matches the changeset, which makes Electron helper tabs report workspace IDs, adds CDP-based cookie delete on plain Chromium, handles default p…
Description check Passed The description follows the repository template and fills in ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, Review, Notes, and Checklist. Visual Proof gives before/af…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the orcad browser-command parity fix and matches the changeset, which makes Electron helper tabs report workspace IDs, adds CDP-based cookie delete on plain Chromium, handles default profile set, and forwards browser identity to the helper. It is a conventional-commit title and fits the main objective, though it does not name each sub-fix.

Full details: Description check

Explanation

The description follows the repository template and fills in ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, Review, Notes, and Checklist. Visual Proof gives before/after output from a real orcad. The AI Disclosure section is empty, but the template says to skip it for StablyAI team members, and the author does not say whether they are one. The Performance section and the Risk level are filled in. Some checklist items are unchecked, including the lint, typecheck, test, and build item. The Review section is also filled in.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent 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: f43ea0e7-1e18-4e57-98a0-692586d5541f
Commits

Reviewing files that changed from the base of the PR and between 4386896 and c243fcc.

Files selected for processing: 1

  • src/main/runtime/hosts/runtime-status.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

eisen0419 and others added 5 commits November 22, 2026 22:05
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants