Description
OpenCode Desktop on Windows does not respect the system proxy settings for the agent's built-in webfetch tool (and likely other HTTP calls made by the agent runtime). This is similar to #26629 but focused on the agent's web fetching capability rather than GitHub Copilot OAuth.
What happened
When using OpenCode Desktop with a Windows system proxy (set via Windows Settings → Network & Internet → Proxy, or through tools like v2rayN in system proxy mode), the agent's webfetch tool cannot access websites behind the GFW (e.g., google.com, reddit.com). It works for sites accessible from China (e.g., bing.com, baidu.com), confirming the requests go direct without passing through the system proxy.
Expected behavior
The agent's webfetch tool (and all outbound HTTP calls from the agent runtime) should respect the Windows system proxy configuration, just like a regular browser or any proxy-aware application would.
Actual behavior
webfetch to google.com → Transport error
webfetch to bing.com → works
- TUN mode proxy (network-level) → works, proving the issue is at the application proxy awareness level
- Explicit
HTTPS_PROXY env var (set before launching) → works, per docs
Environment
- OS: Windows
- App: OpenCode Desktop (GUI app)
- Proxy: v2rayN in system proxy mode, Clash in system proxy mode
- Network: behind GFW (China mainland)
Root cause analysis
The desktop app relies on Node.js's fetch implementation which only respects the HTTP_PROXY/HTTPS_PROXY environment variables. On Windows, there is no native mechanism for Electron/Node.js apps to automatically pick up the system proxy settings (the settings configured via Windows Settings → Network & Internet → Proxy). This means:
- If the user sets
HTTPS_PROXY before launching the app from terminal → works
- If the user clicks the desktop app icon (no env vars) → broken
- If the user uses TUN mode at network level → works (bypasses the issue entirely)
Suggested fix
Add a proxy configuration section in the desktop app settings UI that allows users to:
- Configure an HTTP/HTTPS proxy address and port
- Set proxy bypass rules (NO_PROXY equivalent)
- Optionally set proxy authentication credentials
This would be exposed in the opencode.json config as a proxy field, e.g.:
{
"proxy": {
"http": "http://127.0.0.1:7890",
"https": "http://127.0.0.1:7890",
"noProxy": "localhost,127.0.0.1,::1"
}
}
Workaround
Users currently must either:
- Set
HTTPS_PROXY as a system environment variable and restart the desktop app
- Use a TUN/VPN mode proxy that routes traffic at the network level
- Launch the desktop app from a terminal where
$env:HTTPS_PROXY is set
Description
OpenCode Desktop on Windows does not respect the system proxy settings for the agent's built-in
webfetchtool (and likely other HTTP calls made by the agent runtime). This is similar to #26629 but focused on the agent's web fetching capability rather than GitHub Copilot OAuth.What happened
When using OpenCode Desktop with a Windows system proxy (set via Windows Settings → Network & Internet → Proxy, or through tools like v2rayN in system proxy mode), the agent's
webfetchtool cannot access websites behind the GFW (e.g., google.com, reddit.com). It works for sites accessible from China (e.g., bing.com, baidu.com), confirming the requests go direct without passing through the system proxy.Expected behavior
The agent's webfetch tool (and all outbound HTTP calls from the agent runtime) should respect the Windows system proxy configuration, just like a regular browser or any proxy-aware application would.
Actual behavior
webfetchto google.com →Transport errorwebfetchto bing.com → worksHTTPS_PROXYenv var (set before launching) → works, per docsEnvironment
Root cause analysis
The desktop app relies on Node.js's
fetchimplementation which only respects theHTTP_PROXY/HTTPS_PROXYenvironment variables. On Windows, there is no native mechanism for Electron/Node.js apps to automatically pick up the system proxy settings (the settings configured via Windows Settings → Network & Internet → Proxy). This means:HTTPS_PROXYbefore launching the app from terminal → worksSuggested fix
Add a proxy configuration section in the desktop app settings UI that allows users to:
This would be exposed in the
opencode.jsonconfig as aproxyfield, e.g.:{ "proxy": { "http": "http://127.0.0.1:7890", "https": "http://127.0.0.1:7890", "noProxy": "localhost,127.0.0.1,::1" } }Workaround
Users currently must either:
HTTPS_PROXYas a system environment variable and restart the desktop app$env:HTTPS_PROXYis set