Skip to content

fix(mobile): settle browser dialogs on the stream that reports them, map taps through the page scale, and sweep the frame budget on the real encoder (OTA phase C, C6.7) - #21799

Merged
Jinwoo-H merged 10 commits into
mainfrom
ota-c6-7-proof-fixes
Sep 20, 2026

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1016 $\color{#cf222e}{\Huge{\mathbf{−}}}$​91 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​925
Prod 15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​324 $\color{#cf222e}{\Huge{\mathbf{−}}}$​48 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​276

Summary

Phase C, C6.7: the defects the C6.6 device proof found in the browser pane (results in the lead's evidence directory; design-ota-c6.md §6; rulings rulings-ota-c6.md 1, 2, 4, 7). Commits on e5181113ca. Every fix is in the shared pane, the page path or the desktop's screencast side, and holds for the native pane and the page alike; no RPC shape, opcode, grant or protocol-version change.

commit what
4cef47facf, 6ad9193dbd dialogs. Chromium hands Page.javascriptDialogOpening to one CDP session and takes the answer only from that session; browser.dialogAccept / dialogDismiss answered through the agent-browser bridge, always a later client, so Page.handleJavaScriptDialog never landed ("No dialog is showing" on a second client, measured), the page stayed blocked, and a blocked page cannot run the confirm() that would have raised the second card, which is why "only the first dialog arrives" was the same defect. The screencast stream session now settles the dialog it reported (settleDialog, false when none is open) and the runtime tries the live stream before the bridge. The pane's card clears on the host's dialogClosed, not on the press. Red-first in three suites, including the pane over the real port pair against a host that moves only when the dialog is answered. Side effect: orca dialog dismiss --page against a page with a live pane no longer hangs
0163e62dce mobile-view tap mapping. With mobile: true and no viewport meta, the screencast metadata carries deviceWidth 402 and pageScaleFactor 0.4102 (= 402/980; the 980 is only innerWidth), and the pane sent device-space coordinates to Input.dispatchMouseEvent, which takes page CSS pixels, so a tap landed at 41% of the aim (the proof's (30,56) on BODY reproduced; the CSS centre hits). BrowserFrameGeometry carries pageScale from the frame's metadata (default 1); the tap map divides by it and the click radius scales with it; no scroll-offset term (DevTools' own screencast adds one, and a page scrolled to 300 landed 300 px low with it). 3 of 9 geometry cases red-first; a new render case at 390/980 is 296 CSS px off at the base and exact on the head; the viewport-meta case stays exact to one device pixel; no golden moved
c0db0007f6 the budget against the real encoder. The C6.5 sweep encoded through canvas.toDataURL; re-measured through Page.startScreencast over the same 143 viewports and noise, the range is 0.543986–0.552964 B/px against 0.54470–0.55351, so the encoder is not what dropped the proof's frame and WORST_CASE_JPEG_BYTES_PER_PIXEL stays 0.56, restated as the screencast maximum plus 0.007036 (~1.3%). The sweep now runs on the screencast path with a viewport meta on the noise page, because a no-meta page lays out at 980 px, which scales the canvas into the frame and averages the noise to 0.093 B/px, a false pass that the > 0.5 floor catches (reproduced in review); headless Chromium composites the screencast at the DIP size whatever the device scale factor says, so the factor is not what protects the measure. The constant at 0.5 fails all 111 budgeted viewports through the real shell. "Never dark" holds only for a page that produces some frame that fits (with every frame over the cap the pane sits on its spinner, stream alive); recorded in the pane's docstring and design-ota-c6.md §6
6341321f44 the render check's flip race: applyFrame writes the next frame's URI onto the hidden layer the moment it lands and flips opacity only when the decode resolves (measured 80.7 ms and 85.7 ms after the emit with a mutation observer, a 5 ms window), so a wait on "some layer carries a new digest" was true before the frame was on screen and read the visible layer too early under CI load. Both cases with that predicate now wait on the flip itself (the visible layer index changes at settleBrowserFrameLayer); the digest assertions stay as the content check; with the flip stubbed out the case fails on the wait. Forced deterministically: with HTMLImageElement.prototype.decode wrapped to resolve 1,500 ms late, the old digest wait fails with the CI message verbatim and the flip wait passes
47de9902dc round 1: browser.dialogAccept / dialogDismiss answer one shape on both paths, { accepted: boolean }, rather than {} on the stream path and the agent-browser payload on the bridge path (wire-visible only in orca browser dialog accept --json, which now prints {"accepted":true} on both paths; the mobile reader is z.unknown(), nothing narrows). A stream that stops with a dialog open dismisses it before Page.stopScreencast, the policy cdp-debugger-events.ts already takes: measured on Chromium 1217, detaching the reporting session with a dialog up never completes, a fresh session's Page.enable never completes and its Page.handleJavaScriptDialog answers "No dialog is showing", so carrying dialogOpen across a replacement (which backgrounding the phone does) would report a success the page never got
daebbbecf9 round 1: a failed or timed-out dialog answer marks the open card ("That answer did not reach the page.") and leaves the buttons live for the retry, routed through the setDialog the recorder adapter already passes (so that field is live again, not inert); the case presses again and the page moves on. The sweep's docstring drops the inert emulation claim: Emulation.setDeviceMetricsOverride sizes the surface, its scale factor is required by the command and inert (1 versus 3 measures identically), and a new case with the viewport meta removed reads under 0.3 B/px, which the sweep's 0.5 floor catches. The "never dark" note sits on the component
2eac0f10ee bots: sendWheel composed the frame fit and the zoom and left the page scale out (a 100-point flick on the 402-into-980 page sent -100 where the page needs -244); the composition is named once, browserScreenToPageCssScale, and the wheel and the touch radius both go through it, the wheel's conversion a pure function with -0 normalised. One settlement promise per dialog on the stream, handed to duplicate callers and cleared only by its own generation (two concurrent accepts sent two commands, now one; a late failure on A can no longer disarm B); the stop path reuses an in-flight settlement; the card's buttons are disabled while an answer is in flight, keyed on the token that armed the card, so a reply landing after the page moved on cannot mark the wrong card. The sweep paints the noise after Page.startScreencast on the same session behind two animation frames, records the frame count and uses only later frames (two, the larger wins); no post-commit frame is an error naming the viewport, never a fallback to a pre-paint frame, which would look exactly like a cheaper encoder. Re-measured: 0.543986–0.552964, unchanged to six decimals
6e74b0d119 round 2: the case the token needed. Answer the alert, let the page settle it and raise the confirm before the pane hears the reply, then time that reply out: the confirm keeps its own card, no failure text, both buttons live. With the token check reduced to the null guard round 1 reviewed, the confirm wears the alert's failure. The sweep docstring quoted a case title that did not exist; it quotes the real one
dcfb4c216e bots, after CI went green: the pane's local BrowserDialogState (no error, no pending) is replaced by the exported one, so the fields the card renders are declared on the pane's own state

Open, from the proof, not fixed here

The proof's one dropped budgeted frame at 402×593 needed about 0.5649 B/px while the largest frame that applied was 0.4715, a gap uniform noise does not produce; most likely a frame captured while the emulation was mid-change. Not reproduced; its own lane. Two carried items: src/main/browser/browser-manager-viewport-ownership.test.ts fails 12 of 12 in the shared lane environment on pristine main while CI runs it green (environmental); the recorder adapter's setDialog is live again as of daebbbecf9; its dialog type still lacks the new error field (hidden by the adapter's cast), left alone because editing the adapter moves adapterSha256 and forces a golden re-record.

Gates (lead, on 6e74b0d119 against e5181113ca; dcfb4c216e removes one duplicate type declaration, mobile tsc 0, browser suite 17 files green)

tsc 0, ratchet 0, oxlint 0, format 0, react-doctor 0, merge-max-lines 0, root vitest 226 files green, mobile vitest 749 files green, machine paths 0, merge-tree clean against main; the head merged with main passes the pane and shell suites and the page family and the desktop browser suites except browser-manager-viewport-ownership.test.ts and the --expose-gc retention test, both failing identically on pristine main in the lead's environment while CI runs them green. Red-first reproduced by the lead: pageScale pinned to 1 reds 3 of the 9 geometry cases; the token check reduced to the null guard reds the stamped-on-the-wrong-dialog case.

…OTA phase C, C6.7)

Chromium hands `Page.javascriptDialogOpening` to one CDP session and takes the
answer only from that session; a client attaching afterwards is told `No dialog
is showing`, and every renderer-bound command it sends first blocks behind the
dialog it was sent to clear. Measured on Chromium 1217, 2026-09-20.

`browser.dialogAccept` and `browser.dialogDismiss` went to the agent-browser
bridge, which is always a later client, so the reply never reached
`Page.handleJavaScriptDialog`: the page stayed blocked and its next dialog
never opened. The screencast is the session that reported the dialog, so it is
the session that answers it. With no stream live on the page the bridge path is
unchanged.

No RPC shape changes.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…swer (OTA phase C, C6.7)

The card was cleared on the press, before the reply was sent. A page blocked on
a dialog is still blocked until the host settles it, so the pane reported an
answer the page never got and left the user looking at a stream nothing could
move. The host's `dialogClosed` is what says the page took it, and that already
clears the card.

The port-pair case runs the pane against a host that only moves the page when
the dialog is answered: alert, OK, the card stays while the reply is in flight,
then the confirm raises its own card and resolves with the button's value.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…t (OTA phase C, C6.7)

Mobile view emulates a phone viewport, and a page with no `<meta name="viewport">`
lays out at Chromium's 980 px default and is scaled into it. The frame metadata
says so: `deviceWidth` stays the emulated width and `pageScaleFactor` carries the
ratio. The browser's input commands take page CSS pixels, so a tap sent in the
frame's own device space landed at that fraction of the aim — 41% on the phone,
which is how the C6.6 proof found it.

The frame geometry now carries the scale the frame was painted at, and both the
tap map and the finger-sized click radius go through it. Measured on Chromium
1217, 2026-09-20: `scrollOffsetX/Y` must not be added — the frame is the visual
viewport and the commands take viewport-relative coordinates, so a click sent at
`device / scale + scrollOffset` landed a screenful past its target while
`device / scale` hit it. Web view mode reports a scale of one and is unchanged,
and so is a frame whose metadata carries no usable scale.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…(OTA phase C, C6.7)

The C6.5 sweep encoded through `canvas.toDataURL` while the pane's frames come
from `Page.startScreencast`, so the certification and the product were measuring
two encoders. The sweep now drives the screencast, over the same 143 viewports
and the same noise, through the same real shell.

The two encoders agree to within a thousandth of a byte per pixel, and the
screencast is the cheaper of them: across the 111 viewports the budget fits it
measured 0.543986 to 0.552964 bytes per pixel, against 0.54470 to 0.55351 from
`toDataURL`. `WORST_CASE_JPEG_BYTES_PER_PIXEL` stays 0.56, now stated as the
screencast maximum plus 1.3%.

So the encoder is not what made the C6.6 device proof drop 1 frame in 41 at
402x593 with the budget on. That frame needs about 0.5649 bytes per pixel, above
everything either sweep has seen, and nothing here reproduces it. The docstring
records that rather than folding it into the constant.

The frame is emulated at one device pixel per CSS pixel and the page carries a
viewport meta: headless Chromium composites at the DIP surface size whatever
`deviceScaleFactor` says, so without both the canvas is scaled into the frame,
the noise averages away and the sweep reads about 0.12 bytes per pixel.

Also records what C6 ruling 1 costs, in the pane's docstring: "never dark" holds
only for a page that produces some frame that fits. With every frame over the
cap the pane sits on its busy spinner over an unpainted viewport, which is the
budget's reason for existing. No code change for that.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…phase C, C6.7)

The render check waited for some painted layer to carry a digest other than the
previous frame's. `applyFrame` writes the next frame's URI onto the hidden layer
as soon as the frame lands and only flips the opacity once the decode resolves,
so that predicate is true before the frame is on screen.

Measured with a MutationObserver over the style writes, 2026-09-20: the URI
landed 80.7 ms after the emit and the flip at 85.7 ms, a 5 ms window in which
the wait returns and the visible layer is still the previous frame. The check
usually outran it by the round-trip it spends reading the layers back, which is
why it failed once in CI (#21790, d1d9a59) with the second frame's digest
equal to the first's and no console errors.

Both cases that used that predicate now wait on the flip itself: the visible
layer must become the other one, which is one opacity write at
`settleBrowserFrameLayer` and the behaviour under test rather than a proxy for
it. Asserting the exact layer rather than any change keeps a pane with nothing
visible from reading as a flip. The digest assertions stay, as the content check
the wait no longer stands in for.

With `settleBrowserFrameLayer` stubbed to skip the flip the case fails on the
wait, so it is still an oracle for the behaviour and not only for the timing.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: c528f809-19a9-4e05-9722-c092febd6b5e

📥 Commits

Reviewing files that changed from the base of the PR and between 6e74b0d and dcfb4c2.

📒 Files selected for processing (1)
  • mobile/src/browser/MobileBrowserPane.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The changes add page-scale metadata handling for touch coordinates and click radii. Render tests validate scaled taps and precise layer flips. Frame-budget tests measure post-paint Chromium screencast JPEG output. JavaScript dialogs can settle through the reporting screencast session, with bridge fallback and persistent mobile error state when settlement fails.

Priority: ➖ Normal

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 23 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description provides detailed change rationale, implementation details, testing results, known failures, and scope limits. It does not follow the required template and omits required sections such… Restructure the description using the repository template. Add an ELI5 section, explicit What Changed and Why sections, a completed Linked Issue section, Visual Proof or N/A with a reason, Testing checkboxes and platform details, AI Disclos…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the three primary changes: stream-based dialog settlement, page-scale input mapping, and real-encoder frame-budget measurement. It is longer than preferred but remains spe…
Full details: Description check

Explanation

The description provides detailed change rationale, implementation details, testing results, known failures, and scope limits. It does not follow the required template and omits required sections such as ELI5, Linked Issue with a completed Fixes reference, Visual Proof or N/A, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the Checklist.

Resolution

Restructure the description using the repository template. Add an ELI5 section, explicit What Changed and Why sections, a completed Linked Issue section, Visual Proof or N/A with a reason, Testing checkboxes and platform details, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the required Checklist. Preserve the existing detailed testing and known-failure information in the appropriate sections.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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 coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 39f8a28a-8e68-4ffb-b066-af8d97d49a81

📥 Commits

Reviewing files that changed from the base of the PR and between e736a9f and 6341321.

📒 Files selected for processing (21)
  • config/scripts/mobile-web-app-browser-pane-render.test.mjs
  • config/scripts/mobile-web-app-frame-budget-sweep.test.ts
  • mobile/src/browser/MobileBrowserPane.tsx
  • mobile/src/browser/MobileBrowserPaneView.tsx
  • mobile/src/browser/browser-screencast-request.web.ts
  • mobile/src/browser/browser-touch-geometry.test.ts
  • mobile/src/browser/browser-touch-geometry.ts
  • mobile/src/browser/mobile-browser-dialog-through-the-bridge.test.tsx
  • mobile/src/browser/use-mobile-browser-commands.ts
  • mobile/src/browser/use-mobile-browser-interactions.ts
  • src/main/browser/browser-screencast-cdp-events.ts
  • src/main/browser/browser-screencast-dialog-settlement.test.ts
  • src/main/browser/browser-screencast-lifecycle.test.ts
  • src/main/browser/browser-screencast-stream-types.ts
  • src/main/browser/browser-screencast-stream.test.ts
  • src/main/browser/browser-screencast-stream.ts
  • src/main/browser/browser-screencast-web-contents-test-double.ts
  • src/main/runtime/browser-dialog-settlement.test.ts
  • src/main/runtime/browser-dialog-settlement.ts
  • src/main/runtime/runtime-browser-commands-browser-command-target-params.ts
  • src/main/runtime/runtime-browser-commands-browser-set-headers.ts
💤 Files with no reviewable changes (2)
  • mobile/src/browser/MobileBrowserPane.tsx
  • mobile/src/browser/use-mobile-browser-interactions.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

const renderedWidth = sourceWidth * scale
const renderedHeight = sourceHeight * scale
return {
pageScale: getPositiveFiniteNumber(metadata?.pageScaleFactor) ?? 1,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline mobile/src/browser/use-mobile-browser-commands.ts --items all
rg -n -C 8 '\b(sendWheel|browserPointerWheel|pageScale|cssDx|cssDy)\b' \
  mobile/src/browser/use-mobile-browser-commands.ts
rg -n -C 8 '\bbrowserPointerWheel\b' mobile/src

Repository: stablyai/orca

Length of output: 9215


🏁 Script executed:

#!/bin/bash
set -euo pipefail
printf '%s\n' '--- command operation helper ---'
cat -n mobile/src/browser/mobile-browser-command-operations.ts | sed -n '1,90p'
printf '%s\n' '--- browser.mouseWheel bindings and contracts ---'
rg -n -C 12 '\bbrowser\.mouseWheel\b|\bmouseWheel\b|pointer-wheel|wheel' --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' .
printf '%s\n' '--- relevant protocol/request definitions ---'
rg -n -C 10 'browserPageCommand|BrowserPageCommandSend|mouseMove|mouseClick' mobile/src

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail
printf '%s\n' '--- mobile operation binding ---'
cat -n mobile/src/browser/mobile-browser-command-operations.ts | sed -n '1,75p'
printf '%s\n' '--- candidate bridge files ---'
rg -l 'browser\.mouseWheel|mouseWheel' src/main/browser | sort
printf '%s\n' '--- bridge wheel handlers ---'
rg -n -C 18 'mouseWheel|pointer-wheel|browser\.pointer-wheel|deltaX|deltaY' src/main/browser/agent-browser-bridge-pointer-commands.ts src/main/browser --glob '*pointer*' --glob '*command*' | head -n 260

Repository: stablyai/orca

Length of output: 28490


🏁 Script executed:

#!/bin/bash
set -euo pipefail
printf '%s\n' '--- touch geometry ---'
cat -n mobile/src/browser/browser-touch-geometry.ts
printf '%s\n' '--- sendWheel callers and wheel input units ---'
rg -n -C 14 '\bsendWheel\b|onWheel|deltaX|deltaY|pageScaleFactor|screenDx|screenDy' mobile/src/browser mobile/src --glob '*.ts' --glob '*.tsx' | head -n 360

Repository: stablyai/orca

Length of output: 39034


🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n -C 28 'sendWheel\(' mobile/src/browser/use-mobile-browser-interactions.ts mobile/src/browser --glob '*test*' --glob '*.tsx' --glob '*.ts' | head -n 260

Repository: stablyai/orca

Length of output: 10776


Apply page scale to wheel deltas. sendWheel converts screen deltas with geometry.scale and zoom.scale, but it omits geometry.pageScale. For pageScaleFactor: 0.41, the browser receives about 41% of the requested scroll distance.

- const scale = (geometry?.scale ?? 1) * localZoom
+ const scale = (geometry?.scale ?? 1) * (geometry?.pageScale ?? 1) * localZoom

Add a scaled-wheel test.

…eam (OTA phase C, C6.7 round 1)

Round 1 findings 2 and 4.

The reply body forked: `{}` when a pane was streaming the page and the
agent-browser payload when one was not, so `orca browser dialog accept --json`
printed a different body depending on whether anyone happened to be watching.
Both paths now answer `{ accepted: boolean }`. The bridge's own body is not
forwarded, because it is whichever JSON that agent-browser version prints, which
is the thing a caller cannot rely on. Pinned by asserting the two paths answer
the same value.

A replacement stream can meet an open dialog: the last subscriber leaving stops
the page's session, and a later subscribe builds a new one, which is what
backgrounding and foregrounding the phone does. Measured on Chromium 1217,
2026-09-20, with the dialog up: detaching the session that reported it does not
complete, `Page.enable` on a fresh session does not complete, and
`Page.handleJavaScriptDialog` on it answers `No dialog is showing`. So carrying
`dialogOpen` across would report a success the page never got, and the
replacement's own start would hang before it could try.

The stream therefore dismisses a dialog still open when it stops, before
`Page.stopScreencast`, so no session is ever replaced with one outstanding.
Dismissing is the conservative answer for every dialog type including
beforeunload, and the automation path has taken it since `cdp-debugger-events.ts`.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…p's inert emulation claim (OTA phase C, C6.7 round 1)

Round 1 findings 1, 3 and 5.

The sweep's `deviceScaleFactor` is inert and the docstring claimed otherwise.
Headless Chromium composites at the DIP surface size whatever the factor says,
so the sweep returns the same 0.543986 / 0.552964 to six decimals at 1 and at 3;
`Emulation.setDeviceMetricsOverride` is there to size the surface and nothing
else. What actually guards the measurement is the document's viewport meta,
without which the page lays out at 980 px, the canvas is scaled into the frame
and the noise averages away. That is no longer left to a comment: a case now
measures the same frame with the meta removed and reads under 0.3 bytes per
pixel, which is what proves the sweep's 0.5 floor is the thing that would catch
it.

The card cleared only on `dialogClosed`, but the request still suppressed its
error and timed out at 5 s, so a refused or timed-out answer left the modal up
with nothing said and a button that looked dead. A failed answer now marks the
open card, which keeps its buttons live for the retry. The updater is what stops
a late failure reopening a card the page has since closed.

The "never dark" note moves onto the component it describes, from the detached
block it was sitting in between the imports and the props type.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The stream's new settleDialog can answer a second time before the page reports the first dialog closed, and a rejection there bypasses the agent-browser fallback. A pre-existing follow-up in the same coordinate-space family is called out below.

Reviewed changes

  • Dialog settlement on the reporting stream — BrowserScreencastSession.settleDialog sends Page.handleJavaScriptDialog on the session that received Page.javascriptDialogOpening, gated by a dialogOpen flag set from the CDP dialog events; browserDialogAccept/browserDialogDismiss try the live stream first and fall back to the bridge.
  • Pane card lifecycle — the pane no longer clears its dialog card on the press; it clears only on the host's dialogClosed, and setDialog is dropped from the interactions/commands hooks.
  • Tap mapping through page scale — BrowserFrameGeometry carries pageScale from the frame metadata; mapScreenToBrowserPoint divides by it (no scroll offset) and the click radius grows by 1/pageScale.
  • Frame-budget sweep on the real encoder — the sweep test now drives Page.startScreencast instead of canvas.toDataURL; WORST_CASE_JPEG_BYTES_PER_PIXEL stays 0.56 with a restated margin.
  • Render-check flip race — the pane render test waits on the double buffer's visible-layer flip rather than on a new digest.

ℹ️ The drag-scroll path still sends frame-device pixels

sendWheel converts the pan delta with geometry.scale * zoom.scale only. CDP's Input.dispatchMouseEvent deltaX/deltaY are viewport-relative CSS pixels, so on a page with no <meta name="viewport"> in mobile view the wheel delta is in frame-device pixels — at the 402/980 scale this PR documents, a drag scrolls about 41% of the finger's travel. This is the same coordinate-space defect the tap path just fixed, in the one input path the PR left behind; it is pre-existing, but the new pageScale field makes the fix local and the new render case only asserts browser.mouseClick, so nothing catches it.

Technical details
# sendWheel omits pageScale

## Affected sites
- `mobile/src/browser/use-mobile-browser-commands.ts:179-185` — `scale = (geometry?.scale ?? 1) * localZoom`, so `screenDx / scale` stays in frame-device pixels; `pageScale` is never applied.
- `mobile/src/browser/use-mobile-browser-interactions.ts:234` — the call site passes screen-space `gesture.dx/dy`.
- The wheel point (`mapTouchPoint`) is now correctly scaled; only the delta is not.

## Required outcome
- The wheel delta must be converted to viewport-relative page CSS pixels, matching `mapScreenToBrowserPoint`.

## Suggested approach
- Include `geometry.pageScale` in the `scale` at `use-mobile-browser-commands.ts:182` (`geometry.scale * zoom.scale * pageScale`), and add a sweep/render case asserting the delta magnitude at a `pageScaleFactor` below one.

ℹ️ Nitpicks

  • mobile/src/browser/MobileBrowserPaneView.tsx:33-42 — the "never dark" docstring sits directly above type MobileBrowserPaneViewProps but describes the pane's frame behavior, not the props type; it reads as the type's own documentation.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +124 to +133
settleDialog: async (accept: boolean, promptText?: string) => {
if (!dialogOpen) {
return false
}
await sendDebuggerCommand(dbg, 'Page.handleJavaScriptDialog', {
accept,
...(promptText === undefined ? {} : { promptText })
})
return true
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settleDialog leaves dialogOpen true until Page.javascriptDialogClosed arrives, and nothing disables the pane's OK/Cancel buttons or guards a second in-flight send. A double-tap (likely on a remote/SSH host, where the round trip is long) sends a second Page.handleJavaScriptDialog; Chromium rejects it with No dialog is showing, and if the page has already raised its next dialog the second command settles that one without the user seeing it. Because settleBrowserDialogOnLiveScreencast awaits this before the bridge, that rejection also propagates out of browserDialogAccept/browserDialogDismiss instead of falling back, and if dialogClosed never arrives the card stays up with no local dismiss.

Technical details
# Double-settle window in the stream's dialog settlement

## Affected sites
- `src/main/browser/browser-screencast-stream.ts:124-133` — `settleDialog` checks `dialogOpen` but never clears it; the flag resets only on `Page.javascriptDialogClosed` (`browser-screencast-cdp-events.ts:52`) or `finish()` (`:89`).
- `mobile/src/browser/MobileBrowserPaneView.tsx:267-286` — OK/Cancel `Pressable`s stay enabled while a send is in flight.
- `mobile/src/browser/use-mobile-browser-commands.ts:248-257` — `sendDialogCommand` sends on every press; no in-flight guard.
- `src/main/runtime/browser-dialog-settlement.ts:26` — returns `session.settleDialog(...)` uncaught, so a rejection skips the bridge fallback in `runtime-browser-commands-browser-set-headers.ts:72-99`.

## Required outcome
- A second settle request while one is outstanding must not send a second `Page.handleJavaScriptDialog`.
- A rejected settle must not become a rejected `browser.dialogAccept`/`browserDialogDismiss`; the caller should still reach the bridge fallback.

## Suggested approach
- Clear `dialogOpen` in `settleDialog` before awaiting the command, or track the in-flight promise and return `false` while one is pending.
- Catch in `settleBrowserDialogOnLiveScreencast` so a rejection returns `false` rather than propagating.

…weep after the paint (OTA phase C, C6.7 bots)

Three bot findings on 6341321.

The wheel converted screen deltas with the frame fit and the zoom and left the
page scale out, so a flick on a page with no viewport meta delivered about 41%
of the scroll asked for — the same omission the tap had, one call site over.
Both call sites now go through one scale, named for the three factors every
screen-space quantity this pane sends has to carry.

`dialogOpen` stayed true until `Page.javascriptDialogClosed`, so two answers in
flight both sent `Page.handleJavaScriptDialog`. Chromium takes one per dialog:
the second is refused, or settles the page's next dialog unseen if it has
already been raised, and the rejection came back out of the RPC. One settlement
promise per dialog now, handed to duplicate callers, cleared when the dialog
closes or when the command fails — and only by its own dialog's generation, so
a late failure cannot disarm the next dialog's answer. The stop path reuses a
settlement already on its way rather than adding a second command. On the pane
the card's buttons go dead while an answer is in flight, keyed on the token of
the answer that armed them, so a reply landing after the page moved on writes to
neither card.

The sweep painted its noise before `Page.startScreencast` and accepted whatever
frame the deadline left it, so a capture taken before the paint committed could
have been measured as the cost of the canvas. The noise is now painted after the
screencast is running, through the same CDP session and behind two animation
frames, and only frames that arrive after that commit are used; none at all is
an error rather than a fallback. Re-measured across all 111 budgeted viewports:
0.543986 / 0.552964, unchanged to six decimals, so the constant stays where it
is and the capture is guaranteed rather than lucky.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e274f9ba-311a-45cf-9a6b-26ff150f8bd5

📥 Commits

Reviewing files that changed from the base of the PR and between 6341321 and daebbbe.

📒 Files selected for processing (12)
  • config/scripts/mobile-web-app-frame-budget-sweep.test.ts
  • mobile/src/browser/MobileBrowserPaneView.tsx
  • mobile/src/browser/mobile-browser-dialog-through-the-bridge.test.tsx
  • mobile/src/browser/mobile-browser-pane-styles.ts
  • mobile/src/browser/mobile-browser-stream-events.ts
  • mobile/src/browser/use-mobile-browser-commands.ts
  • mobile/src/browser/use-mobile-browser-interactions.ts
  • src/main/browser/browser-screencast-dialog-settlement.test.ts
  • src/main/browser/browser-screencast-stream.ts
  • src/main/runtime/browser-dialog-settlement.test.ts
  • src/main/runtime/browser-dialog-settlement.ts
  • src/main/runtime/runtime-browser-commands-browser-set-headers.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

// stays and says so rather than looking like a button that does nothing. The updater is what
// keeps a late failure from reopening a card the page has since closed.
setDialog((current) =>
current === null ? null : { ...current, error: 'That answer did not reach the page.' }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Localize the dialog failure text.

This user-visible string bypasses the localization system. Use an intent-named localization ID so translated clients show the same failure state.

Based on learnings: new user-facing strings in TypeScript and TSX must use intent-named localization IDs with named interpolation placeholders.

Source: Learnings

…quote the real case title (OTA phase C, C6.7 round 2)

Round 2 delta findings a and b.

The mis-stamp itself is already closed by the per-dialog token the bot fold
added: the failure updater skips unless the open card still carries the token of
the answer that armed it, and a dialog raised after that carries none. What was
missing is the sequence that proves it. The case answers the alert, lets the
page settle it and raise the confirm without the pane hearing the reply, then
times that reply out: the confirm keeps its own card and its live buttons. With
the token check reduced to the null guard it was reviewed with, the confirm is
stamped with the alert's failure.

The sweep docstring quoted a case title that does not exist, which is a pointer
that reads as a citation and resolves to nothing. It now quotes the real one.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes — since the prior review at 6341321f44, the round-1 commits unified the dialog reply shape, dismiss an open dialog before its stream stops, mark the pane's card when an answer does not land, and add a false-pass guard to the frame-budget sweep.

  • One dialog reply shape — browserDialogAccept / browserDialogDismiss now answer { accepted: boolean } on both the stream and the bridge path; the bridge's own body is no longer forwarded.
  • A dialog cannot outlive its stream — stop() dismisses an open dialog before Page.stopScreencast, so a replacement stream does not inherit a page blocked on a session that can no longer answer it.
  • The pane keeps its card and says why an answer failed — a refused or timed-out answer marks the card ("That answer did not reach the page.") and leaves the buttons live for retry.
  • The sweep's false-pass guard — a no-viewport-meta page now reads far under the sweep's floor, proving the floor catches an averaged-noise measurement rather than trusting the docstring.
  • Docstrings — the "never dark" note moved onto the pane component and the sweep's inert deviceScaleFactor claim was dropped.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏


export type BrowserDialogState = { dialogType: string; message: string }
/** `error` is set when an answer did not reach the page, which leaves the page still blocked. */
export type BrowserDialogState = { dialogType: string; message: string; error?: string }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding error here makes this the only complete definition, but mobile/src/browser/MobileBrowserPane.tsx:67 still declares a local BrowserDialogState without it, and that local type is what useState/dialogRef use. It compiles only because structural typing lets the pane's setter flow into the hooks' wider type; the field is undeclared on the pane's own state.

Technical details
# Divergent duplicate `BrowserDialogState`

## Affected sites
- `mobile/src/browser/mobile-browser-stream-events.ts:6` — exported type now carries `error?`.
- `mobile/src/browser/MobileBrowserPane.tsx:67` — local `BrowserDialogState = { dialogType, message }`; `useState<BrowserDialogState | null>` (`:101`) and `dialogRef` (`:124`) use it.
- `mobile/src/browser/use-mobile-browser-commands.ts:264` — the updater writes `error` onto state typed by the local definition.

## Required outcome
- One `BrowserDialogState`, so the `error` field is declared on the pane's state as well.

## Suggested approach
- Import `BrowserDialogState` from `./mobile-browser-stream-events` in `MobileBrowserPane.tsx` and delete the local declaration.

…A phase C, C6.7 bots)

pullfrog: the pane declared its own `BrowserDialogState` without `error` or
`pending`, and only structural typing let the hooks' wider setter flow into it,
so the fields the card renders were undeclared on the pane's own state. The pane
now imports the exported type and the local declaration is gone.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found in this delta.

Reviewed changes — the two commits since the previous review (2eac0f10ee, 6e74b0d119) close the remaining coordinate-space and dialog-concurrency gaps.

  • One answer per dialog on the stream — settleDialog now shares a single in-flight promise per dialog, keyed to the dialog generation, so duplicate callers send one Page.handleJavaScriptDialog; the stop path reuses that settlement instead of racing it, and a failure only clears its own generation's slot.
  • The wheel goes through the full scale — browserScreenToPageCssScale composes the frame fit, pinch zoom, and page scale once; sendWheel and computeBrowserTouchClickRadiusCss both use it, with -0 normalised.
  • The card is armed by a token — the dialog card disables its buttons while an answer is in flight, clears a stale error on the next press, and only the token that armed the card may write a failure back, so a late timeout cannot land on the page's next dialog.
  • The sweep captures after the paint — the noise is painted after Page.startScreencast behind two animation frames, and only frames that arrive after that commit are measured; a missing one is an error rather than a silent fall-back to a pre-paint frame that would read as a cheaper encoder.
  • Round 2 — a test pins the wrong-dialog failure stamp, and the sweep docstring quotes the case title that exists.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit d86d5cb into main Sep 20, 2026
31 checks passed
@Jinwoo-H
Jinwoo-H deleted the ota-c6-7-proof-fixes branch September 20, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant