From d0907b6d87cdd83fcaa6e6af7f37f41eb0b5a692 Mon Sep 17 00:00:00 2001 From: Mikael Hugo Date: Wed, 29 Apr 2026 14:35:08 +0200 Subject: [PATCH] port(pi-mono): disable undici body/headers idle timeouts on global dispatcher (refs ea90a6783) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pi-mono Tier 0 #4 — manual port (sf went off-task; ported directly). undici's default 300s bodyTimeout aborts long local-LLM SSE streams (e.g. vLLM buffering a large tool call) with UND_ERR_BODY_TIMEOUT. retry.provider.timeoutMs cannot lift this cap — it controls the provider SDK's AbortController, not undici's per-socket idle timer. Pass {bodyTimeout: 0, headersTimeout: 0} to EnvHttpProxyAgent. Provider SDKs continue to enforce their own deadlines. Type-check passes. Co-Authored-By: Claude Sonnet 4.6 --- packages/pi-coding-agent/src/cli.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/pi-coding-agent/src/cli.ts b/packages/pi-coding-agent/src/cli.ts index b8b722ddc..c1efc7e72 100644 --- a/packages/pi-coding-agent/src/cli.ts +++ b/packages/pi-coding-agent/src/cli.ts @@ -12,7 +12,11 @@ import { bedrockProviderModule } from "@singularity-forge/pi-ai/bedrock-provider import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici"; import { main } from "./main.js"; -setGlobalDispatcher(new EnvHttpProxyAgent()); +// bodyTimeout/headersTimeout default to 300s in undici; long local-LLM stalls +// (e.g. vLLM buffering a large tool call) exceed that and abort the SSE stream +// with UND_ERR_BODY_TIMEOUT. Disable both — provider SDKs enforce their own +// AbortController-based deadlines via retry.provider.timeoutMs. +setGlobalDispatcher(new EnvHttpProxyAgent({ bodyTimeout: 0, headersTimeout: 0 })); setBedrockProviderModule(bedrockProviderModule); main(process.argv.slice(2));