fix(proxy): honor Windows system proxy and PAC settings - #571
Open
nadavsinai-philips wants to merge 1 commit into
Open
nadavsinai-philips wants to merge 1 commit into
nadavsinai-philips wants to merge 1 commit into
Conversation
8nevil8
reviewed
Sep 21, 2026
vadimvlasenko
requested changes
Sep 22, 2026
vadimvlasenko
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for this — the Windows/PAC proxy support is a real gap and this is a solid step toward fixing it. I ran a full review and found a couple of things that need attention before merge, mostly around two files that look like they may have been included by accident, plus some gaps in the new proxy code. Left inline notes on each one below so they're easy to find. Happy to help however's useful — thank you for the contribution!
nadavsinai-philips
force-pushed
the
users/nadav/fix-proxy
branch
from
September 22, 2026 17:02
32ab499 to
b749ddd
Compare
nadavsinai-philips
force-pushed
the
users/nadav/fix-proxy
branch
2 times, most recently
from
September 22, 2026 17:08
b749ddd to
d6095c6
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.
Summary
On Windows behind a corporate PAC-based proxy (Zscaler and similar),
codemie setupfails at "Fetching available projects" withRequest timeout, even though a browser reaches the same instance fine.Root cause: the core
HTTPClientbuilds rawhttps.requestoptions with no agent, and Node'shttp/httpsmodules never consult proxy configuration on their own. Every CodeMie API call went direct and hung. SettingHTTPS_PROXYdid not help either, because nothing on that code path read it — onlyProxyHTTPClient(the runtime LLM proxy) had proxy support.This makes the CLI resolve a proxy itself, so no manual env var is needed:
HTTPClient(bothrequest()and the redirect-followinggetRaw()path), in precedence order:HTTPS_PROXY/HTTP_PROXY/NO_PROXY— explicit overrides still win, so existing setups are unchangedProxyServer, orAutoConfigURL(PAC)pac-resolverinside the QuickJS WASM sandbox rather thannode:vm. PAC scripts are fetched over plain HTTP from whateverAutoConfigURLpoints at, so a hostile or MITM'd PAC must not be able to reach the host process.127.0.0.1reachable.ProxyHTTPClientand spawned agent CLIs: the proxy daemon seedsHTTP(S)_PROXY/NO_PROXYfrom the proxy resolved for its real--target-url, so both inherit working settings without each needing its own detection.CODEMIE_NO_SYSTEM_PROXY=1.Also removes ~160 lines of
NO_PROXYparsing thatProxyHTTPClientcarried privately, moving it into the shared module. The shared version additionally understands the Windows token forms<local>,<-loopback>and*.example.com.New dependencies
pac-resolver(+quickjs-wasi), adding 8 packages total:pac-resolver,degenerator,ast-types,escodegen,esprima,netmask,quickjs-wasi,source-map. All MIT/BSD;license-checkpasses. Both are lazily imported, so users without a PAC never load them.Cost
Resolution is cached per process. On a PAC machine the first request pays ~1.8s (registry read + PAC fetch + WASM init); subsequent resolutions are ~0ms, and a different host is ~19ms. Windows without a PAC pays one
reg query. Non-Windows is a no-op.Test plan
npm run typecheck— cleannpm run lint— clean (--max-warnings=0)npm run build— cleannpm run license-check— cleanvitest --project unit— 279 files, 4054 passedvitest --project cli— 37 files, 279 passedproxy-http-client.test.tsNO_PROXY routing tests still pass unchanged after the refactorDIRECT, andHTTPClient.getRaw()against the previously-timing-out/v1/llm_modelsendpoint returned200in 2.5ssrc/utils/__tests__/system-proxy.test.ts, registry stubbed so they run on any platform): barehost:port; per-protocolhttp=..;https=..selection and http fallback;ProxyEnable=0meaning direct;*.domainand<local>ProxyOverride bypasses; loopback never proxied;HTTPS_PROXYoverriding the registry;CODEMIE_NO_SYSTEM_PROXY=1skipping detection without spawningregcodemie setupagainst an on-prem instance behind a PAC proxy — reaches the project list