Repository navigation
Conversation
Electron 43+ can leave embedded guest views with document.hasFocus() false even when Orca is frontmost, so Draft.js-style editors drop Input.insertText and execCommand. Enable Emulation.setFocusEmulationEnabled on debugger attach in CdpWsProxy and CdpBridge.
📝 WalkthroughWalkthroughAdds a shared helper for sending 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 700438d3-7e9d-419b-be1f-f9c0861a4457
📒 Files selected for processing (6)
src/main/browser/cdp-bridge.tssrc/main/browser/cdp-focus-emulation.test.tssrc/main/browser/cdp-focus-emulation.tssrc/main/browser/cdp-ws-proxy-focus-replay.test.tssrc/main/browser/cdp-ws-proxy.test.tssrc/main/browser/cdp-ws-proxy.ts
CodeRabbit: stalled debugger.sendCommand could hang agent-browser attach.
|
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 |
Summary
Fixes #10375: embedded automation guests can report
document.hasFocus() === false, causing CDP text input to no-op. CDP focus emulation is enabled on both bridge paths while preserving existing DOM-focus replay.Takeover / attribution
Original implementation and diagnosis by @innocarpe. I took over the PR after reproducing the shipped regression, centralized its 5 s best-effort timeout so direct CdpBridge attach cannot hang, and added bridge-path plus timeout regression tests.
ELI5
The page thinks it is not selected, so some editors ignore typing. We tell Chromium to treat the automation page as focused before sending text.
Fix proof
Live Orca 1.4.159-rc.1: active
https://httpbin.org/forms/postreturneddocument.hasFocus() = false; after clicking Customer name,orca type --input AAAreturned success but the input value remained empty. Commiteaf21cbb1fsendsEmulation.setFocusEmulationEnabled({ enabled: true })on both CDP attach paths.No-regression proof / trade-offs
Review loops
2 loops; final verdict: implementation clean after direct-bridge coverage and shared timeout. Remaining proof is a newly built app on non-macOS.
Tests
pnpm exec vitest run --config config/vitest.config.ts src/main/browser/cdp-focus-emulation.test.ts src/main/browser/cdp-bridge-integration.test.ts src/main/browser/cdp-ws-proxy.test.ts src/main/browser/cdp-ws-proxy-focus-replay.test.tspnpm run typecheck:nodegit diff --checkLinked issue
Fixes #10375.
Screenshots / evidence
No uploadable URL: Orca CLI captured the active browser viewport as in-memory PNG data, without a file path usable by
gh imageorgh attach. Command/evaluation evidence is recorded above and in the category report.