orca icon indicating copy to clipboard operation
orca copied to clipboard

Keep embedded browser commands on the registered Orca target

Open OrcaWin opened this issue 4 months ago â€ĸ 1 comments

Summary

  • make registered Electron webContents authoritative for embedded browser navigation and evaluation
  • reassert the Orca CDP proxy on every helper-backed command so stale helper sessions cannot launch or control external Chrome
  • fail closed on destroyed targets, stale debugger state, and helper-session cleanup failures

Reproduction

A deterministic fake registers an Orca Electron webContents, initializes the helper, marks its session stale, and records helper calls without --cdp. Before this fix, goto and evaluate each produced one wrong-owner call:

--session orca-tab-tab-1 goto https://embedded.example/next --json
--session orca-tab-tab-1 eval document.title --json

The regression harness now proves both commands remain on the registered embedded target without launching a real browser.

Validation

  • real Electron E2E: create an actual embedded webview, initialize and terminate its real helper daemon, arm an external-launch sentinel, then verify browser.goto and browser.eval update the visible webview without launching the sentinel or recreating the helper
  • browser slice: 28 files, 501 tests
  • bridge suite: 95 tests
  • full TypeScript typecheck
  • touched-file oxlint
  • reliability gates
  • max-lines ratchet
  • git diff --check

Fixes #9510

OrcaWin avatar Jul 21 '26 00:07 OrcaWin

Review Change Stack

No actionable comments were generated in the recent review. 🎉

â„šī¸ Recent review info
âš™ī¸ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5454c750-8516-4661-9a10-f26d11e6be2f

đŸ“Ĩ Commits

Reviewing files that changed from the base of the PR and between 71ffc0ccb72c93a0af32d97e7d7b86f0b2512ef6 and 6b32a4cb5a976b12b2298621aeac5489cc81b63f.

📒 Files selected for processing (3)
  • src/main/browser/agent-browser-bridge.test.ts
  • src/main/browser/agent-browser-bridge.ts
  • tests/e2e/browser-embedded-owner-routing.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/browser/agent-browser-bridge.ts
  • src/main/browser/agent-browser-bridge.test.ts

📝 Walkthrough

Walkthrough

The bridge now routes goto through WebContents.loadURL() and evaluate through Electron CDP, with URL validation, timeouts, target replacement handling, debugger cleanup, and structured errors. Stale agent-browser ownership failures now reject explicitly, and helper commands consistently include embedded CDP arguments. Browser error types and inline synchronization comments were updated, with expanded tests covering direct commands, lifecycle changes, ownership, and subprocess behavior.

đŸšĨ Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check âš ī¸ Warning The description covers summary, reproduction, and validation, but omits required screenshots, AI review, security audit, and notes sections. Add the missing template sections: Screenshots, AI Review Report, Security Audit, and Notes, or mark non-applicable items explicitly.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: keeping embedded browser commands on the registered target.
Linked Issues check ✅ Passed The PR implements the #9510 requirements by routing goto/evaluate through the registered webContents and adding regression coverage.
Out of Scope Changes check ✅ Passed The changes stay focused on embedded-browser routing, helper cleanup, tests, and related type/error updates with no clear unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • [ ] Create stacked PR
  • [ ] Commit on current branch

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

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Jul 21 '26 00:07 coderabbitai[bot]