From 78bb4dc1406c9fbb83bb9f030316e2b16fff33b7 Mon Sep 17 00:00:00 2001 From: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com> Date: Wed, 3 Dec 2025 08:12:34 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20fix:=20respect=20HTTP=5FPROXY=20?= =?UTF-8?q?env=20vars=20for=20network=20requests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch from undici Agent to EnvHttpProxyAgent to automatically respect HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables. This enables debugging/inspection via proxy tools like mitmproxy and supports corporate network environments that require proxying. The EnvHttpProxyAgent inherits all the same timeout configuration (bodyTimeout: 0, headersTimeout: 0) to prevent BodyTimeoutError on long-running reasoning model pauses. _Generated with mux_ --- src/node/services/aiService.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/node/services/aiService.ts b/src/node/services/aiService.ts index 8d5439719..01d56dcf9 100644 --- a/src/node/services/aiService.ts +++ b/src/node/services/aiService.ts @@ -44,13 +44,15 @@ import type { } from "@/common/types/stream"; import { applyToolPolicy, type ToolPolicy } from "@/common/utils/tools/toolPolicy"; import { MockScenarioPlayer } from "./mock/mockScenarioPlayer"; -import { Agent } from "undici"; +import { EnvHttpProxyAgent } from "undici"; // Export a standalone version of getToolsForModel for use in backend // Create undici agent with unlimited timeouts for AI streaming requests. // Safe because users control cancellation via AbortSignal from the UI. -const unlimitedTimeoutAgent = new Agent({ +// Uses EnvHttpProxyAgent to automatically respect HTTP_PROXY, HTTPS_PROXY, +// and NO_PROXY environment variables for debugging/corporate network support. +const unlimitedTimeoutAgent = new EnvHttpProxyAgent({ bodyTimeout: 0, // No timeout - prevents BodyTimeoutError on long reasoning pauses headersTimeout: 0, // No timeout for headers });