You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "Astro-Han (via GitHub)" <gi...@apache.org> on 2026/09/14 23:43:14 UTC

[PR] fix(ui): stabilize virtual transcript scrolling and reduce rendering work [maka]

Astro-Han opened a new pull request, #5315:
URL: https://github.com/apache/maka/pull/5315

   ## Summary
   
   Long conversation history mounted too much content while scrolling upward, and range replacement or repeated height estimation could disturb the reading position. This change mounts Turn bodies near the viewport, retains measured heights across trimming and same-session jumps, and coordinates history publication with explicit navigation.
   
   - Keep data-window ownership separate from DOM mounting. Unmounted rows and range spacers use one height ledger; actual measurements, including zero, take precedence over estimates. Focused and selected content is retained.
   - Publish incoming history during active scrolling while preserving the reading anchor; defer trimming until outstanding reads finish. Route indexed prompt navigation through the same path as search so stale reads cannot override it.
   - Estimate only supported simple text/code layouts. Remove the duplicate reasoning aggregate, preserve process-component identity, use span code highlighting, reuse unchanged prompt-rail ticks, and defer hidden tool-group rows until first expansion.
   - Add native traversal and real-Host input coverage. Remove superseded anchor probes, scroll-write interception, and duplicate performance-workflow selection checks; regular Storybook smoke retains selection coverage.
   
   The native scrollbar can still change size when previously unlaid-out complex history is measured for the first time. This PR does not claim to eliminate that remaining behavior.
   
   ## Verification
   
   - Built desktop workspace dependencies, main/preload and production renderer, and rebuilt Storybook.
   - UI typecheck passed. Focused tool-group, tool-presentation and chat-view tests: 30 passed. The new tool-group regression tests failed before the change; an unmount-on-close ablation also demonstrated loss of detail state.
   - Headless production-component checks passed for initial expansion animation, controlled/uncontrolled expansion, single-to-group transitions, and detail-state retention.
   - After diagnostic cleanup, ran `SCROLL_WINDOW_TRIALS=1 node scripts/perf/scroll-window.mjs` with output outside the repository: both native traversal scenes passed, with zero blank frames and zero revisit shrink events. Delayed-mount anchoring and repeated traversal at widths 900 and 1352 passed. All 14 assertion calls were unchanged by cleanup.
   - The continuity/selection Story passed through the regular smoke runner after rebuilding the catalog.
   - Manual acceptance used an isolated Electron workspace with an imported real long conversation containing 64 user messages and 1,375 tool calls. The tester reported substantially smoother upward scrolling and stable repeat browsing; first-visit scrollbar resizing remained visible.
   - [Performance frontend run 34836272464](https://github.com/apache/maka/actions/runs/34836272464) passed at `f2ac93b9f`. This predates the final tool-group and diagnostic-cleanup commits; it is not an exact-head CI result. Full current-head CI and combined validation with #5301 remain outstanding.
   
   ## Draft completion
   
   Related: #5301. This branch overlaps its conversation rendering and timeline changes; whole-turn process folding belongs to that PR.
   
   - [ ] Integrate main after #5301 merges and reconcile overlapping rendering changes.
   - [ ] Run combined history scrolling, process/tool expansion, navigation and resize acceptance.
   - [ ] Verify CI against the final head before marking ready for review.
   
   ## AI use
   
   - [ ] No generative tool made a substantive contribution
   - [x] Generative tooling made a substantive contribution
   
   Tool(s) and scope: OpenAI Codex for implementation, performance experiments, regression tests and simplification audit; Claude for an architecture consultation. I verified the scoped results listed above and retained the unresolved first-visit limitation explicitly.
   
   Generated-by: OpenAI Codex
   
   ## Checklist
   
   - [x] Tests cover the change and fail without it
   - [ ] Lint, format, typecheck and the affected suites pass locally
   
   Does this PR entail a change in behavior?
   
   - [x] Yes — described under Summary above
   - [ ] No
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(ui): simplify transcript geometry and preserve native scrolling [maka]

Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #5315:
URL: https://github.com/apache/maka/pull/5315#discussion_r4012381696


##########
packages/ui/src/transcript-scroll-authority.tsx:
##########
@@ -134,16 +140,13 @@ export function createTranscriptScrollAuthority(): TranscriptScrollAuthority {
     target.style.overflowAnchor = 'none';
     try {
       flushSync(commit);

Review Comment:
   Fixed in the current head, `94a48534bc3d17f71981b57936fea9eb589af438` (architecture change `f7fd102cf`, origin correction `8d3140dcb`). I removed estimated row geometry and general application anchor compensation. Resident rows now have real bodies, native anchoring preserves the reader away from the origin, and the existing scroll authority preserves the connected first row at `scrollTop === 0`, where Chromium does not establish an anchor. Explicit navigation and tail following take precedence. Publication remains synchronous during input; eviction waits for input to finish.
   
   The Electron regression now rapidly drags tail → top → intermediate → top → intermediate and asserts that the held thumb actually reaches zero. It chooses a reading row before each 300 ms stationary hold, tracks that same row through every sampled held frame (≤1 px), and retains release continuity and actual Host-publication assertions. Two normal-speed and two 4× CPU runs passed locally. The current head's hosted `test` and `windows_recovery` checks both passed.
   
   I am resolving this thread based on the implemented fix and author-side verification. Independent CDP re-review of this exact head has been requested separately; this resolution does not represent reviewer approval or merge authorization.
   
   *AI-assisted author response posted by Codex at the author's request.*



##########
packages/ui/src/virtual-transcript-turn.tsx:
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode, type RefObject } from 'react';
+
+/** Mounts near the viewport; measured heights belong to the shared geometry ledger. */
+export function VirtualTranscriptTurn({
+  turnId, scrollRef, enabled, required, getHeight, onMeasure, children, accentColor,
+}: {
+  turnId: string;
+  scrollRef: RefObject<HTMLElement | null>;
+  enabled: boolean;
+  required: boolean;
+  getHeight(id: string): number;
+  onMeasure(id: string, height: number): void;
+  children: ReactNode;
+  accentColor?: string;
+}) {
+  const root = useRef<HTMLDivElement>(null);
+  const measure = useRef(onMeasure);
+  measure.current = onMeasure;
+  const [nearby, setNearby] = useState(!enabled);
+  const [retained, setRetained] = useState(false);
+  const mounted = !enabled || required || nearby || retained;

Review Comment:
   Fixed in the current head, `94a48534bc3d17f71981b57936fea9eb589af438`. I removed `virtual-transcript-turn.tsx` and the independent IntersectionObserver/body-placeholder lifecycle in `f7fd102cf`. Every resident Turn now renders its real body; the existing data window controls residency and defers eviction until input ends. There is no lagging `nearby` flag or `data-virtual-placeholder` path that can leave resident viewport rows empty during a reversal.
   
   The current Electron regression exercises rapid tail → top → intermediate → top reversals with a held native thumb, checks an actually reached scroll origin, and tracks a mounted reading row through stationary holds and release. Two normal-speed and two 4× CPU runs passed locally. The ordinary and mixed-history native-wheel probes also recorded zero blank frames. Full Storybook smoke passed (364 stories / 393 theme renders), and the current head's hosted `test` and `windows_recovery` checks are green.
   
   I am resolving the removed-path finding based on the implementation and author-side verification. Independent CDP re-review remains requested, including checking real visible bodies rather than the now-removed placeholder attribute. This is not reviewer approval or merge authorization.
   
   *AI-assisted author response posted by Codex at the author's request.*



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(ui): stabilize virtual transcript scrolling and reduce rendering work [maka]

Posted by "hqhq1025 (via GitHub)" <gi...@apache.org>.
hqhq1025 commented on code in PR #5315:
URL: https://github.com/apache/maka/pull/5315#discussion_r4011110009


##########
packages/ui/src/transcript-scroll-authority.tsx:
##########
@@ -134,16 +140,13 @@ export function createTranscriptScrollAuthority(): TranscriptScrollAuthority {
     target.style.overflowAnchor = 'none';
     try {
       flushSync(commit);

Review Comment:
   [P2] Preserve the visible reader while publishing history during a held native drag
   
   This synchronous commit now runs while the scrollbar pointer is still held. On this exact head I ran the real Electron `chat-prompt-rail` path three times, sampling the viewport twice per drag step while the left button remained down and the pointer stayed stationary for 300 ms. Every run admitted a Host page and increased `scrollHeight` by about 28,560 px. In two runs, a later stationary interval replaced visible Turns 27/28 with 1/2/3; in the third, publication briefly left no rendered Turn visible and the next stationary sample changed `scrollTop` from 8400 to 0, replacing Turns 26-28 with 1-3.
   
   The new E2E selects its reading anchor only after the held interval and validates it after pointer release, so it passes despite this user-visible jump. The old raw-height freeze was too strict because a prepend legitimately changes height, but visible reader continuity during the hold is still required. Please either defer the range commit until release or preserve a mounted visible anchor through every active-input publication, and make the regression assert the visible Turn/position before release.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(ui): stabilize virtual transcript scrolling and reduce rendering work [maka]

Posted by "hqhq1025 (via GitHub)" <gi...@apache.org>.
hqhq1025 commented on code in PR #5315:
URL: https://github.com/apache/maka/pull/5315#discussion_r4011464926


##########
packages/ui/src/virtual-transcript-turn.tsx:
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode, type RefObject } from 'react';
+
+/** Mounts near the viewport; measured heights belong to the shared geometry ledger. */
+export function VirtualTranscriptTurn({
+  turnId, scrollRef, enabled, required, getHeight, onMeasure, children, accentColor,
+}: {
+  turnId: string;
+  scrollRef: RefObject<HTMLElement | null>;
+  enabled: boolean;
+  required: boolean;
+  getHeight(id: string): number;
+  onMeasure(id: string, height: number): void;
+  children: ReactNode;
+  accentColor?: string;
+}) {
+  const root = useRef<HTMLDivElement>(null);
+  const measure = useRef(onMeasure);
+  measure.current = onMeasure;
+  const [nearby, setNearby] = useState(!enabled);
+  const [retained, setRetained] = useState(false);
+  const mounted = !enabled || required || nearby || retained;

Review Comment:
   [P2] Keep a rendered row mounted across native thumb reversals.
   
   A native tail → top → intermediate → top drag can move farther than the 800 px observer margin before the asynchronous `IntersectionObserver` update commits. In four independent Electron processes using the current production code, every one of the three direction transitions produced a fully blank rendered frame. At each blank frame the viewport-intersecting wrappers (for example Turns 111/112 or 117-119) were all `data-virtual-placeholder` with no `.maka-turn` child; the next animation frame restored their real user/assistant bodies. The resident range stayed constant throughout, so this is not Host-page publication or the accepted cold-height correction. The exact held Turn was still restored after release, but the conversation visibly flashes empty while the thumb is held. Please make current viewport intersection a hard mount condition (rather than relying only on lagging `nearby` state), and cover a real reverse-thumb transition.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(ui): simplify transcript geometry and preserve native scrolling [maka]

Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han merged PR #5315:
URL: https://github.com/apache/maka/pull/5315


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(ui): stabilize virtual transcript scrolling and reduce rendering work [maka]

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on PR #5315:
URL: https://github.com/apache/maka/pull/5315#issuecomment-5673932397

   **Correction to my earlier review** (`@kabi-opus`, automated agent review, shared account).
   
   In [my review](https://github.com/apache/maka/pull/5315#pullrequestreview-5204971855) I argued that the recorded cold-history drift of "a few pixels" understates the bound, because the fallback row estimate is a constant `320` (`use-transcript-known-space.ts:53`) for any turn the estimator declines — which includes every turn containing tool activity. I recommended rewording the PR description on that basis.
   
   **I withdraw that recommendation.** Another reviewer has since tested it directly: with the first-load turn replaced by a 160-line Markdown list whose real height is ~4054px, the real Host page kept the original anchor within **0.3125px**, 2/2. I did not run that experiment myself — I could not launch Electron in my environment, which is why I raised this as an untested hypothesis rather than a finding — so I am relaying their result, not confirming it independently.
   
   The arithmetic I published is still correct and still checkable: the estimate for a list-bearing turn really is the constant 320 regardless of its real height. What does not follow is the step I took next — that a large estimate error becomes a proportionally large reading-position movement. It does not, because the anchor compensation re-aligns the anchored row's top after each publication, so height error above the reader is absorbed rather than shown. Stating the fact was fine; carrying it through to a user-visible consequence without testing that step was not, and a 4054px case is a fair test of it.
   
   The description's characterisation of the residual as small is consistent with the evidence now available. Nothing else in my review depends on this point.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(ui): simplify transcript geometry and preserve native scrolling [maka]

Posted by "hqhq1025 (via GitHub)" <gi...@apache.org>.
hqhq1025 commented on code in PR #5315:
URL: https://github.com/apache/maka/pull/5315#discussion_r4012585057


##########
apps/desktop/e2e/scroll-geometry.spec.ts:
##########
@@ -17,20 +17,20 @@
  * under the License.
  */
 
-// Real native scrollbar input: stable held geometry, preserved reading anchor,
-// and history progress after release. Fixed-range cold scrolling runs in CI too.
+// Host history delivered through preload must preserve the reader throughout
+// native input, including the first layout of previously unseen rows.
 import { test, expect } from '@playwright/test';
 import { withE2eWindow } from './fixtures';
 
-test('native thumb keeps its geometry and releases history without moving the reader', async () => {
+test('native thumb preserves a cold reader while admitting Host history', async () => {
   test.setTimeout(180_000);
   await withE2eWindow(
     {
       seed: false,
       readinessSelector: '[data-turn-id]',
       e2eFixtureScenario: 'chat-prompt-rail',
       locale: 'zh-CN',
-      showWindow: true,
+      showWindow: false,

Review Comment:
   [P3] Run this native-input geometry test in a visible window
   
   This spec drives the native scrollbar through CDP and makes frame-paced rAF assertions, but it explicitly requests a hidden fixture. The fixture contract at `apps/desktop/e2e/fixtures.ts:446-448` and `scripts/fixture-env.mjs:100-119` says xvfb throttles a hidden compositor to about 1 fps and that real-input/frame-paced callers need a visible window. On this exact SHA, the hidden local run failed 3/3 at the direction assertion before any range publication, while the identical official spec with Linux CI visibility passed 3/3; separate visible-window probes also preserved direction and real text. Set `showWindow: true` so this regression test exercises the compositor mode its protocol requires and does not produce stable local false negatives.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(ui): simplify transcript geometry and preserve native scrolling [maka]

Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #5315:
URL: https://github.com/apache/maka/pull/5315#discussion_r4012771455


##########
apps/desktop/e2e/scroll-geometry.spec.ts:
##########
@@ -17,20 +17,20 @@
  * under the License.
  */
 
-// Real native scrollbar input: stable held geometry, preserved reading anchor,
-// and history progress after release. Fixed-range cold scrolling runs in CI too.
+// Host history delivered through preload must preserve the reader throughout
+// native input, including the first layout of previously unseen rows.
 import { test, expect } from '@playwright/test';
 import { withE2eWindow } from './fixtures';
 
-test('native thumb keeps its geometry and releases history without moving the reader', async () => {
+test('native thumb preserves a cold reader while admitting Host history', async () => {
   test.setTimeout(180_000);
   await withE2eWindow(
     {
       seed: false,
       readinessSelector: '[data-turn-id]',
       e2eFixtureScenario: 'chat-prompt-rail',
       locale: 'zh-CN',
-      showWindow: true,
+      showWindow: false,

Review Comment:
   Fixed in 9b57b35fe. I changed the geometry spec to request showWindow: true, matching the existing fixture contract for native-input and frame-paced tests. The fixture retains its inactive reveal behavior, so this does not request application focus. No product code, assertions, timeouts, or retries changed.
   
   Validation: desktop build:test passed; the official scroll-geometry.spec.ts passed 3/3 locally on macOS with the visible fixture; E2E budget passed (38 tests in 22 files); git diff --check passed. The Linux hidden/visible comparison remains your independent evidence; I am not claiming a new Linux rerun. Pushed the one-line fix and resolving this P3.
   
   Automated reply: written by an AI agent on behalf of Astro-Han.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org