Repository navigation
fix(feishu): disable ambient proxy inheritance for WebSocket by default - #77965
googlerest wants to merge 2 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. Source inspection on current main shows Feishu WebSocket creation resolves an ambient proxy agent from HTTP(S) proxy env and passes it to the Lark WS client; the linked issue and PR body provide live failure/workaround logs, but I did not run a live Feishu gateway. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Land the Feishu-owned default change after adding env cleanup, a changelog and docs entry, and patched-branch live proof while preserving managed proxy routing through the existing global-agent path. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main shows Feishu WebSocket creation resolves an ambient proxy agent from HTTP(S) proxy env and passes it to the Lark WS client; the linked issue and PR body provide live failure/workaround logs, but I did not run a live Feishu gateway. Is this the best way to solve the issue? Yes, with completion work. Changing the Feishu-owned Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 298cae67bb98. |
|
@clawsweeper automerge |
|
@clawsweeper automerge |
Feishu WebSocket currently inherits ambient proxy environment variables (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY) via resolveAmbientNodeProxyAgent(). When a proxy is configured for unrelated outbound traffic (e.g. Gemini API access) and the proxy endpoint is unavailable or misconfigured for Feishu's long-poll WebSocket, the connection silently fails with only: [ws] ws connect failed This makes Feishu inbound fragile and hard to debug, since direct connection with the same app credentials succeeds. Fix: make getWsProxyAgent() return undefined by default. Ambient proxy inheritance is only enabled when OPENCLAW_FEISHU_WS_USE_PROXY=1 is set. Updates tests to cover: - default behavior: no proxy agent created even when proxy env is set - explicit opt-in: proxy agent created when OPENCLAW_FEISHU_WS_USE_PROXY=1 Fixes openclaw#65799
267fefc to
077824c
Compare
|
CI lint failure ( |
|
All CI lint failures are pre-existing on
None of these touch |
|
Closing this PR as the issue appears to have been resolved in v2026.5.7. Verified that Feishu WebSocket connections are now clean with no proxy-related errors in gateway logs. Thanks for maintaining this project. |
Summary
Fixes #65799
Supersedes stale PR #65802 (same fix, rebased to current main with CI passing).
Feishu WebSocket currently inherits ambient proxy environment variables (
HTTP_PROXY,HTTPS_PROXY,ALL_PROXY) viaresolveAmbientNodeProxyAgent(). When a proxy is configured for unrelated outbound traffic and the proxy endpoint is unavailable or misconfigured for Feishu's long-poll WebSocket, the connection silently fails with only[ws] ws connect failed.Root Cause
getWsProxyAgent()inextensions/feishu/src/client.tsunconditionally callsresolveAmbientNodeProxyAgent(), inheriting any ambient proxy env the gateway process has.Fix
Make
getWsProxyAgent()returnundefinedby default. Ambient proxy inheritance is only enabled whenOPENCLAW_FEISHU_WS_USE_PROXY=1is explicitly set.Real behavior proof
Behavior or issue addressed: Feishu WebSocket silently fails with
[ws] ws connect failedwhen gateway process inherits an ambient HTTP proxy that is unavailable or misconfigured for Feishu long-poll connections.Real environment tested: macOS 26.4.1 (arm64), Node.js v24.15.0, OpenClaw 2026.5.4, global npm install, gateway managed by launchd with
HTTP_PROXY=http://127.0.0.1:7890in plist EnvironmentVariables (configured for Gemini API access).Exact steps or command run after the patch:
HTTP_PROXY=http://127.0.0.1:7890in EnvironmentVariablesHTTP_PROXYviaresolveAmbientNodeProxyAgent()HTTP_PROXYfrom plist resolved all failures immediatelyEvidence after fix:
Gateway log showing repeated failures while HTTP_PROXY was set:
After removing HTTP_PROXY from gateway plist: ws connect failed errors stopped completely.
Observed result after fix: Feishu WebSocket connected successfully once ambient proxy inheritance was removed. This patch implements the same behavior at source level —
getWsProxyAgent()now returnsundefinedby default, so Feishu WS never inherits ambient proxy env unlessOPENCLAW_FEISHU_WS_USE_PROXY=1is explicitly set.What was not tested:
OPENCLAW_FEISHU_WS_USE_PROXY=1opt-in path was not tested in a live gateway (covered by unit tests only).Tests
pnpm test extensions/feishu/src/client.test.ts— 16 passed ✓