Skip to content

#620: on Linux, input to a hidden tab no longer waits for the tab's next frame (DOM.enable + Overlay.enable on input targets; cua 0.31.3) - #628

Merged
SSFSKIM merged 15 commits into
mainfrom
610-click
Nov 30, 2026

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Closes #620
Refs #610

On Linux, a tab Chrome doesn't show draws about one frame a second, and it answers each mouse move, wheel event and pressed move only at its next frame. A click on such a tab took about 0.76 s (up to 1.02 s), and a drag took 4 s. Nearly all of that was the wait for the frame.

This change readies each target cua sends input to with DOM.enable and then Overlay.enable, on Linux only. Blink then stops making input wait for a frame. In Chromium 158's source, InspectorOverlayAgent::enable calls SetNeedsUnbufferedInputForDebugger (inspector_overlay_agent.cc lines 594-605 and 2286-2291). The click itself is unchanged from main: each event is still answered before the next is sent, so a failed move or press stops the click, as in the vendor's route. Nothing is sent outside an action.

How it got here

  • Sending a click's events back to back was dropped (ruling 1307). The first version did that. The review found, by injecting faults through the real host, that a failed event then no longer stopped the ones after it. A timed-out move still let the press and release land, and Chrome's in-flight detach made the controller reattach and send the press and release without a successful move. The click reported failure even though it may have taken effect, so a retry could submit twice. It was replaced by Browser service on Chrome 158: CDP commands to inactive tabs can stall for seconds (found by #606; the gate is pinned to 157 until this is answered) #610's measured remedy, which removes the wait at its source.

  • Readying frames in the background was dropped (fix wave 4). A later version readied each out-of-process frame as it auto-attached. Three reviews each found a way that background request changed which turn owns a tab:

    • the host's touch moved an earlier turn's tab into the current one;
    • a late continuation registered an earlier turn for cleanup over the current one;
    • an older host still running ignored the passive flag meant to prevent the first.

    Frames are now readied inside the action that sends input. The action already owns the tab, so nothing it sends can change the owner.

The browser-service spec's 2026-11-29 Decision Log entry records both, so neither route is tried again.

What changed

  • src/browser-service/cdp.mjs: enableUnbufferedInput(target) sends DOM.enable and then Overlay.enable. It runs:
    • for a tab, in ensureAttachedTab right after focus emulation, so at every attachment, a reattach included;
    • for an out-of-process frame that auto-attached in the tab, before an action's first Input.* to the tab (readyInputFrames). This covers a coordinate click that is the first thing sent into a cross-origin iframe. Chrome routes the tab's mouse event into the frame's own widget, and Overlay.enable affects only the enabled target's widget, so the frame needs its own.
      • The frames come from a small registry per tab, fed only by Target.attachedToTarget and Target.detachedFromTarget. It is kept apart from the frame-session maps, which forget a live session on a frameDetached swap.
      • Frames are readied in parallel, once per session, under a budget of their own: at most 200 ms, and at most a quarter of what the input has left. A frame that answers does so in 1 to 2 ms, so the ceiling loses nothing, and the input always keeps its time.
      • A refusal is not asked again. A timeout isn't retried under the same action's deadline, so a click's press and release or a drag's later moves never wait on it, and not for 3 s after for callers without a deadline. A later action asks again. The input goes on either way.
      • A caller that joins a readying another action started waits only its own share, and the readying goes on for the other. The readying sends nothing after its own deadline.
    • for a frame a caller resolves, at its session's initialisation, as before this PR.
  • The hook is the controller's dispatch, not the input module's entry points. It is the one place every input to a tab passes: coordinate and DOM-CUA commands, locator actions, keys, wheels, drags and raw Input. Input sent to a frame's own target already went through that frame's initialisation.
  • A frame's enables go out with preserveDebuggerOnTimeout. A stalled frame then costs only its own readying, never the tab's debugger.
  • Best effort, as focus emulation is:
    • a refused enable is swallowed;
    • Overlay.enable isn't sent once DOM.enable is refused;
    • for the tab, only a deadline or timeout error fails the attachment.
  • src/browser-service/session.mjs: the controller's option is set for platform === 'linux' only.
  • src/browser-service/input.mjs: clickPoint is main's, plus a dated comment on why sending the events back to back was dropped.
  • extension/, the host and backend.mjs are unchanged.
  • cua 0.31.3. The coordinator allocates the final number at merge.

Validation Evidence

The tests, run red first:

  • node --test "test/browser-service/*.test.mjs" and the host suites (test/chrome-host*.test.mjs) on Linux: 561 tests, 553 pass, 0 fail, 8 skipped. Of those, cdp.test.mjs is 61 of 61.
  • RED: against the back-to-back click, 3 input tests failed. With a press after a failed move, the events sent were ['mouseMoved','mousePressed','mouseReleased'] where ['mouseMoved'] was expected. Against main's cdp.mjs, 4 readying tests failed.
  • RED for the in-action route: against the background route, 6 tests failed. "nothing is sent as a frame attaches" failed, and through the real host so did "no command outside an action".
  • RED for the readying's own budget: through the real host with only the child frame's Overlay.enable held, a 150 ms click failed with "CDP operation exceeded its deadline before command dispatch" and sent no events. The stalled-frame unit test hung until the file's 300 s limit.

What the new tests cover:

  • one event in flight at a time;
  • no press after a failed move, and no release after a failed press;
  • the tab's readying: once per attachment, again after a detach, and again after the "Debugger unattached" retry;
  • a frame's readying:
    • nothing sent as frames attach, nor before a command that isn't input;
    • the first Input readies each auto-attached session, in parallel and kept on timeout, and later input pays nothing;
    • a detached session is dropped, and a frameDetached swap keeps it;
    • a refusal isn't asked again; a timeout isn't retried within the same action or the cool-down, and is retried after it; the input goes on either way;
    • a stalled frame holds a gesture's first event about 200 ms and its later events not at all;
    • a 30 ms caller joining a 3 s caller's readying returns within its own share, and the readying finishes for the other;
    • a tab attached again forgets its frames;
  • nothing sent on macOS;
  • through the real host and fake extension:
    • a stalled frame enable leaves the tab attached, both from a frame's resolution and from an input's readying;
    • the tab is readied again after the host's own detach;
    • a 150 ms click on the page sends all three events while a frame of the tab never answers its readying, which is asked once and the tab keeps its debugger;
    • the reviewer's late-cleanup case: no command reaches the host as a frame attaches in turn N's tab after turn N+1 used the browser, and N's late cleanup still closes and detaches the tab. This needs no host change.

ci-gate: GREEN on the head 71ff9b5 (main 0274821 merged in), https://github.com/SSFSKIM/cua/actions/runs/46337523609 (plugin, test-1, test-2, parity-browser). Also GREEN on the last code commit 101ee81, https://github.com/SSFSKIM/cua/actions/runs/46333513441.

Live proof (docs/evidence/2026-11-29-chrome158-unbuffered-input/):

  • Setup: Chrome for Testing 158.0.8127.36, a private Xvfb display, a run-owned profile, and the real host and unpacked extension.
  • Harness: the real BrowserSession with cua_click, cua_drag and cua_scroll.
  • Passes: main 1326898 and this change alternated, twice each.
  • The hidden-tab and showing-tab passes ran at 1f34875. The tab's readying is the same on the final route, and those tabs have no frames.
  • The iframe passes were rerun at 5008aa7, the final route.
hidden tab main this change
a click's move about 755 ms median, max 1.02 s 1.8 to 2.0 ms median, max 3.1
whole click 760 to 762 ms 251 ms (the existing wait to see whether a page load starts)
drag 4.0 s 8 to 13 ms
wheel scroll 2.9 to 3.0 s (its wheel event 1.0 s) 1.6 to 1.7 s (its wheel event about 0.6 s)
coordinate click into a cross-origin iframe, its move about 701 ms median, max 0.97 s 1.9 to 2.1 ms median
  • The frame readying's cost: nothing reached the iframe's session before the first click. That click's move carried the two enables and took 4.9 and 7.8 ms, against 3.1 and 3.2 ms on main, so 2 to 5 ms. Later input sent the frame nothing.
  • Every click landed: 60 of 60 reached the page in order, and the iframe counted 48 of 48, read through postMessage so that no frame lookup came before the clicks.
  • No DOM event stream: the service received 0 DOM events without the enables, and 2 DOM.documentUpdated with them, from the navigation. This was on a page that added a node every 100 ms; cua never calls DOM.getDocument or DOM.requestNode, so no mutation events were sent.
  • No extra rendering: 1 or 2 frames in 2 s after the input, with the enables and without.
  • The person's window kept its id and title in every pass.

Ruling 1307's two conditions:

  • Nothing is drawn on a tab the person is looking at. On a showing tab, with the enables on against off on the same session, 0 pixels differ in the viewport, both ways. A click changed only the button. The frame rate, read with the enables on and off interleaved, fell over time in both states alike. Screenshots are in linux-158/shots/.
  • A target is readied again after a reattach. After the host's own timeout detach, the next command sent (attach) Emulation.setFocusEmulationEnabled DOM.enable Overlay.enable Page.enable Runtime.enable Fetch.enable Target.setAutoAttach. The moves after it took 1.2 to 3.1 ms, against 0.76 to 1.02 s on main.

Limits of this change

  • The wheel is only partly helped. A scroll goes from 2.9 s to 1.7 s, because the wheel's answer and its read-back still wait for the throttled tab to draw. Clicks and drags are fully fixed. The ticket's title names the wheel; this PR states the partial result rather than claiming it.
  • The first input to a tab with out-of-process frames pays their two enables, 2 to 5 ms measured. A frame that stops answering costs that first input up to 200 ms (less on a short budget), once per action. A frame that attaches during an action's input is readied at the next input.
  • Closing DevTools on the same tab brings the old wait back until cua's next attach. Chrome keeps one unbuffered-input flag per input queue, and DevTools' Overlay agent clears it when it goes. This is logged in tech-debt-tracker.md.
  • A frame nested inside another out-of-process frame isn't readied. cua sets auto-attach only on the tab, before and after this change, so such a frame's input keeps the wait.

Unresolved Review Findings

The final review of the last fix wave found two P2s and no P1. Under the coordinator's last-wave ruling they ship with this PR, and both are logged in tech-debt-tracker.md. Each needs an out-of-process frame that doesn't answer its readying for 200 ms; a responsive frame answers in 1 to 2 ms.

  • A stalled frame's readying can shorten a click's page-load window (src/browser-service/cdp.mjs:296-298, the window at :470). clickPoint starts its 250 ms window for seeing whether the click starts a page load before the frames are readied. With a frame held and a navigation starting 100 ms after the release, the reviewer's real-host check got success before the navigation began. Without the readying, the same click waited for the load. Fix: start the window after the readying and before the click's first event.
  • A frame that auto-attaches between press and release can delay the release (cdp.mjs:296-298). The readying runs before every Input.*, the release included, and a frame first seen after mousePressed isn't covered by the per-action cool-down. In the reviewer's real-host check, a stalled frame attached on the press turned a 150 ms click from success into a timeout. Fix: skip the optional readying for the release and held-button moves, or run it once before the gesture.

Residue

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)

…cua 0.31.2)

A tab cua drives while the person is not looking at it is, on Linux, drawn once a second once its page has changed,
and Chrome answers each mouse event at the tab's next frame (#610's pre-flight). clickPoint awaited the move before
sending the press, so a click cost about a second. It now sends the move and every press and release back to back on
the click's target and awaits them together. This holds for every click that goes through clickPoint: cua_click,
cua_double_click, dom_cua_click and dom_cua_double_click, and the locator click and dblclick. The wheel, drags and
keys are unchanged.

The order still holds. The controller dispatches calls started back to back in the order they were started, the
attached tab's and those that share one attachment alike. The backend socket, the host and the native port pass
each request on as it arrives, without waiting for an answer, and the extension calls chrome.debugger.sendCommand
as each message arrives. Chrome runs one session's commands in the order they were sent. A failed event still fails
the click with today's error: the click waits until every event has answered, then throws the earliest failed
event's error. There is no platform gate, because the ordering argument does not depend on the platform; macOS
draws such a tab at full rate, so there the change only saves the round trips.

Tests (input.test.mjs): the move, press and release, and a double click's five events, are all sent before any
answers, in order. A failed move, press or release fails the click with its own error, and only once every event
has answered. When several fail, the earliest event's error wins. Against the real host with the fake extension,
the three events reach the extension in order before the first is answered, both on an attached tab and when the
click attaches the tab.

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…n Log entry

Clicks in a tab the host created, through the browser service's own cua_click over the real host and extension,
on a private display. Four passes alternated origin/main's service with the fix's, 20 clicks each. The click's
Input events took a median of 761 ms and up to 1.02 s before the fix, and 2.0 to 4.2 ms after it. All 80 clicks
reached the page, which saw pointermove, mousedown, mouseup and click in that order. The whole click is now the
load wait's 250 ms classification window, which runs beside the events and is unchanged by the fix.
The browser-service spec records the decision and why it needs no platform gate.

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…h target with DOM.enable and Overlay.enable (cua 0.31.3)

The review of the back-to-back click (ruling in fix wave 1) found that a failed event no longer stopped the ones
after it. A timed-out move let the press and release land. A detach mid-command reattached and sent the press and
release without a move that had succeeded. Either way the click answered failure for a click that may have happened,
and a retry could submit twice. clickPoint is main's again: each event is answered before the next is sent, and a
dated line says why sending them back to back was dropped.

The frame wait is removed at its source. On Linux, the controller sends DOM.enable and then Overlay.enable to each
target it readies: the tab at every attachment (so also after a reattach), and an out-of-process frame's session
when it is initialised. With the Overlay domain enabled, Blink dispatches input without waiting for a frame
(InspectorOverlayAgent::enable calls SetNeedsUnbufferedInputForDebugger at 158.0.8127.36), and Overlay needs DOM
enabled first. #610 measured the effect: a move after a click took 1.1 to 1.4 ms instead of about 1010 ms, with
frames still rare. This helps every move and wheel on the target, not only clicks.

The readying is best effort, as focus emulation is: a target that refuses either call keeps the frame wait, and
Overlay is not asked for once DOM is refused. Only a spent budget fails the attachment. The BrowserSession turns it
on for platform 'linux'. macOS draws such a tab at full rate, and #610 found the two calls change nothing there.

Tests:
- input.test.mjs: one event in flight at a time; no press after a failed move; no release after a failed press.
  The back-to-back tests are gone.
- cdp.test.mjs: the tab readied in order (focus emulation, DOM.enable, Overlay.enable, Page.enable, auto-attach),
  once per attachment, and again after onCDPDetach and after the retry on "Debugger unattached"; an out-of-process
  frame's session readied; neither enable without the option; a refused DOM.enable or Overlay.enable fails nothing
  and a timed-out one fails the attach; the session sets the option on Linux only; and against the real host, the
  tab readied again after the host detached it on a timeout.

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
… 158, and the Decision Log entry

The run drove a hidden tab through the browser service's own commands, the real host and the extension,
alternating origin/main's service with the fix's.

Hidden tab, origin/main's service against the fix's:
- A click's move took 2 to 3 ms, against about 0.76 s at the median and up to 1.02 s before. All 60 clicks
  reached the page, and the page saw them in order.
- A drag took 10 to 28 ms, against 4 s.
- The wheel improved only partly: the scroll took 1.7 s against 2.9 s, and the wheel event about 0.6 s against
  1.0 s.
- The page changed its DOM every 100 ms, and the service received no mutation events from it: only 2
  DOM.documentUpdated, from the navigation.
- Frames stayed rare (1 or 2 in 2 s).
- The person's window kept its id and title.
- After the host's own detach, the next command readied the tab again (DOM.enable and Overlay.enable among the
  reattach's commands), and the moves after it took 1.7 to 3.0 ms.

The person's own tab, claimed while it is showing:
- The viewport was pixel-identical with the enables on and off.
- A click changed only the button. A scroll changed only the scroll box, and the button the pointer left.
- The frame rate was the same with the enables on and off.

The harness replaces the back-to-back click's, which goes with that change. Its run.sh resolves every path it is
given before it changes directory, which fixes the review's P3. The browser-service spec's 2026-11-29 entry now
records the readying, and why the back-to-back click was dropped.

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…, and a frame is readied as it auto-attaches

The re-review found two gaps in the Linux readying (ruling in fix wave 2).

P2a: a frame session's DOM.enable and Overlay.enable went out without preserveDebuggerOnTimeout. When either one
stalled, the host's timeout detached the whole tab's debugger, not just the frame's, so a visible-DOM or locator
read that resolved the frame could cost the tab. A frame's enables now keep the debugger. The timeout still fails
the frame's setup for its caller. The tab's own enables keep today's rule, as every other attach step does.

P2b: a frame was readied only when a caller resolved it. A coordinate click can be the first thing sent into a
cross-origin iframe: Chrome routes the tab's mouse event into the frame's own widget, which the tab's Overlay does
not reach, so that click's move still waited for the frame. On Linux, a frame target is now readied as it
auto-attaches (handleAttachedToTarget). This is best effort and unawaited, failures are swallowed, and the debugger
is kept on timeout. The frame's lazy initialisation still sends the enables too; the repeat is harmless.

P3 (ship with it): one tracker line. Closing DevTools on the tab cua drives clears Chrome's one unbuffered-input flag
per input queue, so the frame wait comes back until cua's next attach. The line cites Chromium's file:lines at
158.0.8127.36.

Tests (cdp.test.mjs):
- a frame target that auto-attaches is sent the two enables at once, with preserveDebuggerOnTimeout, on Linux only;
  a refused DOM.enable is swallowed and Overlay.enable is not sent;
- the lazy initialisation's enables carry the flag;
- against the real host: with Overlay.enable held, a frame resolution with a 100 ms budget times out alone, and the
  tab keeps its debugger with no re-attach.

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…igin iframe, and the full run again at 1f34875

The fixture gains a page on 127.0.0.1 that holds only an iframe from localhost, another site, so Chrome runs it out
of process. Its target auto-attached in every pass. Coordinate cua_clicks land on the iframe's button, the first
being the tab's first action, with no DOM, locator or frame lookup before it. origin/main's service and the fix's
alternated, 12 clicks each, twice. The frame's moves took 0.70 s at the median and up to 0.97 s on origin/main, and
about 2 ms with the fix, which sent the frame's session DOM.enable and Overlay.enable, each kept on timeout, before
the first click. The iframe counted all 48 clicks, in order. The rest of the run repeats fix wave 1's at the new
head, on an idle VM, with the same results.

The browser-service spec's entry gains the frame readying, the iframe numbers and the DevTools limit.

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ner as it was

The third review found that the readying a frame's auto-attach sets off went out as an ordinary executeCdp, and the
host's touch adopted the tab into the turn that sent it. Say turn N+1 had already used the browser before turn N's
cleanup arrived: an iframe auto-attaching in a turn-N tab moved that tab into N+1. N's late cleanup then left the
tab open and attached, though N+1 never used it.

That readying must leave ownership exactly as it was without it:
- The host honors a `passive` executeCdp by skipping touch. Ownership checks, the attached check and the timeout
  are unchanged, and the extension receives the same command.
- The service sends the frame's two enables `passive`.
- The service sends them only once the live turn has already used the browser (BackendApi.usedThisTurn). A request
  carrying a turn the host has not seen would begin that turn, which resumes handed-off tabs into it, and would
  have the turn tracked for its end.
The frame's lazy initialisation runs inside an action of the turn, and still touches as any command does.

Tests:
- real host and fake extension: a frame auto-attaching in task-1's tab after task-2 used the browser; task-1's late
  cleanup closes and detaches the tab. It failed before the fix: the tab stayed open.
- host (chrome-host.test.mjs): a passive executeCdp leaves a turn-N tab to turn N's end. It failed before the fix.
  A passive command to an unattached tab is refused as any is.
- cdp.test.mjs: the eager enables carry passive; the lazy ones do not; nothing is sent while the live turn has not
  used the browser.
- backend.test.mjs: usedThisTurn.

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…keeps ownership

The readying is passive, so the host does not move the tab into the sending turn, and it is sent only once the live
turn has used the browser.

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
… the background

The third re-review found two more ways the background readying changed a tab's owner:
- the passive sends went through sendSessionRequest, so a late continuation could register an earlier turn over the
  current one and skip that turn's cleanup;
- an older host still running ignores `passive` and touches.
Each review of that path had found a new ownership defect. Ruling: send nothing outside an action.

Removed: the send in handleAttachedToTarget, the host's `passive` flag, and BackendApi.usedThisTurn. host.mjs and
backend.mjs are main's again. Wave 2's preserveDebuggerOnTimeout on a frame's enables stays.

Instead the controller keeps a small registry of auto-attached frame sessions per tab. It is fed only by
Target.attachedToTarget and Target.detachedFromTarget, and kept apart from the frame-session maps, which forget a
live session on a frameDetached swap. Before an Input.* command to a tab target, readyInputFrames sends DOM.enable
and Overlay.enable to each of the tab's sessions not readied yet:
- in parallel, within the action's budget, debugger kept on timeout;
- a refusal is not asked again; a timeout is asked again at the next input; either way the input goes on;
- memoized per session, so later input pays nothing.
The registry is cleared when the tab's attachment is forgotten.

The hook is the controller's dispatch rather than CuaInput's entry points. It is the one place every input to a tab
passes: coordinate and DOM-CUA commands, locator actions, keys, wheels, drags and raw Input. Input sent to a frame's
own target already went through that frame's initialisation, which readies it. Every such dispatch belongs to an
action, which owns the tab, so ownership can't change. The cost: the first input to a tab with out-of-process frames
pays the two enables, and a frame that attaches during an action's input is readied at the next input.

Tests (cdp.test.mjs):
- nothing is sent as frames attach, nor before a non-Input command;
- the first Input readies each session in parallel, kept on timeout; later input pays nothing;
- a detached session is dropped; a frameDetached swap keeps it;
- a refusal is not asked again; a timeout is retried at the next input, and the input goes on;
- a tab attached again forgets its frames;
- macOS sends nothing.
Through the real host:
- no command reaches the host as a frame attaches, and an earlier turn's late cleanup still closes and detaches its
  tab (the reviewer's regression, now with no host change);
- the next input readies the frame;
- a stalled frame enable keeps the tab's debugger, both from a frame's resolution and from an input's readying.
The passive and usedThisTurn tests are removed with their code.

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…he spec entry and evidence README to it

linux-158-frames/ is the cross-origin iframe passes rerun at 5008aa7, alternating with origin/main twice. Nothing
reached the frame's session before the first click. That click's move sent DOM.enable and Overlay.enable, each kept
on timeout, and cost 2 to 5 ms (4.9 and 7.8 ms, against 3.1 and 3.2 ms on main). The later moves took 1.9 and 2.1
ms at the median, against 0.70 s on main, and later input sent the frame nothing. The iframe counted all 48 clicks,
in order.

linux-158/ keeps the show and hidden-tab passes at 1f34875. The tab's readying is the same at 5008aa7, and those
tabs have no frames. Its iframe rows, measured on the dropped background route, are taken out.

The harness records the commands sent to the frame during each click. run.sh takes MODES to rerun some passes.

The browser-service spec's entry describes the in-action readying and its registry, and has a dated line on why the
background route was dropped.

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…dget, and never holds up a gesture or a shorter caller

The fifth review found two gaps in the in-action readying (wave 4):
- each frame's enables took the whole remaining budget of the input, so an unrelated out-of-process frame that stops
  answering (an ad) made a short click on the page fail its deadline check before any event went out;
- a second action joined a readying in flight without its own deadline, so a 30 ms call returned after 297 ms.

Frame readying is optional, so it gets a budget of its own that always leaves the input its time:
- at most 200 ms, and at most a quarter of what the input has left. A frame that answers does so in 1 to 2 ms on
  Linux, so the ceiling loses nothing. A 3 s click spends at most 200 ms on a frame that stalls, a 150 ms one 37 ms.
- the readying runs under that deadline (Deadline.race), so it ends with it and sends nothing after;
- a caller waits for a readying, its own or one it joins, no longer than its own share, and leaves the readying
  running for the other.
- a frame that timed out is not asked again under the same action's deadline, so a click's press and release or a
  drag's later moves never wait on it, and for 3 s (the default action budget) after the timeout for callers
  without one. A later action asks again.
The numbers and why are in a comment beside them.

Tests:
- real host with only the child's Overlay.enable held: a 150 ms clickPoint sends move, press and release, asks the
  frame once, and the tab keeps its debugger. Before the fix it failed with "CDP operation exceeded its deadline before
  command dispatch".
- cdp.test.mjs: under one action's deadline, a stalled frame holds the first event about 200 ms and the later two not
  at all, and isn't asked again; a later action inside the cool-down doesn't wait. A 30 ms caller joining a 3 s
  caller's readying returns within its own share, and the readying finishes for the 3 s caller. A timed-out frame is
  asked again only after its cool-down (frameReadyRetryMs, set to 0 in the test).
Before the fix the stalled-frame test hung, as the input waited for the frame indefinitely, and the file was cut at
its 300 s limit.

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…e readying's own budget

Refs #610

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
… tracker (shipped under the last-wave ruling)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T01:55:22.122713Z 1ea8d46 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ea8d464de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +296 to +298
if (this.unbufferedInput && method.startsWith('Input.') && !isNested(target)) {
await this.readyInputFrames(target.tabId, options);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Ready frames before starting the click's load-classification window

On Linux, an auto-attached iframe that stalls during readying consumes up to 200 ms of the 250 ms navigation-classification window already started by CuaInput.clickPoint. This lets a click return successfully before a navigation it triggers even begins, allowing the next action to run against the outgoing document. With a scripted backend holding the iframe's enable and starting navigation 100 ms after release, the enabled path returned at 250 ms, before navigation; without readying, it waited for the load. Perform the optional readying before arming the click's classification window, while keeping the navigation listener active before dispatching mouse events.

Useful? React with 👍 / 👎.

Comment on lines +296 to +298
if (this.unbufferedInput && method.startsWith('Input.') && !isNested(target)) {
await this.readyInputFrames(target.tabId, options);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid optional frame setup between mouse press and release

On Linux, if an iframe auto-attaches after mousePressed, this hook readies the newly registered frame before sending mouseReleased. The per-action suppression does not help because that frame has not been attempted yet. A stalled frame therefore extends the button hold by up to 200 ms, changing gesture timing and consuming the remaining click budget after the press has already taken effect. A scripted-backend check reproduced a 202 ms hold with this change versus an immediate release without it. Run optional readying once before the gesture, or skip it for releases and held-button moves.

Useful? React with 👍 / 👎.

@SSFSKIM

SSFSKIM commented Nov 30, 2026

Copy link
Copy Markdown
Owner Author

ci-gate GREEN on the head 71ff9b5, which merges main 0274821 in (plugin, test-1, test-2, parity-browser): https://github.com/SSFSKIM/cua/actions/runs/46337523609

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)

@SSFSKIM
SSFSKIM enabled auto-merge (squash) November 30, 2026 02:16
@SSFSKIM
SSFSKIM merged commit 595e5f1 into main Nov 30, 2026
7 checks passed
SSFSKIM added a commit that referenced this pull request Nov 30, 2026
…nto 623; cua 0.31.4

Conflicts resolved:
- cdp.mjs executeTargetCdp: #620's readyInputFrames runs before an
  Input.* dispatch on the call's budget or the action's cap
  (setupOptions(setup)), carrying none of the call's dispatch hooks or
  its effect; its failures stay swallowed, so a readying failure never
  carries the effect's mark nor counts as the effect sent. prepareDispatch
  keeps #623's setup budget.
- cdp.mjs ensureAttachedTab's comment: #620's input readying among the
  setup commands, #623's joiner on its own deadline.
- input.mjs clickPoint's comment: #623's budgets and #620's note on
  events answered one by one.
- tech-debt-tracker.md: both sides' entries.

After the merge:
- cdp.test.mjs's #620 real-host test detached the tab with a caller's
  50 ms limit, which #623 no longer lets detach (only the host's own
  limit does); it now has Chrome take the debugger (addForeignFrame), as
  #623's detach test does.
- chrome-time-bounds: #620's frame readying before an effect's press
  runs before the dispatch hook and its failure (a stall, a refusal) is
  swallowed; the press is sent once.
- plugin.json and marketplace.json: 0.31.4 (the coordinator allocates
  the final number).

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant