From 8cde26d7be0b13efb95c415885b8781bfaa1f6f4 Mon Sep 17 00:00:00 2001 From: Alex Alecu Date: Wed, 6 May 2026 16:41:57 +0300 Subject: [PATCH] fix(vscode): clear lowercase proxy --- .../src/services/cli-backend/server-manager.ts | 16 +++++++++++----- .../tests/unit/server-manager-proxy-env.test.ts | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/packages/kilo-vscode/src/services/cli-backend/server-manager.ts b/packages/kilo-vscode/src/services/cli-backend/server-manager.ts index 017ca4942f..1151adeb8c 100644 --- a/packages/kilo-vscode/src/services/cli-backend/server-manager.ts +++ b/packages/kilo-vscode/src/services/cli-backend/server-manager.ts @@ -235,13 +235,13 @@ function stripAnsi(str: string): string { /** * Translate VS Code's `http.proxy` / `http.noProxy` / `http.proxySupport` - * settings into the standard HTTP_PROXY / HTTPS_PROXY / NO_PROXY env vars, so - * the spawned CLI honors the user's proxy configuration. Returns an empty - * object when no override is needed, so callers can spread unconditionally. + * settings into the standard proxy env vars, so the spawned CLI honors the + * user's proxy configuration. Returns an empty object when no override is + * needed, so callers can spread unconditionally. * * `http.proxySupport: "off"` is VS Code's opt-in way to disable proxy support * entirely; when set, we explicitly clear the env vars so ambient shell - * HTTP_PROXY doesn't leak into the spawned child. + * HTTP_PROXY/http_proxy doesn't leak into the spawned child. */ export function buildProxyEnv(): Record { const httpConfig = vscode.workspace.getConfiguration("http") @@ -250,7 +250,7 @@ export function buildProxyEnv(): Record { const proxySupport = httpConfig.get("proxySupport") if (proxySupport === "off") { - return { HTTP_PROXY: "", HTTPS_PROXY: "", NO_PROXY: "" } + return { HTTP_PROXY: "", HTTPS_PROXY: "", NO_PROXY: "", http_proxy: "", https_proxy: "", no_proxy: "" } } const proxy = httpConfig.get("proxy") @@ -279,16 +279,22 @@ export function buildProxyEnv(): Record { if (proxy && proxy.trim() !== "") { env.HTTP_PROXY = proxy env.HTTPS_PROXY = proxy + env.http_proxy = proxy + env.https_proxy = proxy } if (proxySet && proxy !== undefined && proxy.trim() === "") { env.HTTP_PROXY = "" env.HTTPS_PROXY = "" + env.http_proxy = "" + env.https_proxy = "" } if (Array.isArray(noProxy) && noProxy.length > 0) { env.NO_PROXY = noProxy.join(",") + env.no_proxy = noProxy.join(",") } if (noProxySet && Array.isArray(noProxy) && noProxy.length === 0) { env.NO_PROXY = "" + env.no_proxy = "" } return env } diff --git a/packages/kilo-vscode/tests/unit/server-manager-proxy-env.test.ts b/packages/kilo-vscode/tests/unit/server-manager-proxy-env.test.ts index 5ed8ea3b5a..6aac3ae2bc 100644 --- a/packages/kilo-vscode/tests/unit/server-manager-proxy-env.test.ts +++ b/packages/kilo-vscode/tests/unit/server-manager-proxy-env.test.ts @@ -50,6 +50,8 @@ describe("buildProxyEnv", () => { expect(buildProxyEnv()).toEqual({ HTTP_PROXY: "http://proxy.corp.example:8080", HTTPS_PROXY: "http://proxy.corp.example:8080", + http_proxy: "http://proxy.corp.example:8080", + https_proxy: "http://proxy.corp.example:8080", }) }) @@ -58,6 +60,7 @@ describe("buildProxyEnv", () => { expect(buildProxyEnv()).toEqual({ NO_PROXY: "localhost,127.0.0.1,*.internal", + no_proxy: "localhost,127.0.0.1,*.internal", }) }) @@ -71,6 +74,9 @@ describe("buildProxyEnv", () => { HTTP_PROXY: "http://proxy.corp.example:8080", HTTPS_PROXY: "http://proxy.corp.example:8080", NO_PROXY: "localhost,*.internal", + http_proxy: "http://proxy.corp.example:8080", + https_proxy: "http://proxy.corp.example:8080", + no_proxy: "localhost,*.internal", }) }) @@ -80,6 +86,8 @@ describe("buildProxyEnv", () => { expect(buildProxyEnv()).toEqual({ HTTP_PROXY: "", HTTPS_PROXY: "", + http_proxy: "", + https_proxy: "", }) }) @@ -88,6 +96,7 @@ describe("buildProxyEnv", () => { expect(buildProxyEnv()).toEqual({ NO_PROXY: "", + no_proxy: "", }) }) @@ -104,6 +113,9 @@ describe("buildProxyEnv", () => { HTTP_PROXY: "", HTTPS_PROXY: "", NO_PROXY: "", + http_proxy: "", + https_proxy: "", + no_proxy: "", }) }) @@ -118,6 +130,9 @@ describe("buildProxyEnv", () => { HTTP_PROXY: "", HTTPS_PROXY: "", NO_PROXY: "", + http_proxy: "", + https_proxy: "", + no_proxy: "", }) }) })