kimi-code icon indicating copy to clipboard operation
kimi-code copied to clipboard

fix(proxy): omit bracketed [::1] from child process NO_PROXY

Open panandicoding opened this issue 4 months ago • 1 comments

Related Issue

Closes #1931

Description

The bracketed IPv6 loopback [::1] in NO_PROXY is only needed in-process for undici's EnvHttpProxyAgent (which mis-parses a bare ::1 as host : port 1). However, proxyEnvForChild() and reconcileChildNoProxy() were propagating the same value verbatim into child processes (stdio MCP servers).

Python's httpx parses all://[::1] and treats :1] as the port, raising httpx.InvalidURL — crashing any Python-based MCP server when a proxy is configured.

Fix

  • Introduce LOOPBACK_NO_PROXY_CHILD (without [::1]) alongside the existing LOOPBACK_NO_PROXY.
  • Add resolveNoProxyForChild() which uses the child-safe loopback list.
  • proxyEnvForChild() and reconcileChildNoProxy() now call resolveNoProxyForChild() instead of resolveNoProxy().
  • The in-process resolveNoProxy() (used by createProxyDispatcher for undici) is unchanged — it still includes [::1].

Applied to both packages/agent-core and packages/agent-core-v2 (identical proxy utilities).

Checklist

  • [x] I have read the CONTRIBUTING document.
  • [x] I have linked the related issue, if any.
  • [x] I have added tests that prove my fix is effective or that my feature works.
  • [x] I have run pnpm changeset to add a changeset.
  • [x] I have updated user-facing docs in docs/.

panandicoding avatar Jul 25 '26 15:07 panandicoding

🦋 Changeset detected

Latest commit: cc7deaa2a7e3153e9a897593187c8ed96c9267b9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jul 25 '26 15:07 changeset-bot[bot]