openclaw - 💡(How to fix) Fix TUI: stuck on 'connecting | idle', spins at ~98% CPU, never establishes session [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#75806Fetched 2026-05-02 05:29:44
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
2
Timeline (top)
commented ×2closed ×1cross-referenced ×1renamed ×1

TUI gets stuck on connecting | idle indefinitely and never establishes a session, even when the gateway is healthy and responding normally on other surfaces (webchat, Telegram).


Error Message

  1. After ~1m 38s TUI exits on its own with no error message

Root Cause

TUI gets stuck on connecting | idle indefinitely and never establishes a session, even when the gateway is healthy and responding normally on other surfaces (webchat, Telegram).


Code Example

openclaw tui - ws://127.0.0.1:18789 - agent main - session main
   connecting | idle
   agent main | session main | unknown | tokens ?

---

2026-05-01T16:14:32 liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu
  eventLoopDelayP99Ms=6316.6 eventLoopDelayMaxMs=7268.7 eventLoopUtilization=0.999 cpuCoreRatio=0.95 queued=3

2026-05-01T16:18:46 liveness warning: reasons=event_loop_delay,event_loop_utilization
  eventLoopDelayP99Ms=7537.2 eventLoopDelayMaxMs=8447.3 eventLoopUtilization=0.999 queued=3

2026-05-01T16:20:52 liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu
  eventLoopDelayP99Ms=6534.7 eventLoopDelayMaxMs=7109.3 eventLoopUtilization=1 queued=2

2026-05-01T16:23:10 liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu
  eventLoopDelayP99Ms=7331.6 eventLoopDelayMaxMs=8178.9 eventLoopUtilization=0.999 queued=3

---

[trace:embedded-run] totalMs=31003 stages=core-plugin-tools:7264ms, system-prompt:5516ms, stream-setup:8905ms
[trace:embedded-run] totalMs=23548 stages=core-plugin-tools:6640ms, system-prompt:5363ms, stream-setup:5112ms
[trace:embedded-run] totalMs=20244 stages=core-plugin-tools:7718ms, system-prompt:5082ms, stream-setup:4695ms
[trace:embedded-run] totalMs=46764 stages=core-plugin-tools:9540ms, system-prompt:10323ms, stream-setup:4926ms
[trace:embedded-run] totalMs=35728 stages=core-plugin-tools:8977ms, system-prompt:8532ms, stream-setup:7566ms
[trace:embedded-run] totalMs=22206 stages=core-plugin-tools:8870ms, system-prompt:5841ms, stream-setup:5178ms
[trace:embedded-run] totalMs=21576 stages=core-plugin-tools:8172ms, system-prompt:5249ms, stream-setup:5546ms

---

⇄ res ✓ sessions.list 1349ms
⇄ res ✓ sessions.list 1317ms
⇄ res ✓ sessions.list 1474ms
⇄ res ✓ sessions.list 1522ms
RAW_BUFFERClick to expand / collapse

Summary

TUI gets stuck on connecting | idle indefinitely and never establishes a session, even when the gateway is healthy and responding normally on other surfaces (webchat, Telegram).


Steps to Reproduce

  1. Gateway is running and healthy (openclaw gateway status ok, webchat responding)
  2. Run openclaw tui
  3. TUI shows:
    openclaw tui - ws://127.0.0.1:18789 - agent main - session main
    connecting | idle
    agent main | session main | unknown | tokens ?
  4. Input prompt is frozen — cannot type anything
  5. Process is at ~98% CPU (ps aux | grep openclaw-tui)
  6. After ~1m 38s TUI exits on its own with no error message

Expected Behavior

TUI connects, session establishes, prompt is interactive.


Actual Behavior

  • TUI shows connecting | idle and never transitions to connected state
  • Input is completely frozen
  • Process spins at ~98% CPU
  • Eventually times out and exits silently (~98s)
  • If retried multiple times, stale TUI processes accumulate (each at ~98% CPU), further degrading the system

Gateway Logs Evidence

Event loop saturated during TUI attempts

Gateway liveness warnings show sustained saturation while TUI was stuck:

2026-05-01T16:14:32 liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu
  eventLoopDelayP99Ms=6316.6 eventLoopDelayMaxMs=7268.7 eventLoopUtilization=0.999 cpuCoreRatio=0.95 queued=3

2026-05-01T16:18:46 liveness warning: reasons=event_loop_delay,event_loop_utilization
  eventLoopDelayP99Ms=7537.2 eventLoopDelayMaxMs=8447.3 eventLoopUtilization=0.999 queued=3

2026-05-01T16:20:52 liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu
  eventLoopDelayP99Ms=6534.7 eventLoopDelayMaxMs=7109.3 eventLoopUtilization=1 queued=2

2026-05-01T16:23:10 liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu
  eventLoopDelayP99Ms=7331.6 eventLoopDelayMaxMs=8178.9 eventLoopUtilization=0.999 queued=3

core-plugin-tools baseline latency

Every single agent run (even with zero MCP servers configured) takes 6–9 seconds just in the core-plugin-tools prep stage:

[trace:embedded-run] totalMs=31003 stages=core-plugin-tools:7264ms, system-prompt:5516ms, stream-setup:8905ms
[trace:embedded-run] totalMs=23548 stages=core-plugin-tools:6640ms, system-prompt:5363ms, stream-setup:5112ms
[trace:embedded-run] totalMs=20244 stages=core-plugin-tools:7718ms, system-prompt:5082ms, stream-setup:4695ms
[trace:embedded-run] totalMs=46764 stages=core-plugin-tools:9540ms, system-prompt:10323ms, stream-setup:4926ms
[trace:embedded-run] totalMs=35728 stages=core-plugin-tools:8977ms, system-prompt:8532ms, stream-setup:7566ms
[trace:embedded-run] totalMs=22206 stages=core-plugin-tools:8870ms, system-prompt:5841ms, stream-setup:5178ms
[trace:embedded-run] totalMs=21576 stages=core-plugin-tools:8172ms, system-prompt:5249ms, stream-setup:5546ms

MCP config at time of logging: mcp.servers: {} (empty — zero MCP servers). The ~7–9s core-plugin-tools latency appears to be a baseline cost unrelated to MCP load.

sessions.list response times elevated

WebSocket API was also slow during TUI connect attempts:

⇄ res ✓ sessions.list 1349ms
⇄ res ✓ sessions.list 1317ms
⇄ res ✓ sessions.list 1474ms
⇄ res ✓ sessions.list 1522ms

Hypothesis

The TUI session handshake requires a timely sessions.list or similar response from the gateway. When the event loop is blocked by concurrent core-plugin-tools initializations (each taking 7–9s), the TUI's WS handshake times out. The TUI then spins at 100% CPU rather than exiting cleanly.

Even with zero MCP servers configured, the core-plugin-tools baseline latency is high enough to cause TUI connect failures under normal conversational load.


Environment

  • OpenClaw: 2026.4.29 (a448042)
  • OS: macOS Darwin 25.4.0 (arm64)
  • Terminal: iTerm2
  • Node: v25.5.0
  • MCP servers at time of failure: none (mcp.servers: {})

extent analysis

TL;DR

The TUI connection issue is likely caused by the event loop being blocked by concurrent core-plugin-tools initializations, leading to a timeout in the TUI's WebSocket handshake.

Guidance

  • Investigate the core-plugin-tools initialization process to identify the cause of the high baseline latency (7-9 seconds) and optimize it if possible.
  • Consider implementing a mechanism to prevent concurrent core-plugin-tools initializations from blocking the event loop.
  • Verify that the WebSocket API response times are within an acceptable range during TUI connect attempts.
  • Monitor the event loop utilization and adjust the system configuration to prevent saturation.

Example

No code snippet is provided as the issue is related to system configuration and performance optimization.

Notes

The high core-plugin-tools latency and event loop saturation are likely contributing factors to the TUI connection issue. Optimizing the core-plugin-tools initialization process and preventing concurrent initializations from blocking the event loop may help resolve the issue.

Recommendation

Apply a workaround to optimize the core-plugin-tools initialization process and prevent event loop saturation, as upgrading to a fixed version is not mentioned in the issue. This will likely require modifications to the system configuration and performance optimization techniques.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix TUI: stuck on 'connecting | idle', spins at ~98% CPU, never establishes session [2 comments, 2 participants]