openclaw - ✅(Solved) Fix Feishu WebSocket should not inherit ambient proxy env by default [1 pull requests, 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#65799Fetched 2026-04-14 05:40:13
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
cross-referenced ×1

Feishu WebSocket currently inherits ambient proxy environment variables through resolveAmbientNodeProxyAgent(). In environments where HTTP_PROXY / HTTPS_PROXY / ALL_PROXY are set for general outbound traffic, this can break Feishu long connections even when Feishu itself should connect directly.

In my case, OpenClaw had:

  • HTTP_PROXY=http://127.0.0.1:7897
  • HTTPS_PROXY=http://127.0.0.1:7897
  • ALL_PROXY=socks5://127.0.0.1:7898

The SOCKS endpoint on 127.0.0.1:7898 was unavailable, so Feishu WebSocket failed at connect time and only surfaced the generic log:

[ws] ws connect failed

This caused real Feishu inbound messages to stop arriving, while account probe / status could still appear healthy.

Root Cause

Feishu WebSocket is a persistent inbound channel, not generic outbound fetch traffic. Automatically inheriting ambient proxy env is risky because:

Fix Action

Fix / Workaround

Patch shape

PR fix notes

PR #65802: fix(feishu): disable ambient proxy inheritance for websocket by default

Description (problem / solution / changelog)

Summary

  • stop Feishu WebSocket from inheriting ambient proxy env by default
  • add an explicit OPENCLAW_FEISHU_WS_USE_PROXY=1 opt-in for proxy usage
  • update Feishu WS proxy tests to cover the new default and opt-in behavior

Why

Feishu inbound can silently break when the gateway process inherits unrelated proxy env, especially ALL_PROXY pointing at an unavailable local SOCKS endpoint. In that case Feishu WS only logs a generic ws connect failed, while direct connection with the same app credentials succeeds.

This makes Feishu inbound fragile and hard to debug. A safer default is to bypass ambient proxy env for Feishu WS unless explicitly requested.

Testing

  • attempted local test run for extensions/feishu/src/client.test.ts
  • current temporary clone needed dependency installation first
  • live gateway verification on a real install confirmed:
    • Feishu WS failed when ambient proxy inheritance was enabled
    • Feishu WS recovered immediately after bypassing proxy inheritance
    • real Feishu -> OpenClaw -> worker reply path resumed successfully

Closes #65799

Changed files

  • extensions/feishu/src/client.test.ts (modified, +18/-3)
  • extensions/feishu/src/client.ts (modified, +5/-1)

Code Example

[ws] ws connect failed
RAW_BUFFERClick to expand / collapse

Bug: Feishu WebSocket incorrectly inherits ambient HTTP(S)/SOCKS proxy env and can fail with ws connect failed

Summary

Feishu WebSocket currently inherits ambient proxy environment variables through resolveAmbientNodeProxyAgent(). In environments where HTTP_PROXY / HTTPS_PROXY / ALL_PROXY are set for general outbound traffic, this can break Feishu long connections even when Feishu itself should connect directly.

In my case, OpenClaw had:

  • HTTP_PROXY=http://127.0.0.1:7897
  • HTTPS_PROXY=http://127.0.0.1:7897
  • ALL_PROXY=socks5://127.0.0.1:7898

The SOCKS endpoint on 127.0.0.1:7898 was unavailable, so Feishu WebSocket failed at connect time and only surfaced the generic log:

[ws] ws connect failed

This caused real Feishu inbound messages to stop arriving, while account probe / status could still appear healthy.

Why this is a problem

Feishu WebSocket is a persistent inbound channel, not generic outbound fetch traffic. Automatically inheriting ambient proxy env is risky because:

  1. a machine may set proxy env for unrelated tools
  2. ALL_PROXY may point to a local transient SOCKS process
  3. Feishu WS failures become opaque and look like Feishu credential / app config issues

In practice this makes Feishu inbound fragile and hard to debug.

Reproduction

  1. Configure Feishu with connectionMode: websocket
  2. Export a broken ambient proxy, for example:
    • ALL_PROXY=socks5://127.0.0.1:7898
  3. Start gateway
  4. Observe Feishu startup logging ws connect failed
  5. Real Feishu inbound stops working
  6. Unset proxy env or bypass proxy for Feishu WS, and the same app credentials connect successfully

Proposed fix

Make Feishu WebSocket not use ambient proxy env by default.

If someone really needs proxying for Feishu WS, gate it behind an explicit opt-in env var, for example:

  • OPENCLAW_FEISHU_WS_USE_PROXY=1

This keeps the safe default for most users while preserving an escape hatch for advanced deployments.

Patch shape

Source file:

  • extensions/feishu/src/client.ts

Behavior change:

  • current: always calls resolveAmbientNodeProxyAgent() for WS
  • proposed: only call it when OPENCLAW_FEISHU_WS_USE_PROXY=1

Tests updated in:

  • extensions/feishu/src/client.test.ts

Notes from live verification

I reproduced this on a real OpenClaw install where:

  • direct Feishu WS connection succeeded
  • the same WS failed once proxy agent inheritance was enabled
  • failure resolved immediately after bypassing proxy inheritance for Feishu WS

So this is not just theoretical, it affects real inbound delivery.

extent analysis

TL;DR

To fix the Feishu WebSocket connection issue, set the OPENCLAW_FEISHU_WS_USE_PROXY environment variable to 0 or unset the ambient proxy environment variables (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY) to prevent Feishu from inheriting them.

Guidance

  • Identify and unset or modify the ambient proxy environment variables (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY) that are causing the issue.
  • Consider setting the OPENCLAW_FEISHU_WS_USE_PROXY environment variable to 0 to explicitly disable proxy inheritance for Feishu WebSocket.
  • Verify that Feishu WebSocket connections are successful after making these changes by checking the logs for ws connect failed errors and ensuring that real Feishu inbound messages are being received.
  • If proxying is required for Feishu WebSocket, set OPENCLAW_FEISHU_WS_USE_PROXY=1 and configure the proxy settings accordingly.

Example

No code snippet is provided as the issue is related to environment variable configuration.

Notes

The proposed fix involves modifying the client.ts file in the extensions/feishu/src directory to only call resolveAmbientNodeProxyAgent() when OPENCLAW_FEISHU_WS_USE_PROXY=1. This change should be tested and verified to ensure that it resolves the issue.

Recommendation

Apply the workaround by setting OPENCLAW_FEISHU_WS_USE_PROXY=0 or unsetting the ambient proxy environment variables, as this is a safer default and prevents Feishu WebSocket from inheriting unwanted proxy settings.

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