Repository navigation
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (24)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds a main-process request-response flow for browser guest keyboard focus. The renderer focuses the webview that matches the guest ID and returns whether it became active. Keypress handling requests focus before CDP dispatch or the agent-browser fallback. A not-on-screen result prevents dispatch. An unanswered result allows dispatch. Unit and end-to-end tests cover the request lifecycle and keypress behavior. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The change focuses browser guests before sending keys and blocks dispatch when focus is explicitly rejected. No concrete merge-blocking defect is established; the headful tests' execution and guest field-focus preservation remain unverified. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change checks focus before sending keys and restricts who can answer that check. No new security vulnerability was established, but caller permissions and behavior during simultaneous focus changes remain only partly verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the user-facing problem, the fix, and limited testing details. It omits most required template sections, including the linked issue, visual proof or an explicit N/A reason, review notes, upstream-boundary declaration, cross-platform and compatibility considerations, checklist status, and complete testing details. Resolution Complete the required template sections. Add the linked issue, provide visual proof or state N/A with a reason, document review and security/performance/cross-platform/SSH considerations, complete the Agent skill upstream boundary section, and report the required test and checklist status.
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 |
|
There was a problem hiding this comment.
Important
The fix targets the right symptom, but native webContents.focus() is known in this codebase to blur a DOM element focused by a prior command — that is exactly why CdpDomFocusReplay exists — and neither new focus call replays it. Please verify fill/focus → keypress Enter on a real page before merging.
Reviewed changes
- Focus before the direct key dispatch —
keypressnow callswc.focus()after acquiring the debugger lease and before the twoInput.dispatchKeyEventcalls. - Focus before the helper fallback — the unmapped-key branch focuses the guest webContents before handing
pressto agent-browser. - Two unit tests — assert
focusruns once and before the dispatch/helper call for a mapped (Escape) and an unmapped (MediaPlayPause) key.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
webContents.focus() on a guest does not move focus in the embedder's tree, and CDP key events go to whichever widget holds that focus, so keys still landed in Orca's own UI. Main now asks the renderer to focus the <webview> hosting the guest and waits for its answer; a page that cannot take focus fails the keypress instead of typing into Orca.
| // Why: a key sent to an unfocused guest lands in whatever the Orca window has focused, | ||
| // usually a terminal, so the agent that ran keypress types into its own PTY. | ||
| private async focusGuestForKeys(wc: Electron.WebContents, browserPageId: string): Promise<void> { | ||
| if ((await requestBrowserGuestKeyboardFocus(wc)) === 'not-on-screen') { |
There was a problem hiding this comment.
| const ref = | ||
| refs !== null && typeof refs === 'object' | ||
| ? Object.entries(refs).find(([, entry]) => readProperty(entry, 'role') === 'textbox')?.[0] | ||
| : undefined | ||
| if (!ref) { | ||
| throw new Error(`No textbox ref in snapshot: ${JSON.stringify(snapshot)}`) | ||
| } | ||
| return `@${ref}` |
There was a problem hiding this comment.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The delta since the prior pullfrog review (02547a8a) replaced the direct native focus call with a renderer round-trip, so I re-reviewed the focus protocol, the bridge wiring, and the new regression tests.
- Replaced native
webContents.focus()with a renderer round-trip — main now asksguest.hostWebContentsto focus the<webview>hosting the guest and waits for its answer (browser:guest-keyboard-focus-requested/browser:respondGuestKeyboardFocus), which moves focus in the embedder's tree rather than only on the guest. - Added explicit handling for a page that cannot take focus —
focusGuestForKeysthrowsbrowser_errorwith atab switch --page … --focushint when the embedder answersnot-on-screen; an unanswered request still dispatches. - Added the shared protocol and preload surface — request/response types,
BrowserApimethods, a trusted-rendereripcMainhandler, and the new channel added to the preview-tool authorization classification. - Added unit and headful e2e coverage — focus-module and renderer-helper unit tests, bridge ordering/refusal tests, fixture and lifecycle updates, and
tests/e2e/browser-keypress-focus.spec.ts, which assertsfill/focus→keypresskeeps the field active and leaks no keys to the host.
This resolves the prior review's concern: the field a prior fill/focus targeted is no longer blurred, and the new e2e spec pins both that and the terminal-leak fix.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Closing this one as superseded. Thank you for it. The fix for agent browser input and the user's keyboard focus (#20595) landed in #28452, #28453 and #28454, and this PR's investigation helped shape it. What landed:
The design and measurements are in |

orca keypress --pagetyped into whichever Orca pane had focus, usually the terminal that ran it, because the page itself was never focused. It now focuses the page before sending the key, the same wayorca clickdoes.Tested: two new keypress unit tests, bridge suite passes.
AI disclosure: written with Claude (Opus 5.5).