Skip to content

[Bug] Switching sessions can hang WinUI while projecting ~200 history messages (v2026.7.1) #1167

Closed as not planned

Description

@sebastian-openclaw

Summary

OpenClaw Companion v2026.7.1 can become unresponsive when switching to a session whose history load returns approximately 200 messages. The gateway remains healthy while the native WinUI stops updating, and Windows records AppHangB1.

This appears related to synchronous history projection/snapshot rendering, but is distinct from the per-event streaming flood tracked in #1150 and its candidate fix #1158.

Environment

  • OpenClaw Companion: v2026.7.1
  • Release commit: 4206611f2b2e47cd575e1c8aa94e3e7708f6dd96
  • Windows desktop client: OpenClaw.Tray.WinUI.exe

Reproduction

  1. Have a session with enough history for the Companion to load the approximately 200-message history window.
  2. Switch from another session to that session.
  3. Wait while the history response is projected and the resulting snapshot is rendered.

Reproduced on 2026-08-16 around 12:04 local time.

Actual behavior

  • The native WinUI becomes unresponsive or stops visually updating.
  • Windows records AppHangB1.
  • Gateway health remains OK during the UI hang.

Expected behavior

Switching sessions and loading the bounded history window should remain responsive, including for histories containing many agent/tool events.

Exact-release source path

In the v2026.7.1 source, OpenClawChatDataProvider folds the loaded history (up to 200 messages) into timeline state and publishes the resulting snapshot. The Changed handler in OpenClawReactorChatRoot then calls setSnapshot(args.Snapshot), triggering the native WinUI/React render.

Even though this is one publication rather than the per-event publication storm in #1150, projecting and synchronously rendering a large snapshot immediately after a session switch can saturate the UI thread.

Relevant source:

  • src/OpenClaw.Tray.WinUI/Chat/OpenClawChatDataProvider.cs
  • the OpenClawReactorChatRoot snapshot Changed handler

Why this is not a duplicate of existing reports

Suggested fix/validation area

  • Batch or incrementally project history where practical.
  • Avoid a large synchronous full-timeline render on the UI thread after session selection.
  • Add a current-head WinUI responsiveness test that switches into a session with 200 varied history messages, including dense agent/tool entries.
  • Preserve scroll restoration, selection, and terminal event state while batching.

Crash scope

There was also one separate 2026-08-13 crash involving CoreMessagingXP.dll. There is not enough evidence to attribute that crash to this history-load hang, so this report is limited to the recurring AppHang/UI-saturation behavior.

Activity

  1. added
    clawsweeper:needs-live-repro
    clawsweeper:needs-maintainer-review
    clawsweeper:no-new-fix-pr
    impact:crash-loop
    issue-rating: 🐚 platinum hermit
    P1
    on Aug 16, 2026
  2. clawsweeper commented on Aug 16, 2026

    @clawsweeper

    Codex review: this still needs some work.

    Summary
    Keep open: released builds have concrete sustained-hang reports, current main retains the implicated navigation path, and maintainer investigation explicitly finds no verified fix.

    Reproducibility: There are credible released-build reproductions and redacted native navigation stacks, but no high-confidence current-main native x64 reproduction; maintainer synthetic runs remained responsive and exposed a separate positioning failure.

    Next step
    Capture native x64 restoration with verified binaries and redacted navigation entry/return traces, evaluate the existing candidates, and provide visible recovery that preserves conversation history.

    Review details

    Best possible solution:

    Restore responsive history loading and provide visible, conversation-preserving startup recovery while retaining final-row visibility and scrolled-up reader position.

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

    There are credible released-build reproductions and redacted native navigation stacks, but no high-confidence current-main native x64 reproduction; maintainer synthetic runs remained responsive and exposed a separate positioning failure.

    Is this the best way to solve the issue?

    Batching history projection alone is not established as the fix: dump-derived evidence points downstream to native scrolling, so the existing candidates need affected-case validation before another workaround is chosen.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No independent current-main native x64 reproduction distinguishes a non-returning native call from repeated completed navigation.
    • The recycled-anchor crash, incorrect tail placement, and sustained startup hang may require different fixes; successful synthetic switching cannot establish that all are resolved.

    Codex review notes: model internal, reasoning medium; reviewed against ed1444b0de69.

    Label changes

    Label changes:

    • add issue-rating: 🦪 silver shellfish: Current issue advisory state selects this label.
    • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.
    • add clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.
    • remove issue-rating: 🦐 gold shrimp: Current issue advisory state no longer selects this label.
    • remove clawsweeper:needs-info: Current issue advisory state no longer selects this label.

    Label justifications:

    • P0: Automatic restoration can repeatedly freeze the application and prevent in-product recovery, leaving ordinary users dependent on external tools or support.
    • impact:crash-loop: Reported sustained native UI hangs persist across restarts while the Gateway remains healthy.
    • impact:ux-release-blocker: The affected startup path can leave Settings unreachable; recovery currently requires intervention outside the application.
    Evidence reviewed

    What I checked:

    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; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed October 27, 2026, 12:26 PM ET / 16:26 UTC.

  3. MilkyWay008 commented on Aug 16, 2026

    @MilkyWay008

    Saw the AppHangB1 when switching into a dense session, that is the client folding ~200 messages into one render on the UI thread, so it freezes no matter how healthy the gateway is. Until the batched projection lands, the practical stopgap is keeping those hot sessions lean (archive or clear older chats so the load stays under the render threshold, and avoid the really dense ones for now). I would grab a current-head Windows trace during the switch too, since it looks like no fix exists on main yet, that will pin the trigger fast. Oh also, btw, I built a portable Hermes OTG and I run it on USB as my rescue agent for exactly these client-froze-and-wont-recover moments, check it, imo it'll help you. https://github.com/MilkyWay008/Hermes-OTG

  4. dotMorten commented on Aug 18, 2026

    @dotMorten
    Contributor

    @sebastian-openclaw I was trying to reproduce this issue and generated a bunch of long fake sessions.
    It felt pretty snappy to me and is clearly using virtualization for rendering. Am I missing something in how I'm trying to reproduce it?

    Recording.2026-08-18.093421.mp4
  5. added this to the 9/30 MXC Release milestone on Sep 4, 2026
  6. ShiroePL commented on Sep 4, 2026

    @ShiroePL

    Additional live repro + process dump data

    I can reproduce a hang that appears closely related to #1167, but my trigger is different: I do not manually switch sessions.

    The Companion hangs during startup/reconnect when it automatically restores the large default/main session.

    This is from the released Windows Companion build, not current main, so I don't want to overstate it as the current-head trace requested above. However, I captured a full process dump while the UI was hung, and it narrows the hotspot considerably.

    Environment

    • OpenClaw Companion: 2026.7.1-4
    • Product commit: c7c6fb06be036de512d824986a6eee6eca14abdb
    • File version: 2026.7.2.0
    • Gateway: 2026.9.1
    • Process: OpenClaw.Tray.WinUI.exe
    • Session: default/main session with a large history
    • Repeated chat.history response size: approximately 311 KB

    Reproduction

    My reproduction does not require manually switching sessions.

    The Companion automatically restores the default/main session during startup or reconnect.

    The reliable reproduction for me is:

    1. Start OpenClaw Companion while the Gateway is reachable, or reconnect the Companion to the Gateway.
    2. The Companion automatically restores the default/main session.
    3. It requests chat.history for that session (~311 KB response).
    4. The history is loaded and the UI becomes permanently unresponsive.

    If the Gateway is unreachable when the Companion starts, the WinUI remains responsive.

    Reconnecting to the Gateway triggers the session restoration/history-load path and can reproduce the hang.

    The relevant log sequence is consistently:

    [GatewayClient] Sending frame: chat.history
    Wizard response payload kind=Object len=311126

    Other reproductions were around 311072–311186 bytes.

    After this point, gateway/node health and tick traffic continues while the native UI is frozen.

    Windows records an Application Hang (Event ID 1002). The process is eventually terminated after remaining unresponsive.

    Dump result

    I captured a full dump with dotnet-dump while Responding=False.

    The process was consuming approximately one full CPU core during the hang, so this appears to be a CPU-bound UI-thread spin rather than a deadlock.

    The main UI thread was captured in this path:

    Program.Main
    -> Application.Start
    -> DispatcherQueueHandler.Do_Abi_Invoke
    -> InitialTailPositioner.b__0()
    -> InitialTailPositioner.StartTailRequest
    -> ItemsView.StartBringItemIntoView(index, BringIntoViewOptions)
    -> IItemsViewMethods.StartBringItemIntoView

    The relevant OpenClaw code appears to be:

    src/OpenClaw.Tray.WinUI/Chat/ReactorItemsViewScrollController.cs

    Specifically, OnLayoutUpdated detaches the layout handler and enqueues a dispatcher callback, which then calls StartTailRequest. The dump catches the UI thread after that callback enters the native WinUI ItemsView.StartBringItemIntoView() call.

    In this reproduction, history retrieval/parsing has already completed before the hang. The UI thread is captured inside the native StartBringItemIntoView() call, and that call does not return for the duration of the observed hang.

    The apparent sequence is therefore:

    large history restored
    -> ItemsView populated
    -> initial tail-follow / tail positioning
    -> LayoutUpdated
    -> dispatcher callback
    -> InitialTailPositioner.StartTailRequest
    -> ItemsView.StartBringItemIntoView(...)
    -> native WinUI call does not return
    -> UI thread consumes ~1 core
    -> DispatcherQueue stops making progress
    -> Application Hang

    This suggests that, at least for this reproduction, the immediate hotspot is initial tail positioning / StartBringItemIntoView() on the populated ItemsView, rather than JSON parsing or history projection itself.

    So I would consider this a refinement of #1167 rather than proof of the original suspected mechanism: the large-history restore still triggers the failure, but the captured hotspot is downstream in the initial tail-scroll path.

    This also appears directly related to the initial-tail positioning concern previously tracked in #1054: the dump catches the UI thread inside the same StartBringItemIntoView path discussed there.

    This seems distinct from the snapshot-coalescing work in #1301: the process dump catches the UI thread after snapshot/history application, inside the native tail-scroll path.

    Dump availability

    I retained the full dump locally, but I'm intentionally not attaching it because it is a full heap dump and may contain session/auth data.

    I can provide additional redacted thread stacks / dump-derived diagnostics if useful.

    If needed, I can also try to reproduce the same case against a current main/nightly build to provide the current-head trace requested in the earlier review.

  7. removed
    P1
    on Sep 4, 2026
  8. 33 remaining items

  9. added
    clawsweeper:needs-info
    issue-rating: 🦐 gold shrimp
    and removed
    issue-rating: 🦪 silver shellfish
    on Oct 14, 2026
  10. RomneyDa commented on Oct 22, 2026

    @RomneyDa
    Member

    Additional triage: this remains a Companion reliability/startup-restoration bug, with no demonstrated security-boundary crossing in the evidence reviewed.

    A further report on Store build 2026.10.401.0 describes a persistent native UI hang when automatically restoring a large main-session history, while Gateway health/tick traffic continues. Reducing that history reportedly restores startup responsiveness. This is a reporter observation, not an independent current-head reproduction; private correspondence and diagnostic material are not attached.

    The existing public investigation remains the right owner:

    • InitialTailPositioner in Chat/ReactorItemsViewScrollController.cs is the application navigation owner. In inspected commit 489208e06780c15920a9b3f35b1851534c0a3249, the layout handler detaches before queued navigation. Repeated hot stack samples alone do not distinguish one non-returning native StartBringItemIntoView call from repeated calls.
    • fix(chat): work around WinUI session-switch crash #1407 (fix(chat): work around WinUI session-switch crash) was closed in favor of fix: work around WinUI ItemsView recycled-anchor crashes microsoft/microsoft-ui-reactor#1214 (fix: work around WinUI ItemsView recycled-anchor crashes). Verify the deployed Reactor package contains that upstream change before introducing another application-side workaround. The upstream PR does not establish that every startup-hang symptom is fixed.
    • The next normal fix PR needs an isolated Windows x64 startup reproduction, package/binary provenance, and before/after proof. Preserve final-row visibility, repeated mixed-height session switching, and scrolled-up reader position, in addition to the repository build/test gates.

    Keeping #1167 open. No new patch, patched release, or passing runtime validation is claimed by this triage update.

  11. RomneyDa commented on Oct 22, 2026

    @RomneyDa
    Member

    Investigation update: no verified fix for the sustained native-chat hang yet.

    The corrected synthetic startup fixtures restore all 465 mixed-height messages or all 77 tall-table messages. Earlier baseline/candidate startup runs passed on Reactor preview.12 and preview.16, including self-contained x64 Release under Windows ARM64 emulation. This is not native x64 or Store-package proof, and later instrumented runs also reproduced intermittent incorrect startup positioning.

    A separate instrumented preview.16 run recorded 56 native StartBringItemIntoView entries and 56 returns, including four session replacements before the preceding native scroll completed. The app remained responsive during 48 rapid history selections. One startup case requested the final row but completed at offset zero, with focus still outside the transcript. This is a returned-but-mispositioned scroll, not the sustained UI-thread hang described here. It is consistent with, but does not independently prove, the compositor race described in microsoft/microsoft-ui-xaml#12086.

    The source detaches LayoutUpdated before issuing navigation; this evidence does not establish an endless successful app-side layout retry. The package upgrade and a tested extent-state adjustment did not reliably fix tail positioning. No scrolling workaround is being proposed from those results.

    For someone who can still reproduce the sustained hang: could you share the exact Companion version and CPU architecture, plus two redacted UI-thread stack samples taken a few seconds apart while it remains unresponsive? Please note whether background Gateway traffic continues. The important distinction is a single native navigation call that never returns versus repeated completed calls.

    Please keep full process dumps, credentials, and conversation payloads out of this public issue. No conversation reset is needed or requested for this investigation.

  12. added
    clawsweeper:intake:bug
    clawsweeper:needs-maintainer-review
    clawsweeper:no-new-fix-pr
    issue-rating: 🦪 silver shellfish
    and removed
    issue-rating: 🦐 gold shrimp
    clawsweeper:needs-info
    clawsweeper:intake:bug
    on Oct 27, 2026
  13. roboclaw-bot commented on Nov 10, 2026

    @roboclaw-bot
    Contributor

    Closing as a duplicate of #1568, not as fixed. The later dump evidence here narrows the sustained history-restoration hang to the same InitialTailPositioner.StartTailRequest -> ItemsView.StartBringItemIntoView UI-thread boundary documented there, with a healthy Gateway and matching released-build startup/reconnect reproductions. #1568 has the minimized tall-history reproducer and active #1935 (fix(chat): chat freezes when opening tall message history).

    The independent dumps, valid tail index, original approximately 200-message switch scenario and later 886,583-byte startup restoration have been linked in #1568 for acceptance. This does not merge every native crash into that mechanism: the invalid-anchor crash and returned-but-mispositioned scroll observations remain explicitly distinguished. Please follow #1568 for the unresolved hang and current-build verification; no conversation reset or public full dump is requested.

    Preserved evidence and acceptance cases: #1568 (comment)

  14. locked as resolved and limited conversation to collaborators on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0clawsweeper:needs-maintainer-reviewclawsweeper:no-new-fix-primpact:crash-loopimpact:ux-release-blockerissue-rating: 🦪 silver shellfish

Type

No type

Fields

Priority

None yet

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions