Repository navigation
fix(chat): chat freezes when opening tall message history - #1935
DragonLi-Mi wants to merge 4 commits into
Conversation
Avoid synchronous ItemsView tail navigation during virtualized history layout. Use asynchronous native target geometry and retain the target anchor, rebinding active requests when Reactor recycles the container before completion. Preserve generation checks, cleanup, and scroll-up follow behavior. Co-authored-by: Copilot <[email protected]> Copilot-Session: 178fd7d8-257d-44f8-93df-a3db5f5bb1c4
|
🦞👀 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 real behavior proof before merge. What this changesReplaces synchronous history-tail navigation with asynchronous native positioning while preserving reader navigation and lifecycle cleanup. Example: Open 16 history messages with a tall assistant row at index 5 and an unrealized newest message.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR contains a distinct repair for a confirmed chat freeze whose synchronous navigation path remains on current main; no definite introduced code defect was found. Priority: P0 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Reactor timeline supplies stable row identities and history requests to InitialTailPositioner, which coordinates ItemsRepeater realization and native ScrollView positioning. flowchart TD
A[Chat history and live messages] --> B[Reactor timeline]
B --> C[InitialTailPositioner]
C --> D[ItemsRepeater realization]
D --> E[Native target geometry]
E --> F[ScrollView positioning]
F --> C
G[Reader navigation] --> C
Technical reviewBest possible solution: Keep the native repair in InitialTailPositioner, with a visible recovery launcher for affected installations whose frozen chat prevents access to Settings. Do we have a high-confidence way to reproduce the issue? Released-process stacks and the supplied baseline native reproduction identify the synchronous call still present on main; this read-only review did not execute a fresh reproduction. Is this the best way to solve the issue? Replacing the blocked synchronous boundary inside the existing owner is justified; generation checks, native correlation tracking, and anchor cleanup serve the preserved scrolling contract without adding a competing owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d50e57913465. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 4, 2026, 12:23 AM ET / 05:23 UTC (Revision 2). |
|
Follow-up to the current review: I exercised a separate production Companion process and added the resulting UI diagnostics and limitations to Real Behavior Proof. This supplies additional application-boundary evidence, but does not clear the full-app proof blocker. What actually ran
Observed behavior
Copied native UI diagnostics for the successful initial-tail/append observations: The marker bounds, 1139..1160, are inside the actual viewport, 570..1216. After route-return, the same viewport's visible subtree instead ended partway through the final answer's table; the complete answer still existed in The app fixture contains 240 mixed-height messages, not the exact minimized 16-message giant-row input. The latter still has the five passing native-root regression cases, not full-process replay. I also attempted the existing full-app UIA tests: an attempt reached About the source assertions: the new positive assertions pin private handler names and exact call strings; they do not prove completion, cleanup or lifecycle convergence. The negative guard against synchronous Original installed WinUI 3.2, real-provider replay, complete |
Preserve asynchronous navigation alongside upstream resize and input cancellation. Keep reflow gates when recycled targets are rebound. Validation: C# syntax, final PR diff, patch round-trip, and independent P0-P3 follow-up passed. Build/tests remain blocked by NuGet TLS access and missing restore assets. Co-authored-by: Copilot <[email protected]> Copilot-Session: e953925e-8b52-41cf-90b9-c22b47e8aebc
Merge upstream main b917d7e. Resolve the current tail inside the low-priority dispatcher while retaining the originating generation and asynchronous native target positioning. Preserve reflow-correction identity when an unfinished target is recycled. Adapt the upstream source guard to the combined call contract. Validation: full build, 47 focused tests, 4809 Shared tests and 4788 Tray tests passed (25 existing Shared skips). Native selection: 16 passed, 3 failed. The same three wide HistoryTail cases also fail with the exact pre-merge ac55 controller in a one-variable comparison using aligned Reactor preview.16 dependencies. Full-app proof blockers remain open. Co-authored-by: Copilot <[email protected]> Copilot-Session: 178fd7d8-257d-44f8-93df-a3db5f5bb1c4
Keep issued offsets valid when their virtualized target is recycled, then resolve live tail geometry after native anchor retention. Distinguish owned and reader scroll completions and supersede an in-flight tail offset when the reader navigates away. Fence earlier foreign completions at each explicit history request, including the SDK correlation counter wrap. Strengthen immediate-reader and replacement-request regression coverage without relaxing native assertions or deadlines; remove private call-shape assertions introduced by this PR. Co-authored-by: Copilot <[email protected]> Copilot-Session: 178fd7d8-257d-44f8-93df-a3db5f5bb1c4
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@dotMorten could you take a look at the approach here? I'm concerned about carrying a substantial application-level workaround for The native tall-history freeze reproduction is valuable. My concern is the additional realization, anchoring, recycling, and scroll-correlation lifecycle that OpenClaw now needs to maintain around the control. Would the generic part be better addressed in I recognize that we may need a downstream mitigation while an upstream fix ships. Before landing this, I'd like your view on whether this is the smallest safe workaround, whether the reproduction can become an upstream regression test, and what would let us remove the workaround later. The related microsoft/microsoft-ui-xaml#12086 addresses scrolling after content reset; I don't want to assume it also fixes this tall-history freeze without verification. |
|
@DragonLi-Mi Are you still seeing this after this clean-up pr got merged? (it's been sitting for a little while but was merged a couple days ago). |
|
@dotMorten I can no longer reproduce the original freeze in my current checks using retained local chat history. An isolated full-app replay passed on main after the cleanup. The same replay also passed on the original installed build and the pre-cleanup build, so I can't confidently attribute this to the cleanup or claim the issue is definitively fixed. I'm pausing further investigation for now. Thanks for pointing this out. |
PR cleanup reviewReviewed head: There is a newer main change worth reconciling before rebasing this workaround: #2093 (243f9cf) removed ItemsView.StartBringItemIntoView, stages natural-layout realization and revalidates the row before an element bring. That replaces the central boundary this PR targeted. The exact five tall-row regression cases and completion-order policy are not all present on main, so I am not claiming complete supersession. I recommend replaying those tests on current main and retaining only any failing residual, rather than adding a second scrolling lifecycle. The earlier full-app/Release proof gaps also remain distinct from native-root passes. Action in this cleanup pass: leaving this PR open. No branch changes or runtime-proof waiver. The findings above come from source, discussion and recorded-CI review; Windows validation was not rerun in this pass. |
I will close this PR then. Thanks for your contribution @DragonLi-Mi! |
Closes #1568
What Problem This Solves
Fixes: Companion becomes Not Responding when chat scrolls to the newest message past a tall, virtualized history row.
User Impact
User impact: opening history, following new messages, and remounting chat remain responsive without taking readers back to the bottom after they scroll up. This is a source fix, not an update to an already-running installed Companion.
Full-application acceptance is still incomplete: the follow-up below found a clipped streamed tail after returning from Notifications, and reader scroll-up retention is not yet demonstrated in the full app. This is not a ready-to-merge claim.
The three previously failing 1007-pixel native cases are repaired in
bc2f2774: the 19-case selection passed, and all five history-tail cases passed ten fresh processes (50/50), followed by a committed-head rebuild/run (5/5). Full-application, foreground-input and Release acceptance remain incomplete.These are regression cases introduced by this PR in
b98c89bc, not existing default-branch CI tests. Baseline comparisons transplanted the tests onto unchanged default production; they must not be described as default-branch CI failures.Why This Change Was Made
The live stack and synthetic native reproduction both blocked inside
ItemsView.StartBringItemIntoView. This fix avoids its synchronous realization/layout boundary, rather than assuming recursiveLayoutUpdatedre-entry. Reactor still owns the stable-key list and virtualization.Native geometry drives the asynchronous scroll. Recycling before an offset is issued retries normal layout; recycling after issuance preserves the valid native correlation instead of endlessly replacing the request. If the settled target was lost, a generation-fenced retry resolves live coordinates after anchor retention.
Owned native completions, including canceled brings and replaced offsets, are distinguished from reader navigation. Reader completion cancels pending retries and supersedes a still-issued tail offset at the observed reader position. Each new explicit history request establishes a native boundary so an older reader completion cannot cancel the newer jump. Correlation ordering and wrap handling follow the SDK's 31-bit counter implementation, with focused boundary/wrap coverage.
Summary
Evidence
StartBringItemIntoView. A task-owned external watchdog was needed to stop the frozen test host. The live Gateway health/readiness endpoints were responsive. Sanitized investigation.bc2f2774): full build, 55 focused contracts, 4,809 Shared tests and 4,796 Tray tests passed. Native siblings: 19/19; complete chat-layout class: 130 passed, 2 existing gated skips; ten fresh five-case runs: 50/50; committed-head rebuilt regression: 5/5. Native viewport assertions and deadlines were retained; reader navigation is now exercised immediately after the tail appears, plus an older scroll before a newer explicit jump.b917d7e1ina151396d. Native selection was 16 passed, 3 failed; the exact pre-merge-controller comparison reproduced those case identities. That comparison was not pristine default production.b98c89bc): all five native regression cases passed at 320/800/1007 pixels, including append and remount. The wide case also verified scroll-up retention when a message arrived and an explicit subsequent history jump. A 19-case native sibling selection passed; a fresh-process five-case repetition and a further committed-head rebuild/run also passed, with no selected skips.code-reviewfollow-ups identified two P2 cancellation/generation gaps; both were fixed and disposed of at source level, with no remaining high-confidence finding in that scope. Model identity is unverified. This is not a canonical-helper result, native scheduling certification, or complete proof-pool acceptance.scoped-clean, no findings. Its default Sol models were unavailable for the account; Luna was selected from that account's model catalog without changing isolation or authentication settings.The original installed native WinUI 3.2 binary was not retested. Native proof here uses the repository's current SDK/runtime, not a claim that the complete maintainer proof pool ran.
Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: native chat realization, asynchronous tail navigation, and lifecycle/follow behavior. Focused local proof is recorded below; complete pool execution is not claimed.Validation
Current repair: 2026-11-04
Commit:
bc2f27744463fbea9b8a77ac7173e107cb01e53c. Pre-commit checks used recorded treecbda8dd433e1c13efde5dcb953379b29c37eb9e7; the committed tree was verified identical, then the native project was rebuilt and all five regressions executed again on the committed head. The four paths are the positioner, existingTailNavigationPolicy, source/policy tests and native regression file.Before editing, fetched default
mainat12789b405719c5755955674f37fa09ad0eb07b3dand inspected its 15 commits afterb917d7e1: no equivalent native-tail fix had landed. The affected controller, policy and regression source were unchanged between those default tips; reconnect PR #1795 does not repair this scroll path..\build.ps1dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore--filter "FullyQualifiedName~ChatTimelinePresentationTests"dotnet build .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 --no-restore--no-build --no-restore -c Debug -r win-x64 --filter "FullyQualifiedName~ReactorChatLayoutProofTests"--filter "FullyQualifiedName~HistoryTail_", ten fresh processesHistoryTail_selectorgit diff --cached --checkThe two whole-class skips require the explicitly authorized native keyboard and parent-owned pointer/capture drivers. Neither was enabled or claimed as proof. Exact native labels, filters, counts and source/binary hashes were retained; no selected history-tail or 19-case proof was skipped. The new boundary policy's eight cases first exposed three rejection failures under unconditional admission, then passed with the request-boundary comparison.
Attribution, not CI history: a separate 22-execution comparison used pristine
b917d7e1production plus this PR's transplanted regression tests. Append failed 3/3 on both default production anda151; append/remount failed 1/3 on default and 3/3 ona151. The wide reader/jump case failed 3/3 on each, but at different stages (default: reader scroll-up; PR: later explicit jump). Therefore the failures were not all proven newly introduced, and the exact jump failure was not proven pre-existing. All were directly coupled acceptance gaps, rather than tests to remove.Not verified / blocked: current-head complete-Companion acceptance, original installed runtime, real provider/Gateway replay and the complete interactive proof pool. The last Debug full-app attempt on an earlier candidate passed 0/2 (UIA deadline and natural message-240 tail); it was not a current-head pass or proven environment-only failure. Release proof is blocked by the required signed cleanup executable (
OpenClawSignedCleanupHostPath), without changing signing/trust settings. Correctly isolated gallery controls separately failed to obtain foreground (HWND=0); no manual admission was fabricated.Earlier exploratory whole-native attempts are not accepted suite results: one aborted in a COM finalizer after 509 passes/155 failures (154 missing-isolation-root prerequisites and one residual tail geometry failure), and one malformed external selector hit its watchdog. The final typed runner checked exact label/filter identity and case counts. An earlier intermediate 19-case run also hit the question-composer visibility assertion; default production passed that isolated case six times and the final candidate passed it in all three 19-case runs, which does not establish causality for the earlier failure.
Conflict resolution: 2026-11-03 (historical)
Merge commit:
a151396deb7471cfa1a64a0058dd5bcd83b0149a, integrating upstreamb917d7e197e5194a14577a290805be4d13c409be. Tests ran before commit on recorded tree37f34f282812334f5ac741f4d5441f12d9e1eb0e; the committed tree was verified identical.At this historical merge, the resolution kept upstream
InitialTailNavigationRequest.TryResolveinside the dispatcher, with its originating generation, and retained low-priority asynchronous native navigation.renderAfterLayoutpropagated into target-recycling retries, preserving reflow follow/input guards. One upstream source assertion was adapted to this combined call contract. That revision's delta was confined to the original three paths..\build.ps1 -NoTrustRepositorydotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --filter "FullyQualifiedName~ChatTimelinePresentationTests"dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restoredotnet build .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 --no-restoreHistoryTail_,MountedReactorChatDisposalProofTests,ProductionRoot_selectionac55e1e6controller,HistoryTail_selectorgit diff --cached --check, unresolved-index check, tested-tree/commit equalityThe native command is the 19-case selector shown in the historical command block below, run under a task-owned 90-second external watchdog. Its failures are the 1007-pixel append, append/remount, and explicit-history-jump cases. The UI dispatcher remains runnable, but the newest marker does not reach the viewport. These tests were not skipped, weakened or reported as passing. The comparison changes only the controller back to its exact pre-merge content; it is not a clean full-binary execution of the old commit.
The first native attempt had 13 failures because its existing restore graph still selected Reactor preview.12 while the product used preview.16. Running
dotnet restore .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -r win-x64 --configfile <task-local-config>aligned both graphs to upstream preview.16. The restored run and final rebuilt candidate both retained the three behavioral failures above. Restores used the previously documented trusted HTTPS proxy, without disabling audit, TLS, trust or test safeguards.A bounded independent Copilot
code-reviewimplementation/proof-plan review found no significant integration issues at that revision. This was source review, not runtime acceptance. At that time the three native failures remained open; the current repair above supersedes that result, not the full-app, hosted-CI or Notifications-return/physical-reader proof gaps.Original-head validation (historical,
b98c89bc)Tests used isolated settings and synthetic history. Restores used a task-local config for an existing trusted HTTPS NuGet proxy; repository/global TLS, trust, and authentication settings were not changed.
dotnet format whitespace .\openclaw-windows-node.slnx --no-restore --include src\OpenClaw.Tray.WinUI\Chat\ReactorItemsViewScrollController.cs tests\OpenClaw.Tray.Tests\ChatTimelinePresentationTests.cs tests\OpenClaw.Tray.UITests\ReactorChatLayoutProofTests.cs --verify-no-changes --verbosity quietreports 20 pre-existing diagnostics in unchanged portions of the UI proof file. The same 20 were confirmed against the untouched base file; no formatter diagnostics land in this change's lines. Unrelated formatting was left alone.2026-11-02 conflict-resolution update (historical)
The branch integrates
mainata4dd026cc5f85a444a0fcd05eef5b86282dbda8c. The resolution preserves asynchronous native tail navigation alongside upstream resize/reflow correction and user-input cancellation, including cancellation cleanup and the reflow gates when a recycled target is rebound.Resolution commit:
ac55e1e61a89dac0ddb4ba15150570043ae2817f.The passing totals above and the runtime evidence below belong to the earlier head
b98c89bcee5249177c4dc564064f4828a0ae7425. They are not current-head test results. The resolved source tree isb48cb69d4adf2dd04dcff08317185e3d66b98368.Independent Copilot P0-P3 review identified the reflow-gate propagation issue, and the same reviewer's final bounded follow-up confirmed it closed with no unresolved findings on this exact tree. This was static review; host/model identity is unverified and the unavailable shared autoreview helper was not run.
CSharpSyntaxTree.ParseTextfor the three final PR C# filesgit diff --cached origin/main --check.\build.ps1 -NoTrustRepositoryNU1900: NuGet vulnerability data could not be retrieved because the TLS handshake toapi.nuget.orgfails. Prerequisites passed and 69 Markdown files validateddotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore --verbosity minimalNETSDK1004because restore assets are absent; 0 tests executeddotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --verbosity minimalNETSDK1004because restore assets are absent; 0 tests executedNo dependency-audit, TLS, trust, or test safeguards were disabled. At that revision, native tests, the recycled-target reflow runtime regression, and full-application acceptance were unverified. The latest validation above supersedes this historical build/restore blocker, not the remaining runtime acceptance gaps.
Real Behavior Proof
Current native source: 2026-11-04
Tested source tree:
cbda8dd433e1c13efde5dcb953379b29c37eb9e7, committed unchanged asbc2f27744463fbea9b8a77ac7173e107cb01e53c, then rebuilt for the committed-head run. Environment: Windows x64, aligned Reactor preview.16, current repository WinUI SDK/runtime, isolated synthetic production Reactor root. This is native-root execution, not a complete Companion observation or original installed-runtime replay.The wide case now scrolls away immediately when the newest marker becomes visible, verifies top-position retention across ordinary append, then verifies a new explicit history jump despite an older native scroll. Before the repair, traces showed a still-issued tail offset applying after the reader reached zero; ignoring its late callback alone did not stop that native movement.
No current-head public screenshot/video link or completed interactive/full-app pool is claimed. The historical negative observations below remain open until rechecked on a qualified host.
Merged source: 2026-11-03 (historical)
The current merge commit
a151396deb7471cfa1a64a0058dd5bcd83b0149ahas the exact tested source tree37f34f282812334f5ac741f4d5441f12d9e1eb0e. Native execution used aligned Reactor preview.16 and an isolated synthetic production-root test host, not a new full-application observation. The pre-commit binary's informational version names the first parentac55e1e6; source correspondence is established by the recorded tree, not by claiming a post-commit binary run.At this historical revision the three native cases were failing. The current repair supersedes those native results; full-app behavior, original installed runtime, real provider/Gateway replay and the complete proof pool remain unverified. Earlier visible full-app observations below are retained as historical evidence only.
Original native-root proof (
b98c89bc, historical)b98c89bcee5249177c4dc564064f4828a0ae7425. The final five-case run followed a clean-worktree rebuild; the tested product DLL's informational version contains this exact SHA.HistoryTail_selector shown above in a fresh test host under a task-owned 60-second external watchdog. EnableOPENCLAW_VISUAL_TEST=1and a task-ownedOPENCLAW_VISUAL_TEST_DIRfor native render capture.Yes/No/N/A) N/A. No public image/artifact attachment is claimed; copied execution output is above.windows-winui-interactivepool and hosted CI. The existing installed client and real profile were not restarted or modified.Full-application follow-up (2026-10-30, historical partial)
This follow-up used a separate production
OpenClaw.Tray.WinUI.exeprocess, not the in-process Reactor test host. The existingOpenClaw.GatewayFixtureHostlaunched it with--scenario chat-interactive --duration-seconds 1200and a disposable profile. The production Gateway client, history loader, provider, shell and timeline were exercised; the loopback Gateway and conversation data were synthetic. No real model/provider or host command executed.The app's informational version contains head
b98c89bcee5249177c4dc564064f4828a0ae7425; its product DLL SHA-256 isA266D8927C5E09F75CEDBFE193EEB729AA438F0EB80317DE360138B33FFF8DBA. The loaded native XAML version was3.3.0.0. No source changes were made for this follow-up.Steps: select Fixture: 240-message conversation without scrolling it first; inspect its last row; send one synthetic message through the discovered
app.chat.send; wait for the fixture stream to finish; switch to the main conversation and back; then open Notifications > Open notifications > Back.Copied native UI diagnostics from the initial selection and completed append:
In both observations the final marker's complete vertical bounds, 1139..1160, were inside the actual transcript viewport, 570..1216.
app.chat.snapshotsubsequently reportedselectedTimeline.turnActive=falseand retained the complete final answer ending inFIXTURE INTERACTIVE COMPLETE. Switching away to the main session and reselecting the long session also restored this fully visible tail. These are manual full-process observations, not additional automated test passes.Remaining negative result: after Notifications > Back, the app still responded and the snapshot still contained the complete answer, but the native visible subtree ended partway through its table and did not expose the final marker. Reselecting the long session restored it. This recurred after a controlled reselection with no intervening scroll attempt, so route-return/remount tail visibility is not accepted. Whether this clipping predates the patch has not been established.
Other limits: background scroll/key attempts did not establish a verifiable reader scroll-up position, so full-app reader-position retention remains unproven. The 240-message full-app fixture is not the minimized 16-message giant-row case; that exact trigger still has native-root test-host evidence only. The existing full-app UIA attempt timed out at its 150-second worker deadline and was not a passing proof run. No public media attachment, original installed-runtime replay, real-provider replay, complete proof-pool result or cleared merge gate is claimed.
Security Impact
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain the risk and mitigation: N/A.Compatibility and Migration
Yes/No) YesYes/No) NoYes/No) NoMerge Danger
Door: two-way
Blast Radius: Chat
Changes are limited to the existing native chat tail positioner and its regression coverage. Native lifecycle/scroll timing remains the main risk; no data migration or Gateway contract changes are involved.
Review Conversations