Repository navigation
fix(browser): keep omitted window bounds and add getWindowBounds - #2772
Conversation
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review of a4d08fa
No blocking findings
- Correctness:
set_window_boundsnow merges per field withOption::or(moli-protocol/src/domains/browser.rs:395-399), which matches Chromium's "unspecified fields unchanged" and fixes the root cause named in #2767.windowStatewas already updated only when present.Browser.getWindowBounds(browser.rs:334-352) uses the same liveness check assetWindowBounds, and an unknown or closedwindowIdreturns-32000 Browser window not found, as Chrome does.BrowserAction::GetWindowBoundsis parsed by the existing strum camelCase mapping. Playwright's headful resize sequence still works: session-scopedgetWindowForTarget, thensetWindowBounds {windowId, bounds:{width,height}}, thengetWindowBounds. It also keepsleft/topnow. - Test: the extended
rust_cdp_capability_browser_window_bounds_round_tripfails on main twice: on the merged-rect assertion and onUnknownMethod. It asserts only Chromium behavior. - Cost: only the two handlers change. The numbers in the body are plausible.
- CI: Format, Clippy, Nextest, Build release and WebDriver smoke pass.
Native PDF rendering and linksfails, but the same job also fails on unrelated PRfix/rem-root-font-size, and this diff does not touch PDF code. The other jobs are pending. - Picture: pending.
Not counted (already on main, not caused by this PR): Chrome rejects setWindowBounds that combines a non-normal windowState with left/top/width/height. Chrome also rejects bounds-only resizes while the window is minimized, maximized or fullscreen ("restore it to normal state first"). moli accepts both and stores them. Worth tracking in a separate issue. #2777 (bounds not applied to the page) is also separate.
|
CI note: the failing "Native PDF rendering and links" job is not caused by this PR. It is a regression on |
CI Regression ReportSource CI run · source state at render:
Release regression — ✅ HEAD/base failures 0/0; raw binary +0.002703%Package and image size
Startup latency and PSS
Concurrency matrix
Frontend differential — ✅ 1,020/1,020 cases matched; 0 issues
Agent episodes · Moli vs Chromium — ✅ 8/8 Moli episodes passed; 0 failures
Runtime and CDP session contracts — ✅ 26 contract cases; 0 failures
CDP smoke — ✅ 116/116 groups passed; 1,680 scenariosWorkers: 4 · cumulative group time: 448.15 s · failed groups: 0
WebMainBench · 545 pages — ✅ 545/545 completed; 0 unexpected failures
Frozen HTML · Linux · Diagnostics: All artifact fields are parsed by the trusted default-branch renderer; missing or invalid inputs remain visible as unavailable. |
Sequential Navigation Soak A/B✅ HEAD completed the 200-navigation resilience and memory observation. One browser process, one target, and one CDP session navigate CSDN → SegmentFault → Huaban → example.com repeatedly. This run issued 200 Common ancestor Session resilience
A public-page failure is reported separately from an unrecoverable session. The soak requires all navigation attempts, zero failed recovery, zero lifecycle/network ordering violations, and complete resource evidence. Process-tree memory
HEAD memory by 50-navigation quarter
Raw reports and per-navigation boundary samples: workflow run and full Public-site timing and memory are observational. Use the A/B deltas and trend shape as evidence, not as a deterministic performance threshold. |
Spider Bench A/B✅ All benchmark browser service runs completed; results are informational. Public HEAD: 189 / 240 rows; 39 / 48 sites produced rows; 9 unexpected empty sites. ✅ Deterministic fixture contract is clean. Common ancestor Public 48-site run · informational
Public-site content, timing, and memory are noisy. This single A/B run reports evidence only; site outcome counts explain missing rows without treating them as a deterministic regression. CPU and memory timelinesThese are bounded 40-point views of the same complete process-tree samples used by the HTML report. CPU uses 100% per occupied logical core; memory lines are RSS first and PSS second when complete PSS samples are available. Basexychart-beta
title "Base CPU"
x-axis "Elapsed seconds" [1.039, 1.541, 3.042, 4.545, 5.546, 6.046, 7.548, 9.549, 11.051, 12.555, 14.056, 15.559, 17.063, 18.566, 20.069, 21.572, 23.073, 24.573, 26.075, 28.079, 29.581, 31.084, 32.585, 33.086, 34.087, 35.588, 37.089, 38.591, 40.093, 41.595, 43.097, 44.598, 46.6, 48.102, 49.604, 51.106, 52.607, 54.108]
y-axis "CPU percent" 0 --> 200
line [0, 1.99, 0, 2, 4, 0, 105.7, 138.06, 129.73, 161.68, 131.74, 105.8, 127.71, 29.94, 99.82, 85.82, 18, 0, 3.99, 3.99, 135.99, 109.72, 97.98, 113.74, 101.86, 77.92, 115.9, 115.83, 103.86, 77.97, 25.98, 133.79, 95.93, 9.99, 11.99, 133.88, 139.86, 129.95]
xychart-beta
title "Base memory: RSS then PSS"
x-axis "Elapsed seconds" [0.039, 1.039, 1.541, 3.042, 4.545, 5.546, 6.046, 7.548, 9.549, 11.051, 12.555, 14.056, 15.559, 17.063, 18.566, 20.069, 21.572, 23.073, 24.573, 26.075, 28.079, 29.581, 31.084, 32.585, 33.086, 34.087, 35.588, 37.089, 38.591, 40.093, 41.595, 43.097, 44.598, 46.6, 48.102, 49.604, 51.106, 52.607, 54.108, 55.417]
y-axis "Memory MiB" 0 --> 500
line [14.11, 56.88, 57.08, 57.09, 57.11, 62.99, 62.99, 104.28, 127.93, 146.91, 141.75, 137.55, 152.96, 134.79, 127.66, 136.6, 145.97, 119, 123.87, 122.73, 121.77, 151.1, 139.94, 240.89, 248.66, 189.89, 133.73, 173.38, 149.39, 137.98, 129.24, 140.53, 212.99, 242.48, 149.96, 136.3, 150.14, 175, 138.29, 0]
line [11.3, 53.87, 54.08, 54.08, 54.1, 59.99, 59.99, 101.28, 124.91, 143.84, 138.71, 133.73, 149.67, 131.76, 124.59, 133.64, 142.88, 115.91, 120.78, 119.65, 118.69, 148.01, 136.83, 237.85, 245.12, 186.78, 130.71, 172.83, 146.27, 134.85, 126.1, 137.38, 210.13, 241.17, 146.81, 133.15, 147.02, 171.85, 135.34, 0]
HEADxychart-beta
title "HEAD CPU"
x-axis "Elapsed seconds" [1.039, 1.54, 3.043, 4.545, 5.547, 7.051, 8.553, 10.055, 11.558, 13.061, 14.062, 15.565, 17.067, 18.569, 20.072, 21.575, 22.576, 24.077, 25.577, 27.079, 28.582, 29.083, 30.083, 31.085, 32.586, 34.089, 35.591, 37.092, 38.594, 39.596, 41.096, 42.598, 44.099, 45.601, 47.104, 48.105, 49.607, 50.107]
y-axis "CPU percent" 0 --> 200
line [0, 3.99, 97.83, 105.92, 131.74, 123.62, 97.85, 129.66, 87.85, 115.68, 59.97, 27.95, 0, 4, 69.81, 137.61, 2, 0, 99.89, 81.84, 107.8, 101.84, 123.88, 127.71, 119.92, 131.81, 121.77, 105.87, 23.96, 39.95, 2, 83.96, 11.98, 47.94, 113.83, 113.88, 137.84, 171.87]
xychart-beta
title "HEAD memory: RSS then PSS"
x-axis "Elapsed seconds" [0.038, 1.039, 1.54, 3.043, 4.545, 5.547, 7.051, 8.553, 10.055, 11.558, 13.061, 14.062, 15.565, 17.067, 18.569, 20.072, 21.575, 22.576, 24.077, 25.577, 27.079, 28.582, 29.083, 30.083, 31.085, 32.586, 34.089, 35.591, 37.092, 38.594, 39.596, 41.096, 42.598, 44.099, 45.601, 47.104, 48.105, 49.607, 50.107, 51.054]
y-axis "Memory MiB" 0 --> 500
line [14.07, 57.22, 63.5, 113.11, 118.53, 129.18, 155.91, 134.6, 154.09, 141.86, 137.19, 135.48, 123.97, 124.22, 124.6, 139.83, 120.63, 118.04, 119.52, 150.78, 137.22, 203.93, 264.76, 179.93, 186.57, 169.1, 145.09, 154.34, 153.38, 131.68, 138.57, 139.32, 141.13, 142.73, 140.85, 163.73, 154.25, 158.47, 176.94, 0]
line [11.17, 54.2, 60.48, 110.34, 115.85, 126.17, 152.82, 131.66, 151.27, 138.81, 134.04, 132.39, 120.88, 121.13, 121.51, 136.98, 117.53, 114.94, 116.43, 148.11, 134.15, 204.82, 262.71, 176.84, 183.53, 166.02, 142.04, 151.3, 150.32, 128.64, 135.52, 136.27, 138.08, 139.68, 138.82, 160.78, 151.21, 155.52, 173.93, 0]
Deterministic fixture · required contractThe fixture exercises 15 routes: 8 are expected to emit rows and 7 intentionally exercise empty, loading, or timeout behavior.
Full HTML, JSON, CSV, logs, and page snapshots: workflow run and full The public-web A/B is informational. The exact HEAD fixture contract runs as a separate required CI check; timing and public-site content deltas remain non-blocking. |
8c4e086 to
b5de91a
Compare

**Track:** Trajectory Replay (Browser Eval). Replaces part of #731.Closes #2767.
Replaces part of #731.
Problem
Browser.setWindowBoundswith a partial rectangle (for example{width: 800}after{left: 10, top: 20, width: 900, height: 700}) erasedleft,topandheight; Chromium keeps omitted fields.Browser.getWindowBoundsreturned-32601 UnknownMethod. Repro:Target.createTarget,Browser.getWindowForTarget, the twosetWindowBoundscalls above, thengetWindowForTarget/getWindowBounds.Reproduce (steps from #2767)
Target.createTarget, thenBrowser.getWindowForTarget {targetId}to getwindowIdBrowser.setWindowBounds {windowId, bounds: {left:10, top:20, width:900, height:700}}Browser.setWindowBounds {windowId, bounds: {width:800}}Browser.getWindowForTargetandBrowser.getWindowBounds {windowId}Expected (Chromium)
Both calls return
{left:10, top:20, width:800, height:700, windowState:"normal"}. Fields omitted fromsetWindowBoundsare kept.Actual
getWindowForTargetreturns{windowState:"normal", width:800}:left,topandheightare erased.getWindowBoundsreturns{"code":-32601,"message":"UnknownMethod"}.Change
moli-protocol/src/domains/browser.rs:set_window_boundsonly overwrites the fields present in the request (it previously assigned all fourOptions unconditionally). Newget_window_boundsreturns the stored bounds for a live window, sharing the existing liveness check (moved intowindow_is_live) and returning-32000 Browser window not foundotherwise.moli-protocol/src/domains/actions.rs: addBrowserAction::GetWindowBounds.rust_cdp_capability_browser_window_bounds_round_tripnow also sets onlywidth, reads the merged rect back throughBrowser.getWindowBounds, and checks the unknown-window error.Verification
Repro over CDP against
moli serve(before: released v1.1.23 binary; after: debug build of this branch):cargo fmt --all: clean.cargo clippy -p moli-protocol --all-targets --all-features -- -D warnings: passed.cargo nextest run -p moli-protocol -E 'test(browser_window_bounds) | test(browser_owner) | test(command_dispatch)' --no-fail-fast: 80 passed.Cost
Debug builds of
origin/main(f935014) and this branch,/usr/bin/time -l, median of 5 runs, two interleaved rounds (the host was shared, so absolute times vary between rounds):moli serve)moli fetchof a local 46 KB articleThe change only touches the
Browser.setWindowBounds/Browser.getWindowBoundshandlers (anOption::orper field and a map lookup); no page, layout or navigation path is involved.