anomalyco / anomalyco/opencode

Windows Desktop app does not inherit WSL proxy environment variables when auto-spawning sidecar serve

Open
#45,868 1 comment 0 reactions 1 assignee View on GitHub

@Hona is already working on this.

Since Aug 28, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

在 Windows 上使用 OpenCode Desktop 应用,并让其自动拉起 WSL 中的 sidecar 服务器时,网络代理(HTTP_PROXY/HTTPS_PROXY)不会生效。即使我在 WSL 的 ~/.bashrc 中正确配置了代理,Desktop 自动启动的 sidecar 进程也无法读取到这些变量。

Suggestion

Desktop 通过 spawn("wsl", ...) 启动 WSL 会话,这不是一个登录 shell,因此不会 source ~/.bashrc。

createWslServersController 的启动脚本执行了 export WSLENV= 并只显式传递了少量固定变量(如 PATH, OPENCODE_*),并未传递 HTTP_PROXY 等变量。

该进程继承的是 Electron 主进程自身的环境变量,因此在 Windows 层面设置 HTTP_PROXY 并通过 WSLENV 透传可以解决此问题。

Plugins

No response

OpenCode version

least

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Window 11

Terminal

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.