openclaw / openclaw/openclaw-windows-node

Windows Tray app crash-loops with Microsoft.UI.Xaml.LayoutCycleException under rapid event throughput

Open
#1,270 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

impact:crash-loop issue-rating: 🦪 silver shellfish P1 stale
Dominant language
C#
Stars
2.1k
Forks
295
Avg merge
1d 6h
Merged PRs (30d)
99

Description

Environment

OpenClaw Windows Tray version: 2026.7.1 (also reproduced on 2026.7.1-2)
OS: Windows 10.0.29648.0, x64
Gateway version: 2026.7.1 (remote gateway over wss://)
Topology: Remote gateway, node mode enabled
Summary
The Windows tray app repeatedly crashes and auto-restarts under load, with the following unhandled exception in crash.log:

Copy
Microsoft.UI.Xaml.LayoutCycleException: The text associated with this error code could not be found.
Element is already the child of another element.
Observed pattern
Over a ~30 minute window, the tray app restarted at least 6 times:

21:05:41, 21:08:54, 21:12:30, 21:25:43 (local +02:00), plus the crash itself at 21:21:02
Restart intervals as short as ~3 minutes apart during the worst period
Suspected trigger
Tray log (openclaw-tray.log) shows very high-frequency inbound events during active sessions — presence, health, node.invoke.request/result, chat, sessions.changed, agent stream events — sometimes multiple events within the same millisecond. These appear to feed directly into UI-bound collections (activity stream, node list, session list). Under sustained high throughput, this likely races the WinUI layout/measure-arrange pass, causing an element to be re-parented while still attached elsewhere — the classic root cause of LayoutCycleException.

Impact

Tray app becomes unusable during high-activity sessions (agent actively running tool calls/exec approvals)
Requires manual force-kill + relaunch to recover
No user-facing error dialog observed — app just disappears/restarts silently
Suggested fixes

Batch/throttle UI updates from the event stream (e.g. coalesce rapid presence/health ticks before dispatching to UI thread)
Ensure all collection mutations happen on the UI thread via DispatcherQueue, not directly from the websocket receive callback
Add global unhandled-exception handling around the XAML layout pass to prevent full app termination (log + recover instead of crash)
Attached crash.log tail:

Copy
[2026-08-30 21:21:02.506] UnhandledException
Microsoft.UI.Xaml.LayoutCycleException: The text associated with this error code could not be found.
Element is already the child of another element.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with crash.log and openclaw-tray.log, then trace the high-frequency presence, health, node, chat, session, and agent-stream events into the tray's UI-bound collections. Determine whether collection mutations or element ownership occur during concurrent updates, and validate the fix by reproducing sustained event throughput without further LayoutCycleException crashes or restarts.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.