Repository navigation
Description
Summary
OpenClaw Windows Companion sometimes fails to reconnect Node Mode after the remote gateway is restarted. The gateway is reachable, credentials and pairing are valid, but the Companion process remains stuck at Connecting to gateway until the process is force-killed and restarted.
Environment
- Windows Companion: v2026.7.1-4
- Companion ProductVersion: 2026.7.1-4+c7c6fb06be036de512d824986a6eee6eca14abdb
- Gateway: OpenClaw 2026.9.1 (ad6fe23)
- Gateway host: remote LAN machine,
ws://192.168.10.9:18789 - Local Windows node IP:
192.168.10.10 - Node mode enabled
Observed behavior
After restarting the gateway, Companion logs only:
Connecting to last successful gateway during startup: ws://<host>:18789/ (identity.DeviceToken)
Loaded Ed25519 device identity: [REDACTED]
Connecting to gateway: ws://<host>:18789/
Application started (WinUI 3)
It never logs:
gateway connected, waiting for challenge...
The gateway reports the device as paired and approved, but disconnected:
Known: 2 · Paired: 2 · Connected: 0
Windows Node (DESKTOP-1TJT2RH) paired · disconnected · approved
Network and gateway health are fine:
Test-NetConnection 192.168.10.9 -Port 18789 => TcpTestSucceeded: True
GET http://192.168.10.9:18789/healthz => {"ok":true,"status":"live"}
A standalone .NET ClientWebSocket test can connect and immediately receive connect.challenge.
Dump evidence
A process dump captured while Companion was stuck shows the reconnect task awaiting inside the WebSocket HTTP upgrade response path:
System.Net.Http.HttpConnection.<InitialFillAsync>
System.Net.Http.HttpConnection.<SendAsync>
System.Net.Http.HttpConnectionPool.<SendWithVersionDetectionAndRetryAsync>
System.Net.Http.RedirectHandler.<SendAsync>
System.Net.WebSockets.WebSocketHandle.<ConnectAsync>
System.Net.WebSockets.ClientWebSocket.<ConnectAsyncCore>
OpenClaw.Shared.WebSocketClientBase.<ConnectAsync>
OpenClaw.Shared.WebSocketClientBase.<ReconnectWithBackoffAsync>
This matches the log behavior: the app starts the connect attempt but never reaches the transport-connected callback.
Expected behavior
Each WebSocket connect attempt should have a bounded timeout. If ClientWebSocket.ConnectAsync() hangs or does not complete within a reasonable interval, Companion should abort that socket and continue the reconnect/backoff loop.
Actual behavior
The connect attempt can hang indefinitely. Normal app restart did not always recover it. Force-killing OpenClaw.Tray.WinUI.exe and launching it again immediately restored node mode.
Suggested fix
Wrap each ClientWebSocket.ConnectAsync(uri, ...) attempt in a per-attempt timeout, separate from the process lifetime cancellation token. On timeout:
- Abort/dispose the current
ClientWebSocket - Mark connection status as error/disconnected
- Continue the existing reconnect/backoff loop
- Log a clear message such as
gateway connect timed out
This seems related to OpenClaw.Shared.WebSocketClientBase.ConnectAsync.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Sep 6, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed September 7, 2026, 9:09 AM ET / 13:09 UTC.
Summary
The reported hang remains source-supported on current main. The linked setup PR explicitly excludes this runtime failure, so it does not establish a fix or supersession.
Reproducibility: yes. at source level: a peer that accepts TCP but withholds the HTTP upgrade response leaves the lifetime-token-only await pending and prevents another retry. This review did not execute that scenario.
Next step
Keep this P0 recovery blocker with its active owner for a focused timeout repair and Windows validation; the setup PR is not its implementation candidate, and a parallel automated dispatch is inappropriate.
Review details
Best possible solution:
Add an attempt-scoped transport deadline with socket cleanup and continued backoff, preserve shutdown and authorization guards, and provide a visible Retry or Fix action if automatic recovery fails.
Do we have a high-confidence way to reproduce the issue?
Yes, at source level: a peer that accepts TCP but withholds the HTTP upgrade response leaves the lifetime-token-only await pending and prevents another retry. This review did not execute that scenario.
Is this the best way to solve the issue?
Yes. A deadline in the shared transport is the narrow repair boundary; it must distinguish timeout from shutdown and preserve current socket ownership rather than add a parallel reconnect mechanism.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against 2bdcfc253310.
Label changes
Label changes:
clawsweeper:linked-pr-open: Current issue advisory state selects this label.clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.Label justifications:
P0: The reported Companion recovery path remains stuck until process termination, leaving no demonstrated in-product way forward.impact:crash-loop: An indefinitely pending transport connection prevents Node Mode from recovering.impact:ux-release-blocker: The reporter needed to force-kill and relaunch the Companion to restore operation.Evidence reviewed
What I checked:
src/OpenClaw.Shared/WebSocketClientBase.cs:262, 2bdcfc253310)src/OpenClaw.Shared/WebSocketClientBase.cs:568, 2bdcfc253310)src/OpenClaw.Shared/WebSocketClientBase.cs:262, c7c6fb06be03)tests/OpenClaw.Shared.Tests/WebSocketClientBaseTests.cs:314, 2bdcfc253310)src/OpenClaw.Connection/NodeConnector.cs:191, 2bdcfc253310)Likely related people:
How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.