fix: avoid DNS lookup after proxied release CONNECT#506
fix: avoid DNS lookup after proxied release CONNECT#506jahooma merged 1 commit intoCodebuffAI:mainfrom
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Greptile SummaryThis PR fixes a DNS-lookup regression in the release launchers for The fix extracts all proxy logic into a new Issues found:
Confidence Score: 5/5Safe to merge — the core fix is correct, well-tested, and addresses a real proxy environment regression without changing any non-release-launcher code paths. The approach (custom The three Important Files Changed
Sequence DiagramsequenceDiagram
participant L as release/index.js
participant H as http.js (createReleaseHttpClient)
participant P as HTTP Proxy
participant R as registry.npmjs.org
L->>H: httpGet(url)
H->>H: buildRequestOptions(url)
H->>H: getProxyUrl() → HTTPS_PROXY
H->>P: HTTP CONNECT registry.npmjs.org:443
P-->>H: 200 Connection established (tunnelSocket)
H->>H: new TunnelAgent({ keepAlive: false })
H->>L: reqOptions (with agent, no createConnection)
L->>H: httpsModule.get(reqOptions, cb)
Note over H,R: Agent.createConnection called internally by Node
H->>H: TunnelAgent.createConnection()
H->>H: tls.connect({ socket: tunnelSocket, servername })
H->>R: TLS handshake over tunnel (no DNS lookup)
R-->>H: 200 OK / JSON response
H-->>L: resolve(res)
|
|
Thanks for the fix! |
Summary
http.jshelpers forcodebuff,codecane, andfreebuffcreateConnectioncallback to a customhttps.Agent, so requests reuse the CONNECT tunnel without falling back to local DNS lookupVerification
bun --cwd cli test src/__tests__/release/proxy-http-get.test.tsbun run --cwd cli typecheckfreebuff/cli/release/http.jsfetchedhttps://registry.npmjs.org/freebuff/latestsuccessfully through the configured proxy (status 200)Root cause
The release launchers established the proxy CONNECT tunnel correctly, but then passed a raw
createConnectioncallback intohttps.get. In proxy environments like WSL, Node still attempted a fresh hostname lookup forregistry.npmjs.org, causing first-run startup to fail withEAI_AGAINeven though the proxy tunnel was already open.