Repository navigation
cua: a let-go lease's undo waits for the page's size, and the tab's next lease waits for the undo (browser-cua :186, E13) - #166
Merged
Merged
Conversation
…gain, and the tab's next lease waits for it browser-cua :186 (the 2026-10-24 P4-W row): Chromium 152 answers Emulation.clearDeviceMetricsOverride before the view's restored size reaches the page. Measured on the mini and three hosted Macs (2026-10-26, a throwaway diag branch): the undo answered in 0 to 10 ms, never near RESET_BOUND_MS, while the page (innerWidth and Page.getLayoutMetrics alike) still read the override's 800 for up to 83 ms after the clear's reply, in 1 to 9 of 30 tries per run; one hosted run reproduced :186 itself with the undo answered in 1 ms. So the release bound was not the cause, and awaiting the reply is not enough. - The undo of a cleared override now waits until the page's layout viewport is its view's size (a scrollbar and the page's zoom allowed), polling Page.getLayoutMetrics through the lease's attachment, never once it has ended. - The release still answers the host's detach within RESET_BOUND_MS, and logs the tab and what is still out (method names, or the page size; never params) when the bound passes first. - The tab's next lease, from this connection or another, waits for that undo (TabClaims `undoing`), which settles by UNDO_WAIT_MS (2 s) from the letting go, logged when it does unfinished: a hung undo cannot wedge later attaches. This also closes the E13 row of 2026-10-08 (an undo answering late after the next lease's toggles). Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
The review's finding: an attach queued behind the previous lease's undo (or behind its own connection's release) resumed after its connection had closed and went on to load a suspended tab and lease its debugger for nobody, taking a loaded-tab slot. The retry now refuses at once on a closed connection. The two timed cases gain upper bounds. Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Codex Review SummaryThis 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. |
SSFSKIM
added a commit
that referenced
this pull request
Oct 26, 2026
…ndo, the page's size included; PR #166); gate-offload Decision Log 114 (browser-cua meets the hosting rule); tracker: three browser-cua and E13 rows closed, four logged, :493's row rewritten Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When a cua connection lets go of a tab's lease, its undo of the agent's CDP toggles now counts as done only once the page reads its view's size again, if the undo cleared a device-metrics override. The tab's next lease, from this connection or another, starts only after that undo is done. Both waits are bounded. Closes the cause of the 2026-10-24 P4-W row (
e2e/browser-cua.spec.ts:186) and the 2026-10-08 E13 row (a late undo overtaking the next lease's toggles).Cause (measured, not assumed)
The release bound (
RESET_BOUND_MS) was never what failed. Throwaway diagnostic runs on Electron 44 / Chromium 152 (2026-10-26; mini run 40311614893, hosted maws-app 40311728565, 40312068417, 40312071190) logged every release and timed the reads:Emulation.clearDeviceMetricsOverride's reply, with no detach at all, the page still read the override's 800 (innerWidth andPage.getLayoutMetricsalike) in 8, 1, 5 and 9 of 30 tries. It read the parked 1280 up to 83 ms later;So Chromium answers the clear before the view's restored size reaches the page, and waiting for the reply alone is not enough. The browser-side handler does return
FallThrough"so that the response is only sent to the client once updates were applied", but the restored view size reaches the page separately.Fix
filter.tsreadsViewSize: the page's layout viewport against its view's bounds, at the page's zoom, with a scrollbar's width allowed.connection.ts: the undo pollsPage.getLayoutMetricsafter a cleared override until the page reads its view's size. It stops if the attachment ends and never sends to a detached tab, since that would re-attach it. The host's detach reply still waits at mostRESET_BOUND_MS(1 s). When the bound passes first, a log line names the tab and what is still out (method names orthe page size, never params). The undo is registered inTabClaims(undoing/undoOf), and a new attach waits for it. It settles byUNDO_WAIT_MS(2 s) from the letting go, logged when it settles unfinished, so a hung undo cannot wedge later attaches.Verified with a second diagnostic on top of the fix (40 detach/reattach cycles per run): 0 wrong reads on the mini (40314152517) and on a hosted Mac (maws-app 40314235301). Detaches that waited for the page's size took 22–30 ms on the mini; on the cold hosted box the first three took 59, 118 and 489 ms. No undo line was logged.
Gates (head 5662a4c)
--runner macos),e2e:browser-cua7/7 four times: 40316186184 (withunit:darwin, 17 files, 360 tests), 40316186362, 40316177141, 40316186658.Lane: hosted),e2e:browser-cua7/7 three times: MAWS 40316175010, 40316176207, 40316176658 (maws-app 40316228913, 40316269166, 40316269931). :186 and :493 passed in all three; no undo line was logged.Review
doperpowers:reviewer-medium returned two P2 findings:
readsViewSize's fixed 24-DIP scrollbar allowance accepts an override within 24 DIP of the view's size as restored, and makes a page with a custom scrollbar wider than that wait out the bounds (1 s release, logged). Deferred as residue:Page.getLayoutMetricshas no scrollbar-inclusive reading. A main-worldinnerWidthread can be shadowed by the page ([Replaceable]), and an isolated world's context event would reach the agent's lease. The reviewer agreed the deferral is coherent, noting that a near-size miss weakens the restoration guarantee (a few pixels can cross a responsive breakpoint).Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)