Repository navigation
test(ui): assert smooth scroll intent instead of frame counts in chat-motion e2e - #160506
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 11:11 AM ET / 15:11 UTC. ClawSweeper reviewWhat this changesThe PR changes the Control UI chat-motion browser test to check for a smooth scroll request, absence of synchronous jumps, and arrival at the transcript end instead of counting sampled animation frames. Merge readiness✅ Ready for maintainer review Current main still has the frame-count assertion that can fail when Chromium samples a smooth scroll only twice. This focused PR addresses that test flake, and the reported throttled-browser runs support the change; it remains useful for review. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI browser test sends a chat message through a mocked Gateway and observes how the transcript moves in Chromium. Its assertions determine whether the chat-motion check passes in CI. flowchart LR
A[Mock chat history] --> B[Control UI send]
B --> C[Transcript scroll controller]
C --> D[Chromium scroll]
D --> E[Motion probe]
E --> F[Browser test result]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +21. Total +21 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep a browser-level chat send check that verifies smooth scroll intent, guards against synchronous jumps, and confirms the final viewport position without depending on the runner's frame rate. Do we have a high-confidence way to reproduce the issue? Yes. The current-main assertion and the reported CDP-throttled Chromium run give a high-confidence path to the two-sample failure; I did not execute the scratch throttle injection in this read-only review. Is this the best way to solve the issue? Yes. Checking the scroll command and settled viewport removes the frame-rate dependency while retaining the existing prompt-opacity and synchronous-jump checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 03f92a56beca. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…-motion e2e (openclaw#160506) Co-authored-by: VACInc <[email protected]>
Summary
High Level TLDR
chat-motion.e2e.test.tsflakes on CI withexpected 2 to be greater than 2, including on PRs that do not touchui/. The check counted distinctscrollTopvalues seen by arequestAnimationFramesampler. That count measures the runner's frame rate, not the product. This PR replaces it with deterministic checks of the page's side of the contract: a smooth scroll is requested while the viewport is still away from the end, no scroll command jumps instantly, and the viewport ends at the transcript end. Test-only change; no product code changes.Root Cause
finishSendMotionassertednew Set(visible.map((frame) => frame.top)).size > 2(line 81, added by fix(ui): prevent chat jumps and prompt flicker when sending #160109). Chromium runs smooth scrolling as a time-based animation. When the main thread is starved, rAF callbacks fire rarely, and the whole scroll can finish between two samples. The sampler then sees only{start, end}and the count is exactly 2.checks-ui-e2e (2/9)failed themultilinecase (4105 ms). Run 36423624274checks-ui-e2e (8/9)failedmultiline(5325 ms). Run 36421667092checks-ui-e2e (2/9)faileddesktop(7852 ms). The same cases take about 2.5 s locally, so those runners were heavily loaded. The failed cases are the three non-reduced-motion cases that make this assertion.Emulation.setCPUThrottlingRatethrough CDP right after the probe was installed, and logged the probe data.scrollTocalls aresmoothwith a synchronous jump of 0; final end distance is 0.rate: 10: 4–5 distinct tops; still passes.rate: 30: tops[4031, 4229],[4195, 4374], etc. 3 of 4 cases fail with the exact CI errorexpected 2 to be greater than 2. In the failing cases the product did the right thing: every command wassmooth, every synchronous jump was 0, and the final end distance was 0.Exact change
ui/src/e2e/chat-motion.e2e.test.tsonly:thread.scrollTointerceptor (the one that already feeds the instant-jump check) now also records each call'sbehaviorand the distance to the end when the call was issued (remaining).scrollTowithbehavior: "smooth"issued whileremaining > 8, andscrollHeight - scrollTop - clientHeight <= 8(the product'sCHAT_TRANSCRIPT_END_THRESHOLD_PX).What the frame count was protecting: the send moves the viewport as an animation rather than a snap. Checks 1 and 2, together with the existing instant-jump check, still prove that. The viewport travels more than 8 px to the end, a smooth command carries it, and no command jumps. They also still catch a snap that comes before the smooth scroll. As a mutation check, I made queued manual scrolls set
scrollTop = scrollHeightbeforeapplyChatScroll. All three motion cases then failed on the new assertion (remaining: 0on every smooth call), and reduced motion still passed. The browser's own interpolation is Chromium's contract; the test no longer depends on how many frames the runner can paint.Scope boundary: this is one flake in one file. I found an unrelated flake in
sidebar-selection-overflow.e2e.test.tsduring the shard runs. It also reproduces on unmodifiedorigin/mainand is not addressed here (see Verification).Real behavior proof
setCPUThrottlingRate(30)injection, applied to the fixed test: 3/3 runs, 4/4 tests passed. At that throttle rate the original fails 3/4 tests (above).What was not tested
scrollTopassignments made during an in-flight smooth scroll are not intercepted. The old frame count only caught those when frames were plentiful, so it was not a reliable guard either. The probe did not observe any directscrollTopwrites during sends in the unthrottled or throttled runs.$autoreviewwas not run for this test-only diff.Verification
Flake validation
pnpm test:ui:e2e ui/src/e2e/chat-motion.e2e.test.tsexpected 2 to be greater than 2pnpm test:ui:e2e ui/src/e2e/chat-motion.e2e.test.tschecks-ui-e2e (2/9)in recorded order ×4 (fixed head)OPENCLAW_UI_E2E_SKIP_REAL_GATEWAY=1 OPENCLAW_VITEST_INCLUDE_FILE=<include list decoded from the job's OPENCLAW_NODE_TEST_GROUPS_GZIP_BASE64> node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner --maxWorkers 3 --shard 2/8sidebar-selection-overflow.e2e.test.ts"overflow=true at 1280 px", 231 s and 232 s)origin/mainsidebar-selection-overflowfailed 2/2, so it is pre-existing and unrelatedpnpm test:ui:e2eonchat-scroll,chat-scroll-dock,chat-collaborator-scroll,chat-follow-maintenance,chat-send-pending-handoff,chat-send-ack-ownership,chat-composer-input-measurement,chat-flow.messagingThe shard's include list has 667 patterns, and all of them exist on this base, so
--shard 2/8selects the same 79 files as the failing job. The decoded list comes from the job's env. Only two of four fixed-head shard runs were fully clean, so the "3 clean shard runs" bar is not met. The shard noise is the separatesidebar-selection-overflowflake, which fails on base too. The chat-motion file passed in every shard run.Other checks
pnpm exec oxfmt ui/src/e2e/chat-motion.e2e.test.ts: clean.pnpm exec oxlint ui/src/e2e/chat-motion.e2e.test.ts: clean.git diff --check: clean.node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.ui-e2e.json: pass (13 s).node scripts/check-changed.mjs: fails only onconfig/env-var-count-budget.txt: OPENCLAW_* count 484 exceeds budget 483. The same failure occurs with the base version of this file, and this diff adds no env vars, so it is pre-existing onorigin/main.Test cost
No new tests. The standalone file wall is 22.3–24.7 s after the fix, versus 24.0–26.8 s before. Per-case durations are unchanged (about 2.5 s). No timers, sleeps, retries, or timeout changes were added.
Inherited CI failures (admin exception)
Exact-head run 36441076802 is red only in UI e2e shards 1/9, 4/9, 5/9, 7/9 on tests in other spec files (
chat-flow.sidebar-presentation,session-owner-filter-keyboard,chat-user-avatar-alignment,model-catalog-partial-refresh,chat-session-companion-focus), all red on main's own scheduled runs 36437289300 / 36444547317 since d769e31 (#160002). This PR changes onlyui/src/e2e/chat-motion.e2e.test.ts(whose tests pass) and no shared helper. ClawSweeper: no findings. Landed under the AGENTS.md pre-existing-red exception by the maintainer.