From 02e2f970541f79ebc4f12e137fd9fbd41dc31020 Mon Sep 17 00:00:00 2001 From: Lex Christopherson Date: Fri, 13 Mar 2026 09:33:41 -0600 Subject: [PATCH] fix: respect HTTP_PROXY/HTTPS_PROXY env vars for all outbound requests (#131) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GSD bypasses pi-coding-agent's CLI entry point (which sets undici's EnvHttpProxyAgent as the global dispatcher), so proxy env vars were ignored — causing 403 errors for users behind HTTPS proxies. Co-Authored-By: Claude Opus 4.6 --- src/loader.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/loader.ts b/src/loader.ts index 83e660093..09459bdba 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -94,5 +94,11 @@ process.env.GSD_BUNDLED_EXTENSION_PATHS = [ join(agentDir, 'extensions', 'get-secrets-from-user.ts'), ].join(':') +// Respect HTTP_PROXY / HTTPS_PROXY / NO_PROXY env vars for all outbound requests. +// pi-coding-agent's cli.ts sets this, but GSD bypasses that entry point — so we +// must set it here before any SDK clients are created. +import { EnvHttpProxyAgent, setGlobalDispatcher } from 'undici' +setGlobalDispatcher(new EnvHttpProxyAgent()) + // Dynamic import defers ESM evaluation — config.js will see PI_PACKAGE_DIR above await import('./cli.js')