fix: respect HTTP_PROXY/HTTPS_PROXY env vars for all outbound requests (#131)

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 <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson 2026-03-13 09:33:41 -06:00
parent 98c2d23ce6
commit 02e2f97054

View file

@ -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')