fix: strip proxy env vars from OpenClaw gateway process#13380
Open
fix: strip proxy env vars from OpenClaw gateway process#13380
Conversation
Cherry Studio's ProxyManager sets HTTP_PROXY/HTTPS_PROXY on process.env, which gets inherited by the gateway child process. OpenClaw's undici crashes with InvalidArgumentError when the proxy URL uses a non-http(s) protocol (e.g. socks5://), causing gateway to exit with code 1. Strip all proxy-related env vars before spawning the gateway process. Closes #13140 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Preserve valid http:// proxy URLs so OpenClaw gateway can still reach upstream APIs through proxy in restricted networks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
cherry-studio/src/main/services/agents/services/claudecode/index.ts Lines 128 to 130 in 203c94c may be reuse it |
Reuse the same proxy env stripping logic in both OpenClawService and ClaudeCodeService instead of duplicating it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
DeJeune
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HTTP_PROXY,HTTPS_PROXY,SOCKS_PROXY, etc.) before spawning the OpenClaw gateway processProxyManagersetsprocess.env.HTTP_PROXYwhich gets inherited by the gateway child process viagetShellEnv(). OpenClaw'sundicicrashes withInvalidArgumentError: Invalid URL protocolwhen the proxy URL uses a non-http(s) protocol (e.g.socks5://), causing gateway to exit with code 1Root cause
Test plan
socks5://127.0.0.1:1080in Cherry Studio settings → start OpenClaw gateway → should start successfullyhttp://127.0.0.1:7897→ gateway should still workCloses #13140
🤖 Generated with Claude Code