Skip to content

fix(ui): keep transcript content steady while scrolling upward - #194751

Merged
steipete merged 11 commits into
mainfrom
solid2/w-perf-transcript-cls-1107
Nov 8, 2026
Merged

steipete merged 11 commits into
mainfrom
solid2/w-perf-transcript-cls-1107

Conversation

@steipete

@steipete steipete commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Scrolling upward into newly measured transcript rows could move messages already on screen. The anchor covered rows above the viewport but missed newly revealed predecessors inside it. Applying the correction with scrollTo also discarded native WebKit wheel input.

The existing reader anchor now compensates those predecessors and holds corrections in the existing row column during qualified native input. At native zero, the first row owns the position; a lower retained row must not pull the reader away from the top. Programmatic startup/composer motion retains its existing positioning behavior. Retention, row estimates, history admission, and Markdown reconciliation remain unchanged.

Evidence

Current replacement head: 59f18f98840, after merging main 4af0013a2c5 (runtime bundle built at 0cbf0105b80; subsequent commits change only the test allocation and cap/comment). The coordinator accepted the byte tradeoff. Native replacement-head recovery landed this exact head as d59f00281eb02167a86b57c42f04b2b59ed203fe and completed managed checkout cleanup. The full timing and frame evidence below is reused because main did not change either transcript owner.

The first CI run exposed history-loading and composer-rail regressions from treating all virtualizer motion as native input. The second exposed three short-transcript top-boundary regressions. All were reproduced through the existing E2E tests against frozen production bundles and repaired without weakening assertions. The final repair also adds a native ResizeObserver case for a positive height correction at zero, and shares a stateless test fixture to stay within the existing test-line allowance.

Proof Result
History loading, composer rail, native-wheel pagination, archive flow Passed after qualifying reader input; exact-head full CI also passes
Narrow subagent report, content copy, image lightbox All three fail on previous candidate, pass on merge base, pass on current production bundle
Native anchor cases 5 pass; new positive-height-at-zero case fails before its fix
Transcript geometry consumers 28 pass
Page observer identity 3 pass
UI typecheck; targeted lint/format; production Knip Pass
Current-main merge checks UI typecheck and 30 focused tests pass; the archive conflict regression passes; Chromium/WebKit desktop/mobile scroll smoke passes with zero browser/resize errors. The installed Firefox executable is missing, so its completed full-matrix proof is reused.
Test-line ratchet Own allocation corrected 140→158, exactly net added test/helper lines; inherited 22-line debt also fails on current main
Independent P0–P2 review No actionable findings in full change, subsequent repairs, or final cap-only change
Prior integration CI Run 42437623374 failed on a read-coalescing case and test-line ratchet; repairs and baseline attribution below
Full CI before current-main merge Run 42409879991 succeeded, including full UI E2E and real-Gateway shards
Final scroll qualification 360/360 pass, plus 30/30 extra Firefox mobile observations; desktop task CPU −6.57% median / −7.79% p95
Final streaming qualification 780/780 pass: 20 rotated triplets per engine/viewport/flow, plus 10 additional Chromium typing triplets per viewport
Retention Mounted DOM unchanged; existing forced-GC lifecycle contracts pass in full CI. No browser heap-neutrality claim

The completed scroll timing comparison uses merge base fe2b1a51b41 and the corrected production bundle, with 20 rotated base/head/base triplets in Chromium, WebKit, and Firefox. Separate cells cover desktop native wheel traversal, mobile instant jump, steady streaming, and streaming while typing. The stopped previous-head run had 140 passing observations; it is incomplete and unqualified. Current-head desktop traversal wall median/p95 changes are Chromium −4.60%/−5.52%, WebKit −9.57%/−14.08%, Firefox −7.32%/−18.17%. Mobile is neutral. Firefox mobile received 10 extra triplets: combined 30-pair head +1.02%/+2.27%, unchanged-base control −0.01%/+12.56%; the extra batch reversed the head tail while control spread exceeded the effect.

The streaming comparison completes all 720 observations, then 60 targeted observations resolve small typing-timing uncertainties. Every observation retains all 645 deltas, 400 messages, native input, and tail follow, with zero browser/resize errors. Chromium renderer task CPU median/p95 changes are:

Streaming flow Desktop Mobile
Steady, no input (20 triplets) −0.69% / +0.03% +0.17% / −2.01%
While typing (30 triplets) +0.44% / +0.07% +0.26% / +0.76%

These are neutral streaming results. The desktop typing input-to-frame median moves by 0.505 ms (+3.31%); its tail is +1.69% versus A/A +2.77%, with unchanged frame cadence. The mobile typing CPU tail contracts from the initial +3.15% to +0.76% after the extra triplets. Firefox mobile steady-frame p95 is noisy: 33.337→49.993 ms, with the unchanged-base control also at 50.000 ms. Host load ranges from 8.254 to 89.053 on 32 CPUs. That shared tail is not a head-specific regression, and these measurements do not claim universal frame neutrality. WebKit/Firefox CPU and CLS counters remain unavailable.

Bytes and scope

Complete production builds on the same machine against current main 4af0013a2c5:

Surface Current main Merged head
Startup normalized gzip 90,858 B 90,858 B
Startup served gzip / raw 91,489 / 285,508 B 91,539 / 285,508 B
Startup CSS requests 1 1
Chat normalized gzip 1,296,175 B 1,296,315 B
Chat served gzip / raw 1,303,625 / 4,177,326 B 1,303,654 / 4,177,754 B

Coordinator-accepted tradeoff: the earlier paired result added 384 B normalized gzip on a roughly 1.3 MB Chat boot; it fixes visible retained-row drift 27/44 px → 0/0, restores WebKit wheel gestures, and reduces desktop scroll task CPU 6.57% median / 7.79% p95. After merging current main, the measured growth is 140 B. The sole cap change is Chat: 1,296,187 → 1,296,379 B, exactly current-main measured bytes + 140 B growth + the existing 64 B allowance. No other cap changes. Identifier mangling moves gzip by hundreds of bytes; raw and served values are retained above. Document, largest ordinary JS, aggregate CSS, and New Session overages remain inherited and do not grow beyond the checker's allowance.

Whole change: 15 files, +655/−75. Runtime anchor: 339→360 lines. Most growth is optional benchmark diagnostics and regression proof. Solid audit of the touched plain TypeScript owners: rendering controllers, effects, render effects, untrack, direct addEventListener calls, DOM query calls, Solid owner calls, and dynamic imports each remain 0→0. No new cache, state owner, or async mechanism.

Motion evidence

Raw CLS alone is misleading here. Earlier compositor diagnostics captured intermediate layout rectangles that were corrected before paint; a −71 px retained-row shift was balanced by +71 px compensation. The earlier candidate retained 234 matched rows without residual movement even while raw CLS rose. The final exact-base capture now shows drift in 259/259 retained-row comparisons (median −27 px), versus zero residual movement in all 234 final-head comparisons in each of Chromium and WebKit. Final desktop CLS is 0.4582→0.5679; this change does not claim CLS zero. Final-head Chromium and WebKit diagnostics each show zero residual displacement across 234 retained-row comparisons spanning 104 complete non-clamped gesture intervals. Both reach message 0 at y72 and native offset 0 across all six endpoint samples; the final clamped input is classified separately. Selected Chromium compositor frames corroborate the completed-gesture result. Some intermediate rAF rectangles remain nonzero: the first −88 px sample is absent from the captured compositor frames and is followed by an equal correction; another −17 px entry changes native coordinates while screen positions remain fixed. This does not establish that every possible paint is shift-free. WebKit evidence is geometry-only.

Streaming diagnostics found ordinary text wrapping, table growth, code-control reveal, and mobile composer growth, with retained Markdown nodes rather than unexplained block replacement. Recent typing can exclude the same movement from CLS; zero CLS during typing is not proof that nothing moved. The benchmark now snapshots shift-source identity before virtualization removes nodes and separates no-input streaming from typing.

Final streaming all-shift sums are identical across every base/head/control sample within each flow: desktop 0.0946406336, mobile steady 0.2426243711, and mobile typing 0.2469974155. Steady CLS is likewise identical (desktop 0.0268001699; mobile 0.0623932548). Typing changes recent-input exclusion, not those movement totals. The original 0.0098 desktop typing maximum appears on the base in this comparison, not the head. No Markdown behavior change is warranted by this evidence.

Before (synthetic data):

Before: retained transcript content shifts between frames

Current corrected head: retained messages remain aligned as preceding rows appear.

After: retained messages stay aligned while preceding rows appear

Reproduction and bundle identity

Build each side completely with NODE_DISABLE_COMPILE_CACHE=1 pnpm ui:build, then preserve its dist/control-ui directory after the process exits. The full timing matrix used the pre-merge head bundle, built before committing; its embedded build ID names the preceding commit. That pre-merge evidence uses complete-bundle SHA256 over the manifest's 4,844 files:

  • Base: 5a1f7379dc498a5c649163a2c733c2a0d5ebb0bb5e48c4d77480f61944c6a68c
  • Head: bc178b16f6c3c3fcfc58aebe45652dd53877fbdebf9a5c826dd30412398820ff
node --import ./scripts/tsx.mjs scripts/bench-control-ui-engines.ts \
  --bundle-dir "$BASE" --compare-bundle-dir "$HEAD" --control-bundle-dir "$BASE" \
  --steps transcript-scroll-top --viewport both --engines chromium,webkit,firefox \
  --pairs 20 --output .artifacts/transcript-scroll

node --import ./scripts/tsx.mjs scripts/bench-control-ui-engines.ts \
  --bundle-dir "$BASE" --compare-bundle-dir "$HEAD" --control-bundle-dir "$BASE" \
  --steps streaming-645-deltas,streaming-645-deltas-no-input \
  --viewport both --engines chromium,webkit,firefox --pairs 20 \
  --output .artifacts/transcript-streaming

node --import ./scripts/tsx.mjs scripts/bench-control-ui-engines.ts \
  --bundle-dir "$BASE" --compare-bundle-dir "$HEAD" --control-bundle-dir "$BASE" \
  --steps streaming-645-deltas --viewport both --engines chromium --pairs 10 \
  --output .artifacts/transcript-streaming-typing-extra10

Add --transcript-layout-audit only to a separate bounded diagnostic run. Its layout reads and Chromium filmstrip invalidate timing comparisons. All browser runs are headless, with synthetic Gateway fixtures; no live Gateway, cloud lease, or Docker is involved.

Final integration repair

Run 42437623374 had two failing jobs. paces incomplete ancestry and validates metadata against the pending catalog also fails on the exact size baseline e64215c, with the same duplicate sessions.describe assertion. Current main contains bd1fc68 (#194892), which starts recording at the settled boundary; after merging it, that test passes on the replacement head. This is an inherited failure repaired by main, not a transcript regression.

The test-line allocation previously counted only 140 of the 158 net added regression-test/helper lines. It now counts exactly 158; assertions are unchanged. The remaining 22-line deficit is reproduced on both the replacement head (6,571,391 lines / 6,571,369 ceiling) and current-main base (6,571,233 / 6,571,211); both checker commands fail by exactly 22. No allowance is granted for that inherited debt. The scalar baseline remains untouched.

After this merge, pnpm tsgo:ui, five anchor cases, the read-coalescing E2E, and all four Chromium/WebKit desktop/mobile scroll smoke observations pass. The complete paired size comparison also passes (even under the preceding, 38 B tighter cap). Final exact-head CI42439200419 completed with 43 successful jobs,23 intentional skips, and only the test-line ratchet plus its aggregate gate failing. All UI and real-Gateway jobs passed. The exact CI main baseline f6abc88 also fails by22 (6,571,202 /6,571,180); the actual tested merge fails by22 (6,571,360 /6,571,338). Native inherited-failure recovery uses this matching deficit; the failed check is not labelled green.

Native landing completed with the inherited-failure evidence above; required Security Review passed. Separate Security High run 42439200427 (six jobs) and precise scan run 42439200447 stopped during SARIF publication because GitHub installation API quota was exhausted. Their failed logs contain publication errors, not source findings; no security gate was waived. The merged commit is verified on origin/main.

Avoid painting a temporary column shift after an upward native gesture reaches the start boundary. Cover the native-zero phase alongside settled and active-scroll measurements.
@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Nov 7, 2026
@clawsweeper

clawsweeper Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts size: L labels Nov 7, 2026
@steipete
steipete marked this pull request as ready for review November 7, 2026 19:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T02:38:00.568708Z 59f18f9 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d70a12780

ℹ️ 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".

Comment on lines +146 to +149
item.end > (virtualizer.scrollOffset ?? 0) &&
row?.dataset.preparedRow !== "true" &&
row !== undefined &&
this.heights.has(row)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict retained anchor candidates to visible rows

When a native scroll jump lands in an unmeasured window while a focused row remains mounted farther down the transcript, this predicate can select that offscreen row as the retained anchor: it checks only that the row ends after the viewport's start. extractTranscriptRange explicitly retains focused rows outside the visible range, and TranscriptInitialRange.activeIndexes keeps them active, so the prepared-row check does not exclude them. Newly mounted viewport rows then receive compensation for their combined estimate errors despite there being no retained content on screen, shifting the newly revealed messages and eventually the native scroll offset. Require the retained candidate to intersect the viewport at both ends before using it to compensate first measurements.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 7, 2026
@clawsweeper clawsweeper Bot added the clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. label Nov 7, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. and removed clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 7, 2026
@steipete
steipete enabled auto-merge (squash) November 8, 2026 02:18
@steipete
steipete disabled auto-merge November 8, 2026 02:31
@steipete
steipete merged commit d59f002 into main Nov 8, 2026
112 of 124 checks passed
@steipete
steipete deleted the solid2/w-perf-transcript-cls-1107 branch November 8, 2026 03:12
@steipete

steipete commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 8, 2026
…law#194751)

* fix(ui): keep retained transcript rows steady during scroll-up

* fix(ui): preserve native scrolling during transcript correction

* fix(ui): clamp transcript corrections at native zero

Avoid painting a temporary column shift after an upward native gesture reaches the start boundary. Cover the native-zero phase alongside settled and active-scroll measurements.

* fix(ui): distinguish reader input from transcript layout motion

* fix(ui): keep the transcript start anchored after row growth

* perf(ui): accept measured transcript anchor byte tradeoff

* test(ui): account for transcript regression coverage

* perf(ui): retain measured Chat headroom after main integration
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 ci:full Keep ordinary native-locale CI selection on the next PR run. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. scripts Repository scripts size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant