Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis change adds host-generated browser-page publication waiting, bounded refresh retries, pairing-revision validation, and publication fault injection. It adds direct CDP mouse, wheel, keyboard, and history operations with legacy fallbacks. Remote browser panes now support pointer gestures, queued-input invalidation, viewport recovery, and synchronized stream state. Screencast capture rejects invalid dimensions and malformed images. Tests and reliability gates cover mixed-version browser creation, input, lifecycle, and viewport behavior. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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: 5
🧹 Nitpick comments (5)
src/renderer/src/components/browser-pane/remote-browser-legacy-input.test.ts (1)
102-114: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd caret-movement coverage, including Shift-extended selection.
The suite covers insertion, cancellation, select-all, Tab focus, and keyup balance. It does not cover the
ArrowLeft,ArrowRight,Home, andEndbranches. That gap is why the reversedsetSelectionRangearguments inmoveCaretare unguarded. See the related comment onremote-browser-legacy-input.tslines 79-83.Add a test that sets a collapsed caret, sends
Shift+ArrowLeft, and asserts thatselectionStartandselectionEnddescribe a one-character selection.src/renderer/src/components/browser-pane/BrowserPane.tsx (2)
1785-1797: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDerive
isDragfrom one source.
getRemoteBrowserPointerCommandsalready callsisRemoteBrowserPointerDraginternally. Line 1793 repeats that call with the same arguments. The branch decision now exists in two places, so a future change to the threshold semantics can make them disagree.Return both values from the helper, or derive the flag from the returned command shape.
♻️ Proposed refactor using a single derivation
In
remote-browser-pointer-gesture.ts, return the flag alongside the commands:export function getRemoteBrowserPointerCommands( start: RemoteBrowserPointerSample, end: Pick<RemoteBrowserPointerSample, 'pointerId' | 'x' | 'y'> -): RemoteBrowserPointerCommand[] | null { +): { isDrag: boolean; commands: RemoteBrowserPointerCommand[] } | null { if (start.pointerId !== end.pointerId) { return null } const isDrag = isRemoteBrowserPointerDrag(start, end) if (!isDrag) { - return [ - { - method: 'browser.mouseClick', - params: { - x: end.x, - y: end.y, - button: start.button, - modifiers: start.modifiers - } - } - ] + return { + isDrag, + commands: [ + { + method: 'browser.mouseClick', + params: { x: end.x, y: end.y, button: start.button, modifiers: start.modifiers } + } + ] + } } - return [ - { method: 'browser.mouseMove', params: { x: start.x, y: start.y } }, - { method: 'browser.mouseDown', params: { button: start.button } }, - { method: 'browser.mouseMove', params: { x: end.x, y: end.y } }, - { method: 'browser.mouseUp', params: { button: start.button } } - ] + return { + isDrag, + commands: [ + { method: 'browser.mouseMove', params: { x: start.x, y: start.y } }, + { method: 'browser.mouseDown', params: { button: start.button } }, + { method: 'browser.mouseMove', params: { x: end.x, y: end.y } }, + { method: 'browser.mouseUp', params: { button: start.button } } + ] + } }Then in
BrowserPane.tsx:- const commands = getRemoteBrowserPointerCommands(pending.sample, { + const gesture = getRemoteBrowserPointerCommands(pending.sample, { pointerId: event.pointerId, x: point.x, y: point.y }) - if (!commands) { + if (!gesture) { return } - const isDrag = isRemoteBrowserPointerDrag(pending.sample, { - pointerId: event.pointerId, - x: point.x, - y: point.y - }) + const { commands, isDrag } = gestureDrop the now-unused
isRemoteBrowserPointerDragimport.
1815-1823: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRoute the new pane-notice strings through
translate(). Both sites add new user-visible text that bypasses the localization pipeline this file uses elsewhere. Some neighboring pane notices in this file are also untranslated, so treat this as the scope decision for new strings rather than a full cleanup of the file.
src/renderer/src/components/browser-pane/BrowserPane.tsx#L1815-L1823: wrap'Drag input requires updating the paired runtime.'intranslate()with a generated key.src/renderer/src/components/browser-pane/BrowserPane.tsx#L1963-L1967: wrap'This keyboard shortcut requires updating the paired runtime.'intranslate()with a generated key.Generate each key as the first 10 characters of the SHA-1 hash of
<filePath>:<text>, matchinglocalize-renderer-strings.mjs.Based on learnings, "In the stablyai/orca renderer localization workflow, generate locale keys as the first 10 characters of the SHA-1 hash of
<filePath>:<text>, matchinglocalize-renderer-strings.mjs."Source: Learnings
src/renderer/src/components/browser-pane/use-remote-browser-stream-activation.ts (1)
8-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake
clearPendingRemoteInputrequired.
clearPendingRemoteWheelis required butclearPendingRemoteInputis optional, although both cancel pending input on stream close. The only caller always supplies it, and the test harness always supplies it. An optional callback lets a future caller omit it and silently restore the queued-input leak this change fixes.Make the property required and drop the optional call at line 35.
♻️ Proposed change to enforce the contract
- clearPendingRemoteInput?: () => void + clearPendingRemoteInput: () => void clearPendingRemoteWheel: () => voidreturn () => { closeStream() - clearPendingRemoteInput?.() + clearPendingRemoteInput() clearPendingRemoteWheel() }tests/e2e/paired-remote-browser-legacy-input.spec.ts (1)
89-89: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winImport the capability constant instead of hardcoding the string.
The production code imports
BROWSER_DIRECT_RAW_INPUT_RUNTIME_CAPABILITYfromsrc/shared/protocol-version. This assertion hardcodes'browser.direct-raw-input.v1'. If the constant value changes, a renamed capability is also absent fromstatus.capabilities, so this assertion still passes and the test silently stops verifying its precondition.Import the shared constant so the precondition tracks the production value.
♻️ Proposed change to bind the assertion to the shared constant
import { launchPairedElectronClient, type PairedElectronClient } from './helpers/paired-electron-client' +import { BROWSER_DIRECT_RAW_INPUT_RUNTIME_CAPABILITY } from '../../src/shared/protocol-version'- expect(status.capabilities).not.toContain('browser.direct-raw-input.v1') + expect(status.capabilities).not.toContain(BROWSER_DIRECT_RAW_INPUT_RUNTIME_CAPABILITY)Run the following script to confirm the constant name, its value, and the correct import specifier from
tests/e2e:#!/bin/bash # Description: Verify the capability constant and how other E2E specs import from src/shared. set -uo pipefail echo '--- Capability constant definition ---' fd -t f 'protocol-version.ts' --exec grep -nE 'DIRECT_RAW_INPUT|direct-raw-input' {} \; echo '--- Hardcoded capability string occurrences ---' rg -n 'browser\.direct-raw-input\.v1' -g '!**/node_modules/**' echo '--- How existing E2E specs import from src/shared ---' rg -n "from '(\.\./)+src/shared/" tests/e2e -g '*.ts' | head -30 echo '--- tsconfig path aliases available to tests ---' fd -t f 'tsconfig*.json' -d 2 --exec sh -c 'echo "=== {} ==="; jq -r ".compilerOptions.paths // empty, .include // empty" {} 2>/dev/null'
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 86ae4d09-1a74-4149-832c-aeab47ed2ad7
📒 Files selected for processing (22)
src/main/browser/agent-browser-bridge-command-transport.test.tssrc/main/browser/agent-browser-bridge-mouse-input.test.tssrc/main/browser/agent-browser-bridge.tssrc/main/browser/agent-browser-direct-input.test.tssrc/main/browser/agent-browser-direct-input.tssrc/main/browser/cdp-bridge.tssrc/main/browser/cdp-keypress.test.tssrc/main/browser/cdp-keypress.tssrc/main/browser/offscreen-browser-backend.tssrc/main/index.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/components/browser-pane/BrowserPane.tsxsrc/renderer/src/components/browser-pane/remote-browser-legacy-input.test.tssrc/renderer/src/components/browser-pane/remote-browser-legacy-input.tssrc/renderer/src/components/browser-pane/remote-browser-pointer-gesture.test.tssrc/renderer/src/components/browser-pane/remote-browser-pointer-gesture.tssrc/renderer/src/components/browser-pane/use-remote-browser-stream-activation.test.tssrc/renderer/src/components/browser-pane/use-remote-browser-stream-activation.tssrc/shared/protocol-version.tstests/e2e/helpers/headless-paired-runtime-host.tstests/e2e/paired-remote-browser-legacy-input.spec.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 6 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/browser-pane/BrowserPane.tsx (1)
1850-1861: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winSet
pressedButtonbeforebrowser.mouseDownis awaited.If
browser.mouseDownreaches the host but its RPC rejects or times out, Line 1857 does not run. The catch block then skips the recoverybrowser.mouseUp. The remote page can retain a pressed mouse button.Proposed fix
for (const command of commands) { + if (command.method === 'browser.mouseDown') { + pressedButton = command.params.button + } await callRuntimeRpc( pending.target, command.method, { worktree: pending.worktree, page: pending.pageId, ...command.params }, { timeoutMs: 15_000, suppressFeatureInteraction: true } ) - if (command.method === 'browser.mouseDown') { - pressedButton = command.params.button - } else if (command.method === 'browser.mouseUp') { + if (command.method === 'browser.mouseUp') { pressedButton = null } }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5ba7e5cb-cab1-43af-81ec-d94d02cfadb3
📒 Files selected for processing (18)
config/reliability-gates.jsoncsrc/main/browser/agent-browser-bridge-mouse-input.test.tssrc/main/browser/agent-browser-bridge.tssrc/main/browser/browser-history-navigation.test.tssrc/main/browser/browser-history-navigation.tssrc/main/browser/browser-screencast-host-surface-capture.test.tssrc/main/browser/browser-screencast-snapshot-capture.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/components/browser-pane/BrowserPane.tsxsrc/renderer/src/components/browser-pane/remote-browser-frame-point.test.tssrc/renderer/src/components/browser-pane/remote-browser-frame-point.tssrc/renderer/src/components/browser-pane/remote-browser-frame-style.test.tssrc/renderer/src/components/browser-pane/remote-browser-frame-style.tssrc/renderer/src/components/browser-pane/remote-browser-legacy-input.test.tssrc/renderer/src/components/browser-pane/remote-browser-legacy-input.tssrc/shared/protocol-version.tstests/e2e/paired-remote-browser-legacy-input.spec.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/shared/protocol-version.ts
- src/main/runtime/orca-runtime.test.ts
- tests/e2e/paired-remote-browser-legacy-input.spec.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 7 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/renderer/src/components/browser-pane/BrowserPane.tsx (2)
1994-2012: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winTreat an unresolved direct-input capability as unknown for keypresses.
remoteDirectRawInputSupportedstarts asnulland staysnullwhile the probe in the effect at Line 1039 runs. During that window this branch selects the legacy path.buildLegacyRemoteBrowserKeypressExpressionreturnsnullfor most modified shortcuts, so the pane throws "This keyboard shortcut requires updating the paired runtime." on a runtime that does support direct input.Resolve the capability before selecting the path, as the drag path already does at Line 1836.
🐛 Proposed fix to resolve the capability first
enqueueRemoteInput(async () => { if (!isCurrentRemoteOperationToken(operationToken)) { return } + let directInputSupported = remoteDirectRawInputSupported + if (directInputSupported === null) { + try { + directInputSupported = await runtimeEnvironmentSupportsCapability( + target.environmentId, + BROWSER_DIRECT_RAW_INPUT_RUNTIME_CAPABILITY + ) + } catch { + directInputSupported = false + } + } try { - if (remoteDirectRawInputSupported) { + if (directInputSupported) {
2002-2005: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winRoute this user-facing message through
translate.This PR localizes the equivalent drag message at Line 1850. This keyboard fallback message stays a hardcoded English literal, so it renders untranslated.
🌐 Proposed fix
- throw new Error('This keyboard shortcut requires updating the paired runtime.') + throw new Error( + translate( + 'auto.components.browser.pane.BrowserPane.legacyKeypressUpdateRequired', + 'This keyboard shortcut requires updating the paired runtime.' + ) + )Add the matching key to
src/renderer/src/i18n/locales/en.json.
🧹 Nitpick comments (2)
src/renderer/src/components/browser-pane/remote-browser-pointer-gesture.test.ts (1)
48-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winType
commandasRemoteBrowserPointerCommandin the standalone mock. The web config setsnoImplicitAnytofalse, andvi.fnleaves the parameter asany, socommand.methodis not type-checked.src/main/runtime/orca-runtime.test.ts (1)
34899-34953: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winWait for the
readyevent before asserting the first send.
REMOTE_BROWSER_STARTUP_FRAME_RETRY_MSis 50 ms, so the timer advance matches the runtime. Replace the two fixed microtask waits with a wait for the observablereadyemission before assertingsendBinary.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d9bbda36-62aa-4e79-bbb9-4029fa1d96d3
📒 Files selected for processing (46)
config/reliability-gates.jsoncsrc/main/browser/agent-browser-bridge-mouse-input.test.tssrc/main/browser/agent-browser-bridge.tssrc/main/browser/browser-history-navigation.test.tssrc/main/browser/browser-history-navigation.tssrc/main/browser/browser-manager-guest-lifecycle.test.tssrc/main/browser/browser-manager.tssrc/main/browser/browser-screencast-cdp-events.tssrc/main/browser/browser-screencast-device-metrics.tssrc/main/browser/browser-screencast-host-surface-capture.test.tssrc/main/browser/browser-screencast-lifecycle.test.tssrc/main/browser/browser-screencast-snapshot-capture.tssrc/main/browser/browser-screencast-snapshot-scaling.test.tssrc/main/browser/browser-screencast-stream-types.tssrc/main/browser/browser-screencast-stream.test.tssrc/main/browser/browser-screencast-stream.tssrc/main/browser/cdp-keypress.test.tssrc/main/browser/cdp-keypress.tssrc/main/browser/offscreen-browser-backend-lifecycle.test.tssrc/main/browser/offscreen-browser-backend.tssrc/main/runtime/orca-runtime-browser-screencast-fanout.test.tssrc/main/runtime/orca-runtime-browser.test.tssrc/main/runtime/orca-runtime-browser.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/remote-browser-screencast-frame-admission.test.tssrc/renderer/src/components/browser-pane/BrowserPane.tsxsrc/renderer/src/components/browser-pane/remote-browser-frame-point.test.tssrc/renderer/src/components/browser-pane/remote-browser-frame-point.tssrc/renderer/src/components/browser-pane/remote-browser-frame-style.test.tssrc/renderer/src/components/browser-pane/remote-browser-frame-style.tssrc/renderer/src/components/browser-pane/remote-browser-legacy-input.test.tssrc/renderer/src/components/browser-pane/remote-browser-legacy-input.tssrc/renderer/src/components/browser-pane/remote-browser-legacy-viewport.test.tssrc/renderer/src/components/browser-pane/remote-browser-legacy-viewport.tssrc/renderer/src/components/browser-pane/remote-browser-page-session.tssrc/renderer/src/components/browser-pane/remote-browser-pointer-gesture.test.tssrc/renderer/src/components/browser-pane/remote-browser-pointer-gesture.tssrc/renderer/src/components/browser-pane/remote-browser-stream-events.tssrc/renderer/src/components/browser-pane/remote-browser-stream-lifecycle-deps.tssrc/renderer/src/components/browser-pane/remote-browser-stream-lifecycle-test-harness.tssrc/renderer/src/components/browser-pane/remote-browser-stream-lifecycle.test.tssrc/renderer/src/components/browser-pane/remote-browser-stream-lifecycle.tssrc/renderer/src/components/browser-pane/use-remote-browser-stream-activation.tssrc/renderer/src/i18n/locales/en.jsontests/e2e/paired-remote-browser-legacy-input.spec.ts
🚧 Files skipped from review as they are similar to previous changes (7)
- src/renderer/src/components/browser-pane/remote-browser-frame-point.test.ts
- src/main/browser/browser-screencast-snapshot-capture.ts
- src/renderer/src/components/browser-pane/remote-browser-frame-style.test.ts
- src/renderer/src/components/browser-pane/use-remote-browser-stream-activation.ts
- src/renderer/src/components/browser-pane/remote-browser-frame-point.ts
- src/main/browser/agent-browser-bridge.ts
- tests/e2e/paired-remote-browser-legacy-input.spec.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.
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: fbda6dab-8bbd-45e0-80bf-bfe104c59709
📒 Files selected for processing (6)
config/reliability-gates.jsoncsrc/main/browser/browser-screencast-cdp-events.tssrc/main/browser/offscreen-browser-backend.tssrc/main/runtime/orca-runtime-browser.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/browser/browser-screencast-cdp-events.ts
- config/reliability-gates.jsonc
Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.
|
CI rerun is now fully green on head |
|
Validation update for HEAD |
a716c4d to
70a3484
Compare
70a3484 to
9a1a8f1
Compare
Summary
Linear: STA-4525
GitHub: #14883
Root cause and authority boundary
The missing
browser.tab-create-known-id.v1capability identified the affected legacy creation path but was not the sole root cause. The old Windows host could publish a host-generated page ID after the client's first snapshot, route input through a queue that could wedge, and emit a cropped headed capture. Windows owns browser creation, page inventory, capture, and publication; the Mac only sends intent and mirrors that state.What this PR changes
No new stream opcode, required wire field, unnegotiated RPC parameter, client-hosted browser, or local fallback is added. Old clients/new hosts remain safe, and new clients/old hosts use old-decoder-safe operations.
Deterministic oracle and evidence
c6016e2963passed 98 tests; the current source suite ona716c4deb9passes 1,458 tests with 1 skipped.windows 2(1.4.184, no known-ID capability) with a Windows-owned workspace: New Browser Tab → Example Domain → Learn more → Back, input/navigation/reload, close/reopen, and host inventory all stayed remote. The corrected capture was aspect-matched; no reconnect/toast failure, local browser, or stale host page remained. This is manual evidence and is explicitly not counted as replayable Windows CI coverage.Validation
pnpm run typecheck: passed.pnpm run lint: passed, including reliability manifest (86 gates), max-lines ratchet, native/type-aware audits, localization, and skill-manifest checks.git diff --check: passed.a716c4deb9has one unrelated shard failure: folder-workspace-owner-routed-mutations.test.ts fails on both Node 24/26 reruns with resolveRuntimeUpdate undefined; 42 other jobs passed. Browser-focused validation remains green, and the PR stays draft pending an unrelated CI rerun/triage.Review and status
PR #14987 is open and remains draft; do not merge. Three independent gpt-5.6-luna reviews are clean on the behavioral head: correctness, wire compatibility, and lifecycle/resource cleanup/reproduction. CodeRabbit findings were validated: the actionable cancellation gaps are fixed; the other comments were already resolved in current code or were stale/irrelevant to the active lint and capability-gating contracts.
Downsides / risks
browser.tabCreatetimeout cannot be made idempotent by the new client alone; unsafe inventory guessing is intentionally avoided.