Repository navigation
Conversation
…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)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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)
There was a problem hiding this comment.
💡 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".
| if (this.unbufferedInput && method.startsWith('Input.') && !isNested(target)) { | ||
| await this.readyInputFrames(target.tabId, options); | ||
| } |
There was a problem hiding this comment.
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 👍 / 👎.
| if (this.unbufferedInput && method.startsWith('Input.') && !isNested(target)) { | ||
| await this.readyInputFrames(target.tabId, options); | ||
| } |
There was a problem hiding this comment.
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 👍 / 👎.
|
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) |
…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)
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.enableand thenOverlay.enable, on Linux only. Blink then stops making input wait for a frame. In Chromium 158's source,InspectorOverlayAgent::enablecallsSetNeedsUnbufferedInputForDebugger(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:
touchmoved an earlier turn's tab into the current one;passiveflag 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)sendsDOM.enableand thenOverlay.enable. It runs:ensureAttachedTabright after focus emulation, so at every attachment, a reattach included;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, andOverlay.enableaffects only the enabled target's widget, so the frame needs its own.Target.attachedToTargetandTarget.detachedFromTarget. It is kept apart from the frame-session maps, which forget a live session on aframeDetachedswap.preserveDebuggerOnTimeout. A stalled frame then costs only its own readying, never the tab's debugger.Overlay.enableisn't sent onceDOM.enableis refused;src/browser-service/session.mjs: the controller's option is set forplatform === 'linux'only.src/browser-service/input.mjs:clickPointis main's, plus a dated comment on why sending the events back to back was dropped.extension/, the host andbackend.mjsare unchanged.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.mjsis 61 of 61.['mouseMoved','mousePressed','mouseReleased']where['mouseMoved']was expected. Against main'scdp.mjs, 4 readying tests failed.Overlay.enableheld, 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:
frameDetachedswap keeps it;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/):BrowserSessionwithcua_click,cua_dragandcua_scroll.postMessageso that no frame lookup came before the clicks.DOM.documentUpdatedwith them, from the navigation. This was on a page that added a node every 100 ms; cua never callsDOM.getDocumentorDOM.requestNode, so no mutation events were sent.Ruling 1307's two conditions:
linux-158/shots/.(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
tech-debt-tracker.md.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.src/browser-service/cdp.mjs:296-298, the window at:470).clickPointstarts 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.cdp.mjs:296-298). The readying runs before everyInput.*, the release included, and a frame first seen aftermousePressedisn'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
Page.frameDetachedwith reasonswap. Right after an out-of-process frame auto-attaches, Chrome reports the frame detached with reasonswap, while its target stays alive. The controller, as ported from the vendor, ignores the reason and drops the session from those maps. A later read in that frame would attach its target again. This PR's readying registry is kept apart from them, so it isn't affected. Found during this PR's iframe run; not changed here.Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)