Repository navigation
fix(ui): keep transcript content steady while scrolling upward - #194751
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 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".
| item.end > (virtualizer.scrollOffset ?? 0) && | ||
| row?.dataset.preparedRow !== "true" && | ||
| row !== undefined && | ||
| this.heights.has(row) |
There was a problem hiding this comment.
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 👍 / 👎.
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…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
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
scrollToalso 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 main4af0013a2c5(runtime bundle built at0cbf0105b80; subsequent commits change only the test allocation and cap/comment). The coordinator accepted the byte tradeoff. Native replacement-head recovery landed this exact head asd59f00281eb02167a86b57c42f04b2b59ed203feand 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.
The completed scroll timing comparison uses merge base
fe2b1a51b41and 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:
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: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, directaddEventListenercalls, 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):
Current corrected head: retained messages remain aligned as preceding rows appear.
Reproduction and bundle identity
Build each side completely with
NODE_DISABLE_COMPILE_CACHE=1 pnpm ui:build, then preserve itsdist/control-uidirectory 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:5a1f7379dc498a5c649163a2c733c2a0d5ebb0bb5e48c4d77480f61944c6a68cbc178b16f6c3c3fcfc58aebe45652dd53877fbdebf9a5c826dd30412398820ffAdd
--transcript-layout-auditonly 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 catalogalso fails on the exact size baseline e64215c, with the same duplicatesessions.describeassertion. 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.