Repository navigation
Conversation
EhabY
marked this pull request as ready for review
October 22, 2026 09:57
To pass the proxy to `coder ssh`, `applySshEnvironment` writes `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` into the extension host's `process.env`. When `http.proxy` is unset, the HTTP agent falls back to proxy environment variables, so after you removed `http.proxy` it read those values back and kept using the old proxy until reload. Pin each variable's inherited value before writing it, and have the env fallback read the pinned value until the SSH environment is disposed. Fixes #1162
Parse URLs with the WHATWG `URL` API instead of the deprecated `url.parse`, and stop reading the `npm_config_*` proxy variables, as upstream did in 2.0. The header now says the file is based on upstream rather than copied. Rename `pinEnv` to `pinProxyEnv` and document that the first pin wins. Share `clearProxyEnv` between the proxy, HTTP agent and SSH environment tests so they no longer depend on proxy variables set on the host. Add an integration test that removes `http.proxy` mid-session in a real VS Code.
EhabY
force-pushed
the
fix/issue-1162-ssh-proxy-env
branch
from
October 22, 2026 12:16
f5d20c3 to
a4eb358
Compare
This branch has not been deployed
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.
Problem
To pass the proxy to
coder ssh,applySshEnvironmentwritesHTTP_PROXY,HTTPS_PROXYandNO_PROXYinto the extension host'sprocess.env(#1012). Whenhttp.proxyis unset, the HTTP agent falls back to proxy environment variables. So after you removehttp.proxyduring a session, API requests and WebSockets read those values back and keep using the old proxy until you reload.Fix
pinProxyEnv(key)insrc/api/proxy.tsrecords a variable's inherited value, and the env fallback reads that value instead of the live one. If the key is already pinned, the first pin wins.applySshEnvironmentpins each variable before writing it toprocess.envand unpins it on dispose. The SSH process still gets the proxy, and the API only sees the inherited environment.Sync
proxy.tswith proxy-from-env 2.1.0src/api/proxy.tsstarted as a copy of proxy-from-env 1.x and has since diverged, so its header now says it is based on upstream. To bring it closer to upstream 2.1.0:URLAPI instead of the deprecatedurl.parse. This also removes theDEP0169warning.npm_config_proxy,npm_config_http_proxy,npm_config_https_proxyandnpm_config_no_proxy, as upstream did in 2.0. Users can sethttp.proxy,http.noProxyor the standard variables instead. This is noted under "Changed" in the changelog.Testing
clearProxyEnvhelper, so they no longer depend on proxy variables set on the host.test/integration/proxy.test.ts) runs the API requests use the SSH proxy environment after http.proxy is removed #1162 scenario in real VS Code: sethttp.proxy, apply the SSH environment, removehttp.proxy, and check that the API agent no longer uses the proxy. It passes on VS Code 1.105.0 (Electron 37, Node 22.19) and stable 1.143.0 (Electron 43, Node 24.21), and fails on both when pinning is turned off.Fixes #1162
🤖 Generated with Claude Code