Skip to content

test(ui): make Control UI E2E captures byte-reproducible - #165353

Merged
steipete merged 1 commit into
mainfrom
steipete/ui-capture-determinism
Oct 5, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/ui-capture-determinism

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Control UI screenshot captures were not reproducible, so exact pixel gates could not tell a real visual change from capture noise. In the l357 deslop lane (#164577 evidence), re-capturing unchanged main source matched only 31/52 of its own saved captures, three back-to-back passes of one head matched 138, 134 and 130 of 150 pairs, and several element captures contradicted the matching rectangle of their own full-page capture.

There are no committed reference images (the E2E skill forbids committing generated screenshots). The 150 targets come from four lane-owned parity specs that run through the shared Control UI E2E harness (createControlUiE2eSuite, the mock Gateway, control-ui-e2e-screenshot.ts). So the fix belongs in that harness, plus one product bug it surfaced.

User Impact

Operators who enable the OS reduced-motion preference now get modal dialogs that open and close without entrance or exit animation; previously only drawers honored it. For maintainers, Control UI screenshot captures from the shared E2E harness become reproducible enough for exact pixel gates, so visual-parity checks stop flagging unchanged source.

Why This Change Was Made

Root causes and fixes

Cause Evidence Fix
Page and element proofs were separate browser captures, rasterized independently Element vs own page rectangle: 30/40, 25/40, 25/40 exact on the unchanged harness; up to 1,200 px takeControlUiScreenshotFrame takes one unclipped viewport frame and derives every element crop from it (integer-enclosed, dimension- and bounds-asserted). takeControlUiElementScreenshot now uses the same path.
Scroll position was history-dependent and could be reset after centering Narrow Communications capture at scrollTop 510 vs 0 (203k–368k px), one pass lost the target entirely Always center the requested target, verify the centering survives settling and the capture, and check viewport/scroll-clip intersection.
Lazy images not decoded at capture 399 px topbar icon, 1,081 px behind a modal Decode visible images and repeat readiness after scrolling until a fixed point (no capture retries).
A fixed Date does not pause timers Transient Saved footer cleared mid-capture (2,616 px) Fixtures install page.clock and pause it; readiness waits on native layout delivery (IntersectionObserver), not rAF, so it never advances the fixture clock.
Ordinary modals ignored prefers-reduced-motion (product bug) E2E contexts request reduced motion, yet wa-dialog ran 150 ms scale/opacity entrances; the resulting paint history moved dialog text by exactly 1 px between runs (259 px and 1,013 px) modal-dialog.ts: the reduced-motion rule now covers ordinary dialogs (show and hide), not just drawers. Browser regression fails before, passes after.
Crop targets hidden via visibility were accepted Autoreview finding; blank crop accepted checkVisibility({ checkOpacity: true, visibilityProperty: true }).
Partial tile rasterization Sparse stroke/border noise across passes Shared suite launches Chromium with --disable-partial-raster (caller args preserved).

Renderer experiments that did not hold up under repeat proof (forced SwiftShader/ANGLE, full-compositor-pipeline, Skia CPU, zero Skia resource cache) were removed rather than kept as cargo.

Evidence

Reproducibility (macOS, nice -n 10, all 4 parity specs, 32 scenarios, 150 targets, exact decoded RGBA, no tolerance/masks/exclusions)

Pairs exact /150 Element vs own page
Before (unchanged harness) 131, 129, 134 (one pass also lost a target) 30/40, 25/40, 25/40
After, final head b3eef54c555 pass1–2 150, pass1–3 150, pass2–3 150; reference–pass1/2/3 149 each 40/40 in every run

PNG bytes match wherever RGBA matches. Every after-run completed 32/32 scenarios with complete, equal-dimension inventories.

Remaining residual (not hidden): plugins-grouped-catalog-desktop.png differed by 13 px in the reference run only. Focused repeats reproduce two sparse raster variants (the catalog card corners, and the top anti-aliased edge row of the Telegram modal's gradient header over a blurred backdrop) at roughly 2–3 in 6. Attribution is blocked by an observer effect: Chromium's LayerTree inspection forces a full repaint, and every instrumented run was exact. This sits below the harness, at the Chromium/Skia raster level, and is a follow-up rather than something to mask.

Gates (final head, Linux Testbox)

  • pnpm tsgo:ui passed (39 s), pnpm tsgo:test:ui passed (279 s)
  • scoped oxlint / oxfmt passed; git diff --check clean
  • ui/src/components/modal-dialog.browser.test.ts: 11/11 (5 s)
  • ui/src/e2e/initial-connect-splash.e2e.test.ts --maxWorkers=1: 13/13 (41 s). The file carries the frame/clock/scroll/hidden-crop regressions and now uses the existing awaitInitialRoster: false for the held-chat-module case, which was a proven readiness wait cycle.
  • The other 21 E2E files importing the changed screenshot exports: 126/126 (116 s)
  • Codex autoreview clean through P2

Notes

  • User-visible change: modal dialogs open and close without animation when the OS reduced-motion preference is on (documented in docs/web/control-ui/settings.md).
  • .agents/skills/control-ui-e2e/SKILL.md documents the single-frame capture contract and the paused-clock rule for transient states.
  • The parity specs used as proof inputs are not committed; they and every capture/report are retained locally for follow-up.

Capture related page and element proofs from one prepared viewport frame. Wait for stable layout, visible targets, fonts, and images without advancing paused fixture clocks; reject hidden crops.

Honor reduced motion for ordinary modal dialogs as well as drawers, preventing entrance-animation paint history from changing captures. Disable partial rasterization in the shared browser suite.
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: L labels Oct 5, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 2:01 AM ET / 06:01 UTC (Revision 2).

ClawSweeper review

What this changes

The PR stabilizes Control UI browser screenshot preparation, derives related crops from one captured frame, and makes modal dialogs honor reduced motion.

Merge readiness

✅ Ready for maintainer review

The PR remains useful: current main lacks the shared-frame capture preparation and ordinary-dialog reduced-motion fix. This follow-up review found no actionable introduced defect, and the supplied browser results support the changed behavior.

Priority: P2
Reviewed head: b3eef54c555e1e9512f845a3693c93c054b12c14

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, coherent repair with specific browser results and meaningful regressions; no blocking correctness finding was identified.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied final-head macOS browser comparisons exercise the changed shared capture harness across 32 scenarios, showing exact repeated frames and matching crops; browser lifecycle regressions cover reduced-motion dialogs. A small renderer residual is disclosed, and retained artifacts were unavailable for independent inspection. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied final-head macOS browser comparisons exercise the changed shared capture harness across 32 scenarios, showing exact repeated frames and matching crops; browser lifecycle regressions cover reduced-motion dialogs. A small renderer residual is disclosed, and retained artifacts were unavailable for independent inspection. No stored-data contract changes.
Evidence reviewed 7 items Pinned introduced change: Reviewed the merge-base-to-head changes and complete screenshot helper. Static preparation stays active during capture, crops derive from the retained PNG, and preparation cleanup runs in finally.
Current main still needs the repair: Fetched main retains the older screenshot helper without shared-frame preparation; its reduced-motion rule covers drawer entrance duration only. No verified merged replacement fixes this requested behavior. The supplied latest release predates this PR; local release-tag inspection was unavailable.
After-fix browser evidence: The captured PR body reports macOS Chromium runs through the shared harness: 32 scenarios and 150 targets per run, all three final-head pairings exact, and 40/40 element crops matching their own page rectangles. Reference comparisons matched 149/150 targets, with the remaining 13-pixel raster variation disclosed. These results exercise the changed browser capture owner; retained local artifacts were not independently available here.
Findings None None.
Security None None.

How this fits together

Control UI browser tests feed rendered pages and selected elements into shared screenshot helpers, producing evidence for visual comparisons. The modal component also translates the operating system’s motion preference into dialog animation behavior.

flowchart TD
  A[Browser fixtures and selected elements] --> B[Settle layout fonts images and scroll]
  B --> C[Capture one viewport frame]
  C --> D[Page image and matching crops]
  E[Operating system motion preference] --> F[Modal animation durations]
  F --> B
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +2, Tests +544, Docs +7. Total +553 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 0 +2
Tests 4 580 36 +544
Docs 2 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 589 36 +553

Review metrics

Metric Value Why it matters
Production versus test growth production +2 net lines; tests and test support +544 net lines Growth is concentrated in browser capture preparation and regression coverage, with only a two-line production accessibility repair.

Technical review

Best possible solution:

Keep one screenshot capture owner with explicit static preparation and preserve normal recording behavior while honoring reduced motion in the modal owner.

Do we have a high-confidence way to reproduce the issue?

Yes: current source shows ordinary dialogs omit the reduced-motion duration override, and the supplied unchanged-source browser comparisons establish capture variability. This review did not execute a reproduction.

Is this the best way to solve the issue?

Yes: the change extends the existing capture and modal owners, preserves existing helper entrypoints, and avoids tolerance masks or speculative renderer settings.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ef5f7c199dd7.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded browser-proof reliability improvement with a reduced-motion accessibility fix.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied final-head macOS browser comparisons exercise the changed shared capture harness across 32 scenarios, showing exact repeated frames and matching crops; browser lifecycle regressions cover reduced-motion dialogs. A small renderer residual is disclosed, and retained artifacts were unavailable for independent inspection. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied final-head macOS browser comparisons exercise the changed shared capture harness across 32 scenarios, showing exact repeated frames and matching crops; browser lifecycle regressions cover reduced-motion dialogs. A small renderer residual is disclosed, and retained artifacts were unavailable for independent inspection. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head changes and complete screenshot helper. Static preparation stays active during capture, crops derive from the retained PNG, and preparation cleanup runs in finally. (ui/src/test-helpers/control-ui-e2e-screenshot.ts:93, b3eef54c555e)
  • Current main still needs the repair: Fetched main retains the older screenshot helper without shared-frame preparation; its reduced-motion rule covers drawer entrance duration only. No verified merged replacement fixes this requested behavior. The supplied latest release predates this PR; local release-tag inspection was unavailable. (ui/src/components/modal-dialog.ts:171, ef5f7c199dd7)
  • After-fix browser evidence: The captured PR body reports macOS Chromium runs through the shared harness: 32 scenarios and 150 targets per run, all three final-head pairings exact, and 40/40 element crops matching their own page rectangles. Reference comparisons matched 149/150 targets, with the remaining 13-pixel raster variation disclosed. These results exercise the changed browser capture owner; retained local artifacts were not independently available here. (b3eef54c555e)
  • Focused regression coverage: Browser tests exercise standard and drawer opening/closing under reduced motion. Capture regressions independently compare crop pixels with page rows, reject hidden targets and oversized full-page captures, and preserve a paused Saved state despite scroll resets. The body reports 11/11 modal cases, 13/13 splash cases, and 126/126 importing E2E cases passing; this read-only review did not execute tests. (ui/src/e2e/initial-connect-splash.e2e.test.ts:866, b3eef54c555e)
  • Prior investigation supports the diagnosis: The investigation at refactor(ui): deslop control UI #164577 (comment) documents unchanged-source capture variation, element/page disagreement, and history-dependent scrolling. That merged refactor supplies problem evidence rather than superseding this harness repair.
  • Historical routing: Current-main history connects steipete to earlier recording-safe screenshot work and shared E2E lifecycle changes. GitHub commit metadata verifies the login for the earlier capture commit. Deeper blame failed because historical blobs were unavailable, so no source-line introduction claim is made. (ui/src/test-helpers/control-ui-e2e-screenshot.ts, 08324bb9ec4e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-05T05:27:49.075Z sha b3eef54 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit d73a255 into main Oct 5, 2026
107 of 110 checks passed
@steipete
steipete deleted the steipete/ui-capture-determinism branch October 5, 2026 06:34
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
…5353)

Capture related page and element proofs from one prepared viewport frame. Wait for stable layout, visible targets, fonts, and images without advancing paused fixture clocks; reject hidden crops.

Honor reduced motion for ordinary modal dialogs as well as drawers, preventing entrance-animation paint history from changing captures. Disable partial rasterization in the shared browser suite.
steipete added a commit that referenced this pull request Oct 7, 2026
Use CPU tile rasterization while retaining GPU composition and browser
capabilities. GPU rasterization kept different fractional-edge pixels after
otherwise identical layouts and modal reopen histories.

Add --disable-gpu-rasterization in both shared suite launch orders and
document the capture contract, retaining caller arguments and full-tile
rasterization. The audited A/B sample has 25 fixed launches with zero RGBA
or PNG-byte mismatches and 13 interleaved controls that reproduce the noise.

Validation: UI production/test typechecks, scoped lint and formatting,
20 lifecycle tests, 31 focused E2E tests, and independent Codex review.
Refs #165353.
steipete added a commit that referenced this pull request Oct 7, 2026
* test(ui): make screenshot rasterization reproducible

Use CPU tile rasterization while retaining GPU composition and browser
capabilities. GPU rasterization kept different fractional-edge pixels after
otherwise identical layouts and modal reopen histories.

Add --disable-gpu-rasterization in both shared suite launch orders and
document the capture contract, retaining caller arguments and full-tile
rasterization. The audited A/B sample has 25 fixed launches with zero RGBA
or PNG-byte mismatches and 13 interleaved controls that reproduce the noise.

Validation: UI production/test typechecks, scoped lint and formatting,
20 lifecycle tests, 31 focused E2E tests, and independent Codex review.
Refs #165353.

* refactor(ui): share the E2E suite browser launch options

Both server/browser launch orders now call one helper, so the capture
determinism flags cannot drift between them. Behavior is unchanged.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
…166414)

* test(ui): make screenshot rasterization reproducible

Use CPU tile rasterization while retaining GPU composition and browser
capabilities. GPU rasterization kept different fractional-edge pixels after
otherwise identical layouts and modal reopen histories.

Add --disable-gpu-rasterization in both shared suite launch orders and
document the capture contract, retaining caller arguments and full-tile
rasterization. The audited A/B sample has 25 fixed launches with zero RGBA
or PNG-byte mismatches and 13 interleaved controls that reproduce the noise.

Validation: UI production/test typechecks, scoped lint and formatting,
20 lifecycle tests, 31 focused E2E tests, and independent Codex review.
Refs openclaw#165353.

* refactor(ui): share the E2E suite browser launch options

Both server/browser launch orders now call one helper, so the capture
determinism flags cannot drift between them. Behavior is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant