Skip to content

[Desktop][Windows] webfetch tool does not respect system proxy settings — feature request: add proxy config in settings UI #27892

Open

Description

@Thundercup

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:

  1. If the user sets HTTPS_PROXY before launching the app from terminal → works
  2. If the user clicks the desktop app icon (no env vars) → broken
  3. 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:

  1. Set HTTPS_PROXY as a system environment variable and restart the desktop app
  2. Use a TUN/VPN mode proxy that routes traffic at the network level
  3. Launch the desktop app from a terminal where $env:HTTPS_PROXY is set

Activity

  1. github-actions commented on May 16, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is specifically about the Windows desktop app not reading system proxy settings (as opposed to missing config-file support), it may still be distinct — please clarify if that's the case.

  2. Thundercup commented on May 16, 2026

    @Thundercup
    Author

    Thanks for the triage. This issue is distinct from #24981, #18193, and #531 because:

    The core problem is that the desktop app does not read the Windows system proxy settings. Those other issues request adding a config-file-based proxy option — which would also work, but is a workaround, not a fix for the root cause.

    A native Windows desktop app should respect the proxy settings configured in Windows (Settings → Network & Internet → Proxy), which is the standard mechanism on this platform. Currently the app only respects \HTTPS_PROXY\ env vars, which most desktop users don't set because they expect the system-level proxy to work.

    The suggested proxy config UI is a secondary feature request — useful, but the primary bug is: system proxy is ignored.

    This is similar to #26629 but broader in scope (not limited to GitHub Copilot OAuth — it affects the agent's \webfetch\ tool and all outbound HTTP calls).

  3. 0x80x commented on Jul 15, 2026

    @0x80x

    I'd like to work on implementing this. A few things I'd add to the scope:

    1. SOCKS5 support — not just HTTP/HTTPS proxy. Many users (including myself behind restricted networks) use SOCKS5 proxies. There's a closed issue [FEATURE]:add socks5 proxy #12650 requesting this.

    2. All outbound paths — not just webfetch. The proxy config should apply to:

      • LLM API calls (AI SDK providers + native runtime)
      • WebSocket connections (OpenAI Responses API)
      • webfetch tool
      • Config fetching
      • MCP server child processes (pass env vars)
    3. Implementation approach — create a proxy-aware fetch wrapper and inject it into the FetchHttpClient service + provider options. The existing proxy-env.ts already reads HTTP_PROXY/HTTPS_PROXY for WebSockets, so the foundation is there.

    I'd keep it minimal: proxy.url + proxy.noProxy in opencode.json, fallback to env vars. SOCKS5 via socks-proxy-agent (optional dep). No UI changes — just config.

    Want me to submit a PR?

  4. coinsoundsbetter commented on Aug 28, 2026

    @coinsoundsbetter

    Hi! I can reproduce this on Windows Desktop when using a local HTTP proxy in system-proxy mode. The Electron UI may have access to the network, but the local Node sidecar that performs model, webfetch, and OpenAI Responses WebSocket requests does not automatically use that proxy.

    I built and verified a local proof of concept with:

    • a Desktop Settings UI for Direct and manual HTTP/HTTPS proxy modes;
    • persisted proxy settings;
    • applying the selected proxy to the local sidecar's HTTP/fetch requests;
    • updating the sidecar at runtime when the setting changes;
    • using HttpsProxyAgent for OpenAI Responses WebSocket connections as well.

    The manual configuration uses a URL such as http://127.0.0.1:7890. It is intended as a reliable first step for users whose system-proxy/PAC configuration is not automatically available to the Node sidecar.

    Before I prepare a PR, would this scope align with the desired direction? In particular, I would appreciate guidance on:

    1. Should the initial UI support Use environment proxy, Direct, and Manual proxy modes?
    2. Should configurable NO_PROXY rules and proxy authentication be included in the first PR, or follow separately?
    3. Is there a preferred Desktop settings storage/API pattern for this feature?

    I am happy to prepare a focused PR with tests and link it to this issue.

  5. TCXM commented on Oct 7, 2026

    @TCXM

    Is this still planned for V2? I'd like to work on honoring system proxy settings for the local Desktop sidecar, without adding settings UI. Is anyone actively working on this, and which branch should a PR target?

  6. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    Thanks for the detailed write-up, @Thundercup!

    To restate the request: OpenCode Desktop on Windows should use the Windows system proxy (Settings → Network & Internet → Proxy, as set by v2rayN or Clash in system-proxy mode) for everything the agent sends out, including webfetch and model requests. As a second step, there could be a proxy setting in the Settings UI / opencode.json.

    I checked how the current version (v2) works. Desktop picks up a proxy only from the HTTP_PROXY / HTTPS_PROXY / NO_PROXY environment variables and does not read the Windows system proxy settings. So the workarounds you listed (setting HTTPS_PROXY as a system environment variable, or using TUN mode) are still the way to go for now. Maintainers will consider adding support for this.

    Related issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions