openclaw - ✅(Solved) Fix [Bug]: WSL local gateway binds but WebSocket handshake times out on 2026.4.26 [2 pull requests, 1 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#73592Fetched 2026-04-29 06:17:47
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
cross-referenced ×3commented ×1

On WSL2, OpenClaw 2026.4.26 starts the local gateway service and binds 127.0.0.1:18789, but local clients fail to complete the WebSocket pre-auth/connect handshake. The gateway port is listening, and the service reports active (running), but CLI/dashboard/WebSocket clients time out or close before connect.

This appears related to the current gateway WebSocket handshake path rather than a missing binary, invalid config, or WSL being down.

Root Cause

On WSL2, OpenClaw 2026.4.26 starts the local gateway service and binds 127.0.0.1:18789, but local clients fail to complete the WebSocket pre-auth/connect handshake. The gateway port is listening, and the service reports active (running), but CLI/dashboard/WebSocket clients time out or close before connect.

This appears related to the current gateway WebSocket handshake path rather than a missing binary, invalid config, or WSL being down.

Fix Action

Fix / Workaround

Temporary workarounds to validate

Potential workarounds under investigation:

No durable workaround has been confirmed yet for this exact 2026.4.26 WSL setup.

PR fix notes

PR #51282: feat(gateway): make handshake timeout configurable via gateway.handshakeTimeoutMs

Description (problem / solution / changelog)

Summary

Add gateway.handshakeTimeoutMs config option so users can tune the WebSocket handshake timeout from their config file, without patching dist files or relying solely on env vars.

Changes

  • src/config/types.gateway.ts: Add handshakeTimeoutMs?: number to GatewayConfig
  • src/gateway/server-constants.ts: Read config value in getHandshakeTimeoutMs() with priority: env var > config file > default (10s)
  • src/config/schema.help.ts: Add help text for the new field

Priority Order

  1. OPENCLAW_HANDSHAKE_TIMEOUT_MS env var (existing, unchanged)
  2. gateway.handshakeTimeoutMs in config file (new)
  3. Default: 10,000 ms

Context

#49262 bumped the default from 3s to 10s, but #51274 reports that loaded gateways (600MB+, 80+ tasks) still need higher values. The reporter currently patches dist files via a systemd drop-in. This PR lets them set it in config instead:

gateway:
  handshakeTimeoutMs: 15000

Closes #51274

Changed files

  • src/config/schema.help.ts (modified, +2/-0)
  • src/config/types.gateway.ts (modified, +7/-0)
  • src/gateway/server-constants.ts (modified, +13/-0)

PR #73474: fix(gateway,proxy): bypass Windows proxy for localhost gateway connections

Description (problem / solution / changelog)

Summary

Fix an issue where OpenClaw CLI fails to connect to the local gateway at ws://127.0.0.1:18789 or ws://localhost:18789 when Windows proxy environment variables are inherited by WSL.

Problem

When running OpenClaw CLI in WSL on Windows, connections to the local gateway timeout because the HTTP/WebSocket client respects the Windows proxy settings even for localhost connections.

Changes

src/gateway/client.ts

  • Use isLoopbackHost instead of isLoopbackIpAddress for better localhost detection

src/infra/net/proxy/proxy-lifecycle.ts

  • Clear proxy environment variables when OpenClaw proxy is inactive but system proxy may be set

Testing

Build: pnpm build - PASSED

Changed files

  • src/gateway/client.ts (modified, +1/-2)
  • src/infra/net/proxy/proxy-lifecycle.ts (modified, +30/-2)

Code Example

OpenClaw 2026.4.26 (be8c246)

---

Config valid: ~/.openclaw/openclaw.json

---

Service: systemd (enabled)
Command: /usr/bin/node /home/venka/.npm-global/lib/node_modules/openclaw/dist/index.js gateway --port 18789
Gateway: bind=loopback (127.0.0.1), port=18789
Runtime: running (... state active ...)
...
[gateway] http server listening (...; 35.0s)
[gateway] starting channels and sidecars...

---

Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: /home/venka/.openclaw/openclaw.json
Bind: loopback

Gateway closed (1006 abnormal closure (no close frame)): no close reason

---

curl: (28) Operation timed out after 10032 milliseconds with 0 bytes received

---

[gateway] loading configuration…
[gateway] resolving authentication…
[gateway] starting...
[gateway] starting HTTP server...
[canvas] host mounted at http://127.0.0.1:18789/__openclaw__/canvas/
[health-monitor] started
[gateway] agent model: openrouter/tencent/hy3-preview:free
[gateway] http server listening (...; 35.0s)
[gateway] log file: /tmp/openclaw/openclaw-2026-04-28.log
[gateway] starting channels and sidecars...
[hooks] loaded 4 internal hook handlers
[ws] handshake timeout conn=... peer=127.0.0.1:<ephemeral>->127.0.0.1:18789 remote=127.0.0.1
[ws] closed before connect conn=... peer=127.0.0.1:<ephemeral>->127.0.0.1:18789 remote=127.0.0.1 fwd=n/a origin=http://127.0.0.1:18789 host=127.0.0.1:18789 ua=Mozilla/... code=1000 reason=n/a

---

Stopping openclaw-gateway.service...
openclaw-gateway.service: State 'stop-sigterm' timed out. Killing.
openclaw-gateway.service: Main process exited, code=killed, status=9/KILL
openclaw-gateway.service: Failed with result 'timeout'.

---

OPENCLAW_HANDSHAKE_TIMEOUT_MS=30000 openclaw status

---

env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy \
  openclaw status
RAW_BUFFERClick to expand / collapse

Bug type

Regression / local gateway connectivity

Summary

On WSL2, OpenClaw 2026.4.26 starts the local gateway service and binds 127.0.0.1:18789, but local clients fail to complete the WebSocket pre-auth/connect handshake. The gateway port is listening, and the service reports active (running), but CLI/dashboard/WebSocket clients time out or close before connect.

This appears related to the current gateway WebSocket handshake path rather than a missing binary, invalid config, or WSL being down.

Environment

  • OpenClaw: 2026.4.26 (be8c246)
  • OS: WSL2 Ubuntu 24.04.4 LTS on Windows
  • Kernel: 6.6.87.2-microsoft-standard-WSL2
  • Install method: npm global (~/.npm-global/bin/openclaw)
  • Gateway mode: local loopback
  • Gateway target: ws://127.0.0.1:18789
  • Service: systemd user service openclaw-gateway.service
  • Node used by service: /usr/bin/node

Symptoms

openclaw --version works:

OpenClaw 2026.4.26 (be8c246)

The config validates:

Config valid: ~/.openclaw/openclaw.json

The gateway service is active and logs that the HTTP server is listening:

Service: systemd (enabled)
Command: /usr/bin/node /home/venka/.npm-global/lib/node_modules/openclaw/dist/index.js gateway --port 18789
Gateway: bind=loopback (127.0.0.1), port=18789
Runtime: running (... state active ...)
...
[gateway] http server listening (...; 35.0s)
[gateway] starting channels and sidecars...

But local connectivity checks fail:

Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: /home/venka/.openclaw/openclaw.json
Bind: loopback

Gateway closed (1006 abnormal closure (no close frame)): no close reason

curl to the dashboard endpoint can also hang despite the port being bound:

curl: (28) Operation timed out after 10032 milliseconds with 0 bytes received

Gateway log evidence

Representative logs after restart:

[gateway] loading configuration…
[gateway] resolving authentication…
[gateway] starting...
[gateway] starting HTTP server...
[canvas] host mounted at http://127.0.0.1:18789/__openclaw__/canvas/
[health-monitor] started
[gateway] agent model: openrouter/tencent/hy3-preview:free
[gateway] http server listening (...; 35.0s)
[gateway] log file: /tmp/openclaw/openclaw-2026-04-28.log
[gateway] starting channels and sidecars...
[hooks] loaded 4 internal hook handlers
[ws] handshake timeout conn=... peer=127.0.0.1:<ephemeral>->127.0.0.1:18789 remote=127.0.0.1
[ws] closed before connect conn=... peer=127.0.0.1:<ephemeral>->127.0.0.1:18789 remote=127.0.0.1 fwd=n/a origin=http://127.0.0.1:18789 host=127.0.0.1:18789 ua=Mozilla/... code=1000 reason=n/a

The service can also become hard to stop gracefully:

Stopping openclaw-gateway.service...
openclaw-gateway.service: State 'stop-sigterm' timed out. Killing.
openclaw-gateway.service: Main process exited, code=killed, status=9/KILL
openclaw-gateway.service: Failed with result 'timeout'.

What was ruled out

  • WSL itself is running (wsl -l -v shows Ubuntu running under WSL2).
  • The OpenClaw binary exists and runs from ~/.npm-global/bin/openclaw.
  • openclaw --version succeeds.
  • openclaw config validate succeeds.
  • The gateway service is active and binds 127.0.0.1:18789.
  • This is not simply “port not listening”; the port is bound, but HTTP/WS readiness is broken.

Possible related issues / PRs

This may overlap with one or both of these current lines of work:

  • #72846: v2026.4.25 regression where channel sidecar startup blocks after ready and local WS handshakes time out during that window.
  • #51282: open PR for configurable gateway.handshakeTimeoutMs; current 2026.4.26 source supports OPENCLAW_HANDSHAKE_TIMEOUT_MS but no config-file key.
  • #73474: open PR for Windows proxy env vars inherited by WSL breaking local gateway WebSocket connections. This environment is WSL, so inherited proxy behavior may be relevant, but the observed failure also occurs against literal 127.0.0.1.

Expected behavior

Local loopback clients should complete the gateway WebSocket connect challenge reliably once the gateway reports listening, or the gateway should not report itself as ready/listening until it can complete local WS handshakes.

Actual behavior

The gateway binds and appears active, but local HTTP/WS clients hang, hit handshake timeout, or close before connect. This makes CLI/dashboard usage unreliable or unusable while the service appears running.

Suggested investigation

  • Confirm whether the v2026.4.25 sidecar startup blocker reported in #72846 is still present in v2026.4.26.
  • Check whether channel/sidecar startup or runtime-context/chat-history work can block the WS pre-auth/connect challenge path after HTTP server bind.
  • For WSL specifically, verify whether inherited Windows proxy env vars can still affect local loopback gateway clients in 2026.4.26, even with ws://127.0.0.1:18789.
  • Consider a lightweight readiness probe that verifies the WebSocket connect challenge path, not just port bind / HTTP server creation.

Temporary workarounds to validate

Potential workarounds under investigation:

OPENCLAW_HANDSHAKE_TIMEOUT_MS=30000 openclaw status

and, for WSL/proxy suspicion:

env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy \
  openclaw status

No durable workaround has been confirmed yet for this exact 2026.4.26 WSL setup.

extent analysis

TL;DR

The most likely fix involves investigating and addressing the WebSocket handshake timeout issue, potentially by adjusting the handshake timeout or resolving the sidecar startup blocker.

Guidance

  • Investigate whether the v2026.4.25 sidecar startup blocker is still present in v2026.4.26 and verify if it affects the WebSocket connect challenge path.
  • Check if channel/sidecar startup or runtime-context/chat-history work can block the WS pre-auth/connect challenge path after HTTP server bind.
  • For WSL specifically, verify if inherited Windows proxy env vars can affect local loopback gateway clients in 2026.4.26.
  • Consider implementing a lightweight readiness probe to verify the WebSocket connect challenge path.

Example

To adjust the handshake timeout, you can try setting the OPENCLAW_HANDSHAKE_TIMEOUT_MS environment variable:

OPENCLAW_HANDSHAKE_TIMEOUT_MS=30000 openclaw status

Additionally, to investigate the effect of inherited Windows proxy env vars, you can try unsetting them:

env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy \
  openclaw status

Notes

The provided workarounds are temporary and may not be durable solutions. Further investigation is needed to determine the root cause and implement a permanent fix.

Recommendation

Apply the workaround by setting OPENCLAW_HANDSHAKE_TIMEOUT_MS to a higher value, as it may help mitigate the handshake timeout issue. However, this should be done in conjunction with further investigation to identify and address the underlying cause.

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…

FAQ

Expected behavior

Local loopback clients should complete the gateway WebSocket connect challenge reliably once the gateway reports listening, or the gateway should not report itself as ready/listening until it can complete local WS handshakes.

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 - ✅(Solved) Fix [Bug]: WSL local gateway binds but WebSocket handshake times out on 2026.4.26 [2 pull requests, 1 comments, 2 participants]