Keep embedded browser commands on the registered Orca target
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.gotoandbrowser.evalupdate 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
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.tssrc/main/browser/agent-browser-bridge.tstests/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.
Comment @coderabbitai help to get the list of available commands.