Skip to content

Dashboard chat page hangs/becomes unresponsive with large session history #20588

@amzzzzzzz

Description

@amzzzzzzz

Environment

  • OpenClaw Version: 2026.2.17
  • OS: macOS 15.3 (Tahoe)
  • Browser: Chrome 145.0.7632.77
  • Gateway: Running as LaunchAgent on 127.0.0.1:18789

Issue Summary

The dashboard's /chat page becomes unresponsive (Chrome shows "Page Unresponsive") when the session history contains many messages. This creates a poor user experience and makes the dashboard unusable for power users with extended conversations.

Symptoms

  1. Chat page hangs: The /chat page frequently causes Chrome to show "Page Unresponsive" dialog
  2. No streaming: Chat shows thinking indicator (...) but never streams the response in real-time
  3. WebSocket disconnects: Gateway logs show repeated WebSocket connect/disconnect cycles (code=1001)
  4. Other pages work fine: Overview and other dashboard pages load normally

Root Cause Analysis

After investigation, we found:

  • Current session had 292 messages totaling 1.5MB
  • Some archived sessions were up to 8.2MB
  • The chat UI appears to load and render the entire message history at once
  • This causes Chrome to hang when rendering large histories

Gateway Logs (WebSocket disconnects)

[ws] webchat disconnected code=1001 reason=n/a
[ws] webchat connected conn=...
[ws] webchat disconnected code=1001 reason=n/a  (2-4 seconds later)
[ws] webchat connected conn=...

The rapid connect/disconnect cycle (code=1001 = client-initiated "Going Away") suggests the browser is killing the tab due to unresponsiveness, then the UI tries to reconnect.

Workaround

Archiving large session files (>1MB) to a separate directory fixes the issue:

mkdir -p ~/.openclaw/agents/main/sessions/archive
mv ~/.openclaw/agents/main/sessions/<large-session>.jsonl ~/.openclaw/agents/main/sessions/archive/
openclaw gateway restart

Suggested Fixes

  1. Virtualized list rendering: Use virtual scrolling (e.g., react-window, @tanstack/virtual) to only render visible messages
  2. Pagination: Load messages in chunks (e.g., last 50 messages, load more on scroll up)
  3. Lazy loading: Don't fetch full message content until user scrolls to it
  4. Message truncation: Collapse large tool outputs by default, expand on click
  5. Session size warning: Alert users when session is getting large, suggest archiving

Additional Context

  • Also encountered Issue 1 (resolved): CSS contained Google Fonts @import that was blocked by gateway's CSP (font-src 'self'), causing blank page. Fixed by manually stripping the import.

Reproduction Steps

  1. Use OpenClaw extensively via iMessage/Telegram (accumulate 200+ messages)
  2. Open dashboard at http://127.0.0.1:18789/
  3. Navigate to /chat
  4. Observe page becoming unresponsive

Labels

bug, dashboard, performance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions