Skip to content

Virtualize chat timeline rows - #898

Merged
steipete merged 8 commits into
openclaw:mainfrom
TurboTheTurtle:virtualize-chat-timeline
Jul 6, 2026
Merged

Virtualize chat timeline rows#898
steipete merged 8 commits into
openclaw:mainfrom
TurboTheTurtle:virtualize-chat-timeline

Conversation

@TurboTheTurtle

@TurboTheTurtle TurboTheTurtle commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Closes #860.

Thanks @TurboTheTurtle for the ItemsRepeater-backed virtual chat timeline.

This rebases the contribution onto current main, switches native chat rows from an eager StackPanel to a virtual stack, and preserves the existing history/follow-to-bottom behavior. Maintainer hardening adds stable row containers for component root changes, evicts renderer controls/components/flyouts when rows recycle, prunes removed descendants during in-place updates, and runs nested component effect cleanups instead of retaining every row ever visited.

Validation

Current head: e792f203026766321e36d2f9d079b882a719dfc6

  • AutoReview: clean after fixing recycled-row cache retention, stale component roots, and in-place descendant/effect retention.
  • Windows 11 ARM64 VM: full repository build passed.
  • Shared tests: 2,692 passed, 31 skipped.
  • Tray tests: 1,538 passed.
  • Focused native virtualization tests: 2 passed.
  • Full native Tray UI suite: 96 passed.
  • Exact-head GitHub CI: green, including the isolated network-recovery rerun: https://github.com/openclaw/openclaw-windows-node/actions/runs/28767061493/attempts/2

Real behavior proof

The native WinUI proof mounts the production chat timeline with 241 variable-height rows, scrolls through four viewports, verifies the first row is recycled and the newest row is realized, bounds renderer cache growth, updates an onscreen row without replacing the ItemsSource or template, appends a message, and confirms follow-to-bottom:

CHAT_TIMELINE_VIRTUALIZATION_PROOF rows=241 itemsRepeater=ItemsRepeater layout=Vertical scrollableHeight=26486.0 verticalOffset=26486.0 variableHeight=true renderChurnStable=true newestRowVisible=true

A second native proof keeps the ItemsRepeater row container stable while a component changes its root control, then verifies removed nested UI disappears, renderer cache size drops, and the nested effect cleanup runs.

@clawsweeper

clawsweeper Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 12:15 AM ET / 04:15 UTC.

Summary
The branch adds a FunctionalUI VirtualStack/ItemsRepeater renderer, switches native chat timeline rows to VirtualVStack with stabilized follow-to-bottom behavior, and adds contract plus native UI proof tests.

Reproducibility: not applicable. as a bug reproduction; this PR implements the tracked chat virtualization feature request. Source inspection confirms current main still uses an eager VStack while PR head switches production rows to VirtualVStack.

Review metrics: 3 noteworthy metrics.

  • Changed surface: 6 files, +690/-23. The diff spans production chat rendering, shared FunctionalUI rendering, project internals exposure, contract tests, UI proof tests, and the UI test fixture.
  • Renderer primitive: 1 new virtual stack element. Adding a FunctionalUI primitive creates reusable renderer surface beyond this one chat timeline call site.
  • Focused proof: 2 native UI proof tests added. The proof covers large-row virtualization/follow behavior plus component-root replacement and cleanup in realized virtual rows.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #860
Summary: This PR is the candidate implementation for the focused chat virtualization issue; the broader chat UX epic and merged render-identity PR are related context, not replacements.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] Exact-head GitHub CI was still pending at inspection time, so merge should wait for the current head test and e2e jobs to finish green.
  • [P1] The PR changes chat row realization, recycling, follow-to-bottom behavior, and per-session scroll offsets; the focused proof is strong, but maintainers still need to accept the residual chat session-state risk.

Maintainer options:

  1. Merge after current-head validation (recommended)
    Accept the virtualized renderer lifecycle after exact-head CI finishes green, using the PR body proof and added UI tests as the upgrade evidence.
  2. Ask for final native proof
    Request one more final-head native WinUI proof capture if maintainers want visible assurance beyond the copied live-output test proof.
  3. Pause for a broader renderer contract
    Defer this PR if maintainers want to define a general FunctionalUI virtualization ownership API before shipping this chat-specific use.

Next step before merge

  • No automated repair is needed now; maintainers should wait for exact-head CI and decide whether to accept the chat scroll/session-state risk.

Maintainer decision needed

  • Question: Is the current-head recycler cleanup and native UI proof enough to accept the chat scroll/session-state risk once exact-head CI is green?
  • Rationale: The previous concrete lifecycle blocker appears fixed, but this PR still changes renderer ownership and chat scroll state in a way only maintainers can decide to ship.
  • Likely owner: shanselman — shanselman already gave the detailed lifecycle and scroll-safety review that shaped the final repair path.
  • Options:
    • Accept after exact-head CI (recommended): Merge once the current head checks finish green, treating the copied live-output proof and focused UI tests as sufficient for this virtualization pass.
    • Request one more native proof pass: Ask for a short final-head native WinUI recording or copied diagnostic run that repeats large-chat scroll, append, and follow-to-bottom behavior before merge.
    • Pause for renderer ownership review: Hold the PR if maintainers want a broader FunctionalUI virtualization ownership contract before adding this renderer primitive.

Security
Cleared: No concrete security or supply-chain concern was found; the diff does not change dependencies, workflows, secrets, permissions, downloads, or package resolution.

Review details

Best possible solution:

Land the virtualized timeline after current-head checks finish green and maintainers accept the remaining chat scroll/session-state risk, preserving the recycler cleanup and proof coverage.

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

Not applicable as a bug reproduction; this PR implements the tracked chat virtualization feature request. Source inspection confirms current main still uses an eager VStack while PR head switches production rows to VirtualVStack.

Is this the best way to solve the issue?

Yes, with normal merge validation remaining; ItemsRepeater-backed virtualization is the narrow implementation for the linked chat virtualization issue, and current head addresses the prior prune/recycle concern. Exact-head CI should finish before merge.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against dae64b6c49e9.

Label changes

Label justifications:

  • P2: This is a normal-priority chat performance and UX improvement with limited blast radius, not an emergency or urgent production regression.
  • merge-risk: 🚨 session-state: Changing the chat row host can affect follow-to-bottom behavior, per-session scroll offsets, history anchoring, and virtualized row lifecycle state.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 PR body contains current-head copied live-output proof for the native WinUI chat timeline with 241 rows, ItemsRepeater virtualization, variable-height render churn, bottom offset, newest-row visibility, and recycled component cleanup.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains current-head copied live-output proof for the native WinUI chat timeline with 241 rows, ItemsRepeater virtualization, variable-height render churn, bottom offset, newest-row visibility, and recycled component cleanup.
Evidence reviewed

What I checked:

Likely related people:

  • shanselman: Current-main blame ties the eager chat row host and FunctionalUI stack renderer to Scott Hanselman's v0.6.12-era UI work, and shanselman left the detailed lifecycle/scroll safety review on this PR. (role: recent area contributor and reviewer; confidence: high; commits: 4166e0fd63f8; files: src/OpenClaw.Tray.WinUI/Chat/OpenClawChatTimeline.cs, src/OpenClawTray.FunctionalUI/FunctionalUI.cs)
  • calebeden: The merged render-identity and FunctionalUI prune pass in Fix chat timeline render identity reuse #917 is the current-main lifecycle behavior this virtual stack must preserve. (role: recent renderer lifecycle contributor; confidence: high; commits: f89a88a6baf4; files: src/OpenClawTray.FunctionalUI/FunctionalUI.cs, src/OpenClaw.Tray.WinUI/Chat/OpenClawChatTimeline.cs)
  • steipete: The latest PR-head commit directly addresses the recycled virtual chat row blocker and updates focused proof coverage. (role: likely follow-up owner; confidence: medium; commits: e792f2030267; files: src/OpenClawTray.FunctionalUI/FunctionalUI.cs, tests/OpenClaw.Tray.UITests/ChatTimelineVirtualizationProofTests.cs)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (6 earlier review cycles)
  • reviewed 2026-06-30T23:11:26.590Z sha ef95d1d :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T08:25:41.479Z sha 91ad3aa :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-05T08:33:22.293Z sha 8aea279 :: needs real behavior proof before merge. :: [P2] Clear recycled rows from the virtual stack cache
  • reviewed 2026-07-05T09:03:54.833Z sha 8aea279 :: needs changes before merge. :: [P2] Release recycled virtual rows
  • reviewed 2026-07-05T09:07:58.540Z sha 8aea279 :: needs changes before merge. :: [P2] Release recycled virtual rows
  • reviewed 2026-07-06T04:11:06.632Z sha e792f20 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. labels Jun 30, 2026
@TurboTheTurtle

Copy link
Copy Markdown
Contributor Author

@openclaw-mantis visual task: verify native chat timeline with a large conversation scrolls smoothly and preserves scroll-to-bottom/follow behavior after virtualization.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 30, 2026
@TurboTheTurtle

Copy link
Copy Markdown
Contributor Author

Added current-head Windows CI proof to the PR body: the native chat timeline mounted 241 rows with ItemsRepeater, vertical StackLayout, bottom scroll offset, and newest row visible. @clawsweeper re-review

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 30, 2026
@TurboTheTurtle

Copy link
Copy Markdown
Contributor Author

Current head ef95d1d has all GitHub Actions Build and Test jobs green, including test, e2e, win-x64, and win-arm64. The PR body includes current-head Windows CI proof: CHAT_TIMELINE_VIRTUALIZATION_PROOF rows=241 itemsRepeater=ItemsRepeater layout=Vertical scrollableHeight=19967.0 verticalOffset=19967.0 newestRowVisible=true. @clawsweeper re-review

@karkarl karkarl 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.

Tested locally on ARM64 — the ScrollViewer is out of sync with the virtualized chat rows. After loading a conversation, the scroll position gets stuck in the middle of the chat history rather than anchoring to the latest messages at the bottom. Looks like the viewport offset isn't being reconciled with the virtualization panel's realized item range.

@shanselman

Copy link
Copy Markdown
Collaborator

Thanks for pushing this forward — the shape is promising, and the 241-row proof is a useful start. I did a maintainer pass against current main after #917, and I don't think this is safe to merge yet at our 90% confidence bar.

The main blocker is the interaction with the newly merged FunctionalUI prune pass. ItemsRepeater realizes virtual row controls later through IElementFactory.GetElement(...), outside the normal root render walk. During the next root render, PruneUnvisitedPaths() only sees the virtual stack wrapper and repeater as visited, not the realized row paths, so it can detach/forget rows that the repeater still owns. That likely causes visible row churn/blanking and lines up with the ARM64 report that the ScrollViewer gets stuck mid-history.

Two related scroll/lifecycle issues should be fixed with that:

  • ConfigureVirtualStack assigns a fresh ItemsSource array and a fresh ItemTemplate on every render, which can force ItemsRepeater to reset/re-realize rows during normal chat churn.
  • Follow-to-bottom still uses a single ScrollableHeight read. With virtualized, variable-height chat rows, that extent can change after realization, so the scroll can land above the newest row.

Suggested path: make virtualized row ownership prune-aware (for example, a virtualized subtree/prefix that is not swept by the root prune until the item leaves the ItemsSource, or explicit row path lifecycle in RecycleElement), keep the template/source stable across renders, and anchor follow behavior by item/realization or by looping until the extent stabilizes. Then add proof with variable-height rows and a render-churn step on a current-main rebased branch; ARM64 proof would be especially valuable given the existing report.

So: great direction, but requesting changes rather than merging this one today.

@TurboTheTurtle
TurboTheTurtle force-pushed the virtualize-chat-timeline branch from ef95d1d to 91ad3aa Compare July 5, 2026 08:20
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient Contributor real behavior proof is sufficient. 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 Jul 5, 2026
@TurboTheTurtle
TurboTheTurtle force-pushed the virtualize-chat-timeline branch from 91ad3aa to 8aea279 Compare July 5, 2026 08:29
@TurboTheTurtle

Copy link
Copy Markdown
Contributor Author

Updated the PR body with current-head proof from 8aea279207e909840c3f10e174a6e702b5759158 / run 28734797140. The Tray UI proof now covers variable-height rows, render churn stability, bottom offset, and newest row visibility; current test, e2etests, win-x64, and win-arm64 checks are green.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 5, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 5, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 5, 2026
@steipete
steipete force-pushed the virtualize-chat-timeline branch from 8aea279 to e792f20 Compare July 6, 2026 04:07
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 6, 2026
@steipete
steipete merged commit fcc7477 into openclaw:main Jul 6, 2026
15 of 19 checks passed
@TurboTheTurtle
TurboTheTurtle deleted the virtualize-chat-timeline branch July 6, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat UI virtualization (perf on large conversations)

4 participants