openclaw - 💡(How to fix) Fix [Bug]: TUI never registers with gateway — sessions.resolve fails, causing input echo lag and web UI sync issues [1 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#58520Fetched 2026-04-08 02:01:41
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

openclaw tui has a persistent TCP connection to the gateway (port 18789) but never appears as an authenticated WebSocket client in gateway logs. As a result, sessions.resolve("openclaw-tui") fails, the TUI can't subscribe to real-time gateway events, and falls back to a degraded local render path.

Root Cause

Root Cause (hypothesis)

Code Example

$ ss -tnp | grep 18789
ESTAB  127.0.0.1:18789  127.0.0.1:51248  openclaw-gateway (pid=1327367)
ESTAB  127.0.0.1:51248  127.0.0.1:18789  openclaw-tui (pid=1327965)

---

$ grep '"client":' gateway.log | sort | uniq -c
3  "client":"cli"
# no "client":"openclaw-tui" or any tui entry

---

sessions.resolve  INVALID_REQUEST  "No session found: openclaw-tui"

---

{
  "agent:main:main": {
    "origin": { "label": "openclaw-tui", "provider": "webchat", "surface": "webchat" },
    "lastChannel": "webchat"
  }
}
RAW_BUFFERClick to expand / collapse

Environment

  • OpenClaw version: 2026.3.28 (f9b1079)
  • OS: Linux 6.17.9-76061709-generic x64
  • Node: 25.8.1
  • Gateway mode: local, loopback, port 18789

Summary

openclaw tui has a persistent TCP connection to the gateway (port 18789) but never appears as an authenticated WebSocket client in gateway logs. As a result, sessions.resolve("openclaw-tui") fails, the TUI can't subscribe to real-time gateway events, and falls back to a degraded local render path.

Symptoms

  1. Input echo lag — keystrokes are noticeably delayed before appearing in the TUI composer
  2. Responses not visible in web UI — TUI session activity is invisible to the web UI dashboard
  3. Web UI re-prints full history on every new message (falls back to chat.history polling instead of incremental streaming)

Evidence

Gateway log: TUI never connects as a WebSocket client

Across a full day of gateway logs, the only connected WebSocket clients are openclaw-control-ui (web UI) and cli probe connections. The TUI process has an established TCP connection to port 18789 (confirmed via ss), but zero "connected" log entries:

$ ss -tnp | grep 18789
ESTAB  127.0.0.1:18789  127.0.0.1:51248  openclaw-gateway (pid=1327367)
ESTAB  127.0.0.1:51248  127.0.0.1:18789  openclaw-tui (pid=1327965)
$ grep '"client":' gateway.log | sort | uniq -c
3  "client":"cli"
# no "client":"openclaw-tui" or any tui entry

sessions.resolve failure

On every TUI startup (and web UI connect), the gateway returns:

sessions.resolve  INVALID_REQUEST  "No session found: openclaw-tui"

Two connections hit this simultaneously — one is the TUI trying to find its own session, one appears to be the web UI trying to subscribe to TUI activity.

The actual session is stored as agent:main:main with origin.label = "openclaw-tui", but there is no label→key mapping the gateway can use to resolve it.

Session store

{
  "agent:main:main": {
    "origin": { "label": "openclaw-tui", "provider": "webchat", "surface": "webchat" },
    "lastChannel": "webchat"
  }
}

No openclaw-tui key exists — only agent:main:main and cron sessions.

Root Cause (hypothesis)

sessions.resolve only looks up sessions by their store key (agent:main:main), not by origin label (openclaw-tui). The TUI connects to the gateway but either:

  • Never completes the WebSocket auth handshake (explaining the missing "connected" log), or
  • Completes it under an identity the gateway doesn't map back to the session store

Either way, the TUI never gets a valid subscription to its own session's event stream, forcing everything onto a poll/fallback path.

Impact

All three symptoms share this single root cause. A fix to sessions.resolve to support label→key lookup (or ensuring the TUI registers its connection identity against the session store on connect) should resolve input echo lag, web UI sync, and history re-printing together.

extent analysis

TL;DR

The most likely fix involves modifying the sessions.resolve function to support lookup by origin label, allowing the TUI to authenticate and subscribe to its own session's event stream.

Guidance

  • Verify the session store data to ensure the origin.label is correctly set to "openclaw-tui" for the TUI session.
  • Investigate the WebSocket authentication handshake process to determine if the TUI is completing the handshake correctly and if the gateway is receiving the expected identity information.
  • Consider adding a label→key mapping to the gateway's session store to enable lookup by origin label.
  • Test the sessions.resolve function with a modified implementation that supports label→key lookup to confirm the fix resolves the symptoms.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The root cause hypothesis suggests that the issue is related to the sessions.resolve function not supporting lookup by origin label. However, without more information about the implementation, it is difficult to provide a definitive fix.

Recommendation

Apply a workaround by modifying the sessions.resolve function to support label→key lookup, allowing the TUI to authenticate and subscribe to its own session's event stream. This should resolve the input echo lag, web UI sync, and history re-printing issues.

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