Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(pi): 移除导致 httpx 初始化失败的 IPv6 代理排除项
DavidShen221f15c4f662
diff --git a/packages/maker-core/src/agents/pi/__tests__/pi-auto-review-dispatch.test.ts b/packages/maker-core/src/agents/pi/__tests__/pi-auto-review-dispatch.test.tsindex d40d17e270..43fc557fba 100644--- a/packages/maker-core/src/agents/pi/__tests__/pi-auto-review-dispatch.test.ts+++ b/packages/maker-core/src/agents/pi/__tests__/pi-auto-review-dispatch.test.ts@@ -670,9 +670,13 @@ describe('pi auto-review dispatch & spawn config (mocked pi process)', () => {]),);const noProxy = (captured.env.NO_PROXY ?? '').split(',');- for (const entry of ['corp.internal', '127.0.0.1', 'localhost', '::1', '[::1]']) {+ for (const entry of ['corp.internal', '127.0.0.1', 'localhost', '::1']) {expect(noProxy).toContain(entry);}+ // #7632 unit regression: PiAgent.startSession's spawned env must omit [::1], or default+ // Python httpx.Client() fails. Existing coverage checked only presence; the smallest+ // failing input is NO_PROXY=corp.internal, to which Pi previously appended [::1].+ expect(noProxy).not.toContain('[::1]');expect(captured.env.no_proxy).toBeUndefined();});diff --git a/packages/maker-core/src/agents/pi/__tests__/pi-mcp-bridge.integration.test.ts b/packages/maker-core/src/agents/pi/__tests__/pi-mcp-bridge.integration.test.tsindex f95531246d..79064d84e0 100644--- a/packages/maker-core/src/agents/pi/__tests__/pi-mcp-bridge.integration.test.ts+++ b/packages/maker-core/src/agents/pi/__tests__/pi-mcp-bridge.integration.test.ts@@ -1627,13 +1627,27 @@ describe.skipIf(!piAvailable)('PiAgent × cindy-bridge (real pi + MCP bridge + p},);- it(- 'direct remote HTTP: uses env-backed bearer/custom headers instead of the localhost bridge token',+ // #7632 integration regression: PiAgent.startSession -> real Pi -> authenticated IPv6 MCP+ // must bypass HTTP_PROXY. The previous real-Pi test covered only 127.0.0.1; an empty+ // inherited NO_PROXY plus http://[::1] is the minimal case that could leak credentials+ // after removing the bracketed token from Pi's automatic NO_PROXY additions.+ it.each(['127.0.0.1', '::1'] as const)(+ 'direct remote HTTP on %s: keeps authenticated MCP traffic out of HTTP_PROXY',{ timeout: 90_000 },- async () => {+ async (loopbackHost) => {echoCalls.length = 0;seenMcpUrls.length = 0;seenRemoteHeaders.length = 0;+ const previousMcpUrl = mcpUrl;+ const ipv6Mcp = loopbackHost === '::1'+ ? createServer((req, res) => { mcpHttp.emit('request', req, res); })+ : undefined;+ if (ipv6Mcp) {+ await new Promise<void>((resolve) => ipv6Mcp.listen(0, '::1', resolve));+ const address = ipv6Mcp.address();+ if (typeof address !== 'object' || !address) throw new Error('IPv6 MCP did not listen');+ mcpUrl = `http://[::1]:${address.port}/mcp`;+ }let proxyHits = 0;const proxy = createServer((_req, res) => {proxyHits += 1;@@ -1660,11 +1674,13 @@ describe.skipIf(!piAvailable)('PiAgent × cindy-bridge (real pi + MCP bridge + p'remote',);} finally {+ mcpUrl = previousMcpUrl;for (const name of Object.keys(previous)) delete process.env[name];for (const [name, value] of Object.entries(previous)) {if (value !== undefined) process.env[name] = value;}await new Promise<void>((resolve) => proxy.close(() => resolve()));+ if (ipv6Mcp) await new Promise<void>((resolve) => ipv6Mcp.close(() => resolve()));}expect(turn).toBeDefined();diff --git a/packages/maker-core/src/agents/pi/index.ts b/packages/maker-core/src/agents/pi/index.tsindex 96e7e44577..7fbbc55f68 100644--- a/packages/maker-core/src/agents/pi/index.ts+++ b/packages/maker-core/src/agents/pi/index.ts@@ -543,7 +543,8 @@ function mergeLoopbackNoProxy(env: NodeJS.ProcessEnv): void {.flatMap((s) => s.split(',')).map((s) => s.trim()).filter(Boolean);- env.NO_PROXY = Array.from(new Set([...existing, '127.0.0.1', 'localhost', '::1', '[::1]'])).join(',');+ // NO_PROXY 使用裸 IPv6 地址;URL 形式的 [::1] 会使 Python httpx 初始化失败(#7632)。+ env.NO_PROXY = Array.from(new Set([...existing, '127.0.0.1', 'localhost', '::1'])).join(',');delete env.no_proxy;}