Skip to content

fix(chat): chat freezes when opening tall message history - #1935

Closed
DragonLi-Mi wants to merge 4 commits into
openclaw:mainfrom
DragonLi-Mi:fix/chat-tail-scroll-hang-1568
Closed

DragonLi-Mi wants to merge 4 commits into
openclaw:mainfrom
DragonLi-Mi:fix/chat-tail-scroll-hang-1568

Conversation

@DragonLi-Mi

@DragonLi-Mi DragonLi-Mi commented Oct 30, 2026 •

Copy link
Copy Markdown

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 recursive LayoutUpdated re-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

 tail request
-  ItemsView.StartBringItemIntoView (synchronous layout)
+  realize through normal native layout
+  request native target geometry asynchronously
+  preserve issued offsets when their containers recycle
+  retarget lost settled anchors using live coordinates
+  honor current reader navigation; fence stale completions

Evidence

  • Before: a synthetic production-root history with 16 mixed-role messages, one tall assistant row away from the end, and an unrealized newest row reproduced the UI-thread spin in StartBringItemIntoView. A task-owned external watchdog was needed to stop the frozen test host. The live Gateway health/readiness endpoints were responsive. Sanitized investigation.
  • Current repair (2026-11-04, 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.
  • Historical conflict-resolution check (2026-11-03): merged upstream b917d7e1 in a151396d. Native selection was 16 passed, 3 failed; the exact pre-merge-controller comparison reproduced those case identities. That comparison was not pristine default production.
  • Original-head after (historical, 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.
  • Current independent review: bounded Copilot code-review follow-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.
  • Historical original-head review: GPT-6 Astra reviewed the Standards and Spec axes with no significant issues reported. The canonical isolated autoreview helper additionally completed its P0-P3 implementation/proof-plan review with Codex/GPT-6 Luna: three complete passes, 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

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required 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 tree cbda8dd433e1c13efde5dcb953379b29c37eb9e7; 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, existing TailNavigationPolicy, source/policy tests and native regression file.

Before editing, fetched default main at 12789b405719c5755955674f37fa09ad0eb07b3d and inspected its 15 commits after b917d7e1: 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.

Current check / command Actual result
.\build.ps1 Passed
dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore 4,809 passed, 0 failed, 25 existing skipped
dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore 4,796 passed, 0 failed, 0 skipped
Same Tray project with --filter "FullyQualifiedName~ChatTimelinePresentationTests" 55 passed, 0 failed, 0 skipped
dotnet build .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 --no-restore Passed, including a committed-head rebuild
Native test project with --no-build --no-restore -c Debug -r win-x64 --filter "FullyQualifiedName~ReactorChatLayoutProofTests" 130 passed, 0 failed, 2 existing gated skips
Same native project with --filter "FullyQualifiedName~HistoryTail_", ten fresh processes 50 passed, 0 failed, 0 skipped
Same 19-case native selector documented below 19 passed, 0 failed, 0 skipped; also passed twice before full closeout
Rebuilt committed-head HistoryTail_ selector 5 passed, 0 failed, 0 skipped
Changed controller/policy/unit-test whitespace verification and git diff --cached --check Passed

The 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 b917d7e1 production plus this PR's transplanted regression tests. Append failed 3/3 on both default production and a151; append/remount failed 1/3 on default and 3/3 on a151. 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 upstream b917d7e197e5194a14577a290805be4d13c409be. Tests ran before commit on recorded tree 37f34f282812334f5ac741f4d5441f12d9e1eb0e; the committed tree was verified identical.

At this historical merge, the resolution kept upstream InitialTailNavigationRequest.TryResolve inside the dispatcher, with its originating generation, and retained low-priority asynchronous native navigation. renderAfterLayout propagated 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.

Historical merged-tree check Actual result
.\build.ps1 -NoTrustRepository All 5 production projects passed; 69 Markdown files validated
dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --filter "FullyQualifiedName~ChatTimelinePresentationTests" 47 passed, 0 failed
dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore 4,809 passed, 0 failed, 25 existing skipped
dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore 4,788 passed, 0 failed, 0 skipped
dotnet build .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 --no-restore Passed; 0 warnings/errors
Native HistoryTail_, MountedReactorChatDisposalProofTests, ProductionRoot_ selection 16 passed, 3 failed, 0 skipped; 43.2203 seconds
Same-environment comparison using the byte-identical pre-merge ac55e1e6 controller, HistoryTail_ selector 2 passed, 3 failed; the same three failing case identities
git diff --cached --check, unresolved-index check, tested-tree/commit equality Passed

The 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-review implementation/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)

.\build.ps1 -NoTrustRepository
dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore
dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore
dotnet build .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 --no-restore
dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 --no-build --no-restore --filter "FullyQualifiedName~HistoryTail_|FullyQualifiedName~MountedReactorChatDisposalProofTests|FullyQualifiedName~ProductionRoot_"
dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 --no-build --no-restore --filter "FullyQualifiedName~HistoryTail_"
git diff 4cbbe51c45a7653e75ecf7d85481d7014b7e374b HEAD --check
Check Result
Full build and documentation validation All 5 production projects passed; 68 Markdown files validated
Shared tests 4,807 passed, 0 failed, 25 existing skipped
Tray tests, including updated source guard 4,763 passed, 0 failed, 0 skipped
Native regression plus lifecycle/root siblings 19 passed, 0 failed, 0 skipped
Fresh-process native regression repetition 5 passed, 0 failed, 0 skipped
Rebuilt committed-head native regression 5 passed, 0 failed, 0 skipped; build had 0 warnings/errors
Additional full-app UIA attempt Failed at the existing 150-second worker deadline; the remaining task-owned test process was stopped. No passing result is claimed for this attempt
Whitespace diff check Passed

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 quiet reports 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 main at a4dd026cc5f85a444a0fcd05eef5b86282dbda8c. 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 is b48cb69d4adf2dd04dcff08317185e3d66b98368.

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.

2026-11-02 check or exact command Result
PowerShell-bundled Roslyn CSharpSyntaxTree.ParseText for the three final PR C# files Passed; 0 syntax errors. Static parsing only, not compilation or test execution
git diff --cached origin/main --check Passed; the final PR delta remains limited to the original three paths
Unmerged-index check and exported-patch application to the pinned main Passed; 0 unresolved entries and the patch reproduces the exact resolved tree
.\build.ps1 -NoTrustRepository Blocked before compilation by NU1900: NuGet vulnerability data could not be retrieved because the TLS handshake to api.nuget.org fails. Prerequisites passed and 69 Markdown files validated
dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore --verbosity minimal Blocked by NETSDK1004 because restore assets are absent; 0 tests executed
dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --verbosity minimal Blocked by NETSDK1004 because restore assets are absent; 0 tests executed

No 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 as bc2f27744463fbea9b8a77ac7173e107cb01e53c, 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.

Entire ReactorChatLayoutProofTests class: 130 passed; 0 failed; 2 gated skips
HistoryTail_ (ten fresh processes):       50 passed; 0 failed; 0 skipped
Final native lifecycle/root selection:   19 passed; 0 failed; 0 skipped
Committed-head rebuilt HistoryTail_:      5 passed; 0 failed; 0 skipped

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 a151396deb7471cfa1a64a0058dd5bcd83b0149a has the exact tested source tree 37f34f282812334f5ac741f4d5441f12d9e1eb0e. 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 parent ac55e1e6; source correspondence is established by the recorded tree, not by claiming a post-commit binary run.

Final native selection: 19 tests; 16 passed; 3 failed; 0 skipped
HistoryTail_ at width 320: passed
HistoryTail_ at width 800: passed
HistoryTail_ at width 1007: append, append/remount, explicit jump failed
Same three case identities fail with the exact pre-merge controller

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)

  • Environment tested: Windows x64, .NET SDK 10.0.403/runtime 10.0.14, current Windows App SDK 2.6.4/native WinUI 3.3, isolated production Reactor root with a synthetic provider.
  • PR head or commit tested: b98c89bcee5249177c4dc564064f4828a0ae7425. The final five-case run followed a clean-worktree rebuild; the tested product DLL's informational version contains this exact SHA.
  • Exact steps or command run: build the native test project, then run the HistoryTail_ selector shown above in a fresh test host under a task-owned 60-second external watchdog. Enable OPENCLAW_VISUAL_TEST=1 and a task-owned OPENCLAW_VISUAL_TEST_DIR for native render capture.
  • Evidence after fix:
Tested head: b98c89bcee5249177c4dc564064f4828a0ae7425
Build succeeded. 0 Warning(s), 0 Error(s)
HistoryTail_ScrollsPastTallMessageWithoutBlockingUi
  width: 1007, append: True,  remount: False   Passed
  width: 1007, append: True,  remount: True    Passed
  width: 1007, append: False, remount: False   Passed
  width: 320,  append: False, remount: False   Passed
  width: 800,  append: False, remount: False   Passed
Total tests: 5; Passed: 5; Failed: 0
Total time: 9.6463 Seconds
Tested product DLL SHA-256:
A266D8927C5E09F75CEDBFE193EEB729AA438F0EB80317DE360138B33FFF8DBA
  • Observed result: the native UI remains runnable, the newest message is a realized container and fully within the actual viewport, scroll-up is preserved on an ordinary append, and an explicit revision jump reaches the new tail. A native render capture was inspected locally and showed the newest historical message above the composer.
  • Screenshot or artifact links verified? (Yes/No/N/A) N/A. No public image/artifact attachment is claimed; copied execution output is above.
  • Not verified or blocked: original installed WinUI 3.2 runtime; real Gateway/provider replay; hardware input/compositor capture; complete windows-winui-interactive pool 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.exe process, not the in-process Reactor test host. The existing OpenClaw.GatewayFixtureHost launched it with --scenario chat-interactive --duration-seconds 1200 and 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 is A266D8927C5E09F75CEDBFE193EEB729AA438F0EB80317DE360138B33FFF8DBA. The loaded native XAML version was 3.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:

Window: "OpenClaw" 1280x860
OwnerDetail: Connected

Initial history selection:
AXTable Chat messages screen@785,570 1007x646
AXStaticText FIXTURE LONG END 240 screen@921,1139 736x21

After synthetic streaming append:
AXTable Chat messages screen@785,570 1007x646
AXStaticText FIXTURE INTERACTIVE COMPLETE screen@921,1139 736x21

In both observations the final marker's complete vertical bounds, 1139..1160, were inside the actual transcript viewport, 570..1216. app.chat.snapshot subsequently reported selectedTimeline.turnActive=false and retained the complete final answer ending in FIXTURE 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

  • New permissions or capabilities? (Yes/No) No
  • Secrets or tokens handling changed? (Yes/No) No
  • New or changed network calls? (Yes/No) No
  • Command or tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any answer is Yes, explain the risk and mitigation: N/A.

Compatibility and Migration

  • Backward compatible? (Yes/No) Yes
  • Config or environment changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, list the exact upgrade steps: N/A.

Merge 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

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

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
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. 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 Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge.

What this changes

Replaces 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.

  • Before: Synchronous native navigation can freeze the UI thread.
  • After: The supplied current-head native tests reach the newest message while the UI remains responsive.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused source repair and native regression coverage are credible, but supplied application evidence does not clear the required current-head behavior gate; no builds, tests, or independent reviewer were run during this review.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Companion becomes unresponsive when navigating past tall virtualized chat history.
Reason: Multiple released-user reports and a targeted native reproduction justify a focused repair that preserves existing user-facing behavior.

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
Reviewed head: bc2f27744463fbea9b8a77ac7173e107cb01e53c

Before merge

  • Add real behavior proof - Current-head evidence exercises the production Reactor root in a native test host, including five rebuilt regressions and repeated passes, but supplies no current-head shipped-app acceptance. Historical full-process diagnostics demonstrate initial history and append on an older head, while Notifications return clipped the final answer and full-app reader retention remained unproven. The earlier review's shipped-app rank-up requirement therefore remains applicable. Supply a current-head recording, screenshots with UI diagnostics, or redacted runtime output for those scenarios; redact credentials, IPs, and non-public endpoints. Release acceptance is explicitly blocked by the signed cleanup-host prerequisite. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

None.

Tests

  • Missing end-to-end proof: Current-head Debug and production-shaped Release Companion evidence must show tall-history arrival, append, Notifications return, and reader scroll-up retention.
Agent review details

How this fits together

The 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
Loading

Technical review

Best 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

  • Native tail positioning and virtualization changes intended behavior with a stated reason (9acafa6: The Reactor migration preserved initial-history tail positioning while leaving virtualization and geometry with native controls.)
  • Discrete follow requests and bottom anchoring changes intended behavior with a stated reason (ca8fb4a: Stable row identity and final validation prevented stale navigation and continuous streamed-text scrolling; the PR explains why the synchronous implementation must change.)
  • Reflow and live-coordinate dispatch keeps the original intent (6e835ec: Resolve current tail coordinates inside the dispatcher while retaining the originating generation and existing input/follow gates.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Review metrics

Metric Value Why it matters
Introduced source growth Production +190/-12 lines; tests +163/-6 lines The growth stays within existing owners and covers native operation ownership, recycling, cancellation, and distinct rendering regressions.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #1568
Summary: This PR is the explicit candidate repair for the canonical report's blocked native tail-navigation boundary.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • P0: Restoring chat can freeze the entire application, leaving affected community users unable to reach in-product recovery without terminating the process or editing configuration.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide the current-head Companion evidence identified in realBehaviorProof and resolve or classify the retained Notifications-return observation.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-30T05:52:07.750Z sha b98c89b :: needs real behavior proof before merge. :: none

Reviewed November 4, 2026, 12:23 AM ET / 05:23 UTC (Revision 2).

@DragonLi-Mi

Copy link
Copy Markdown
Author

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

  • Same head: b98c89bcee5249177c4dc564064f4828a0ae7425. Product DLL SHA-256: A266D8927C5E09F75CEDBFE193EEB729AA438F0EB80317DE360138B33FFF8DBA. Loaded native XAML: 3.3.0.0.
  • The existing OpenClaw.GatewayFixtureHost launched the actual OpenClaw.Tray.WinUI.exe with --scenario chat-interactive --duration-seconds 1200 and a disposable profile. This exercised the production client/provider/history/shell/native timeline, rather than only mounting the Reactor root in a test host.
  • The Gateway and data were synthetic and loopback-only; no real AI provider or host command executed. The installed Companion, real profile and real Gateway were not modified.

Observed behavior

Scenario Actual result
Select the 240-message fixture without manually scrolling first Responsive; complete FIXTURE LONG END 240 marker within the transcript viewport
Append a synthetic streamed reply through discovered app.chat.send Complete FIXTURE INTERACTIVE COMPLETE marker visible above the composer; subsequent snapshot has turnActive=false and the complete final answer
Switch to the main conversation and reselect the long conversation Responsive; the complete latest marker is visible again
Notifications > Open notifications > Back Responsive, but the streamed answer is clipped before its final marker. Repeated after controlled reselection with no intervening scroll attempt. This does not satisfy remount tail-visibility acceptance
Scroll up, then receive an append in the full app Not proven. Background scroll/key delivery did not establish an observable reader position; the existing native-root test remains the only evidence for this case

Copied native UI diagnostics for the successful initial-tail/append observations:

Window: "OpenClaw" 1280x860
OwnerDetail: Connected
Transcript: AXTable Chat messages screen@785,570 1007x646
Initial tail: AXStaticText FIXTURE LONG END 240 screen@921,1139 736x21
Appended tail: AXStaticText FIXTURE INTERACTIVE COMPLETE screen@921,1139 736x21

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 app.chat.snapshot. That is a real remaining observation, not a pass inferred from Responding=True. I have not established whether the clipping is introduced by this patch or already present in the base.

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 GatewayFixtureUiTests.WithAppAsync's 150-second deadline, and I stopped the remaining task-owned run. Those attempts are not included in the passing test counts.

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 ItemsView.StartBringItemIntoView and the mounted behavioral tests are the relevant independent protections. This evidence-only follow-up makes no source/test changes, so I am not claiming the suggested assertion cleanup is implemented or resolved.

Original installed WinUI 3.2, real-provider replay, complete windows-winui-interactive proof and full-app reader retention remain unverified. The route-return result also needs investigation before declaring the application acceptance complete. No re-review/merge-readiness claim is being made.

DragonLi-Mi and others added 3 commits November 2, 2026 15:34
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
@DragonLi-Mi

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@karkarl

karkarl commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@dotMorten could you take a look at the approach here? I'm concerned about carrying a substantial application-level workaround for ItemsView.StartBringItemIntoView rather than fixing the underlying behavior in WinUI.

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 ItemsView or its underlying scrolling/layout implementation, leaving only chat-specific tail-follow and reader-cancellation policy here?

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.

@dotMorten

Copy link
Copy Markdown
Contributor

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

@DragonLi-Mi

Copy link
Copy Markdown
Author

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

@roboclaw-bot

Copy link
Copy Markdown
Contributor

PR cleanup review

Reviewed head: bc2f27744463fbea9b8a77ac7173e107cb01e53c. Main comparison: e59374c064f43d68f5c72d070d4c89ef2d20ec3b.

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.

@karkarl

karkarl commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

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

I will close this PR then. Thanks for your contribution @DragonLi-Mi!

@karkarl karkarl closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat tail-scroll controller spins the UI thread at 100% CPU on layout changes

4 participants