From ea90a6783d281853d65c20aafc0b6ea268d5f3ca Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Mon, 27 Apr 2026 20:42:23 +0200 Subject: [PATCH] fix(coding-agent): disable undici body/headers idle timeouts on global dispatcher Long local-LLM SSE streams (e.g. vLLM buffering large tool calls) exceeded undici's default 300s bodyTimeout and aborted with UND_ERR_BODY_TIMEOUT. retry.provider.timeoutMs cannot lift this cap because it controls the provider SDK's AbortController deadline, not undici's per-socket idle timer. Pass { bodyTimeout: 0, headersTimeout: 0 } to EnvHttpProxyAgent. Provider SDKs still enforce their own timeouts via retry.provider.timeoutMs. closes #3715 --- packages/coding-agent/CHANGELOG.md | 1 + packages/coding-agent/src/cli.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index f65251305..38ae87408 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -14,6 +14,7 @@ - Fixed `/tree` cancellation via `session_before_tree` leaving the session stuck in compaction state ([#3688](https://github.com/badlogic/pi-mono/issues/3688)) - Fixed Escape interrupt handling when extensions hide the built-in working loader row ([#3674](https://github.com/badlogic/pi-mono/issues/3674)) - Fixed coding-agent test expectations for current default models and missing-auth guidance. +- Fixed long local-LLM SSE streams aborting at 5 minutes with `UND_ERR_BODY_TIMEOUT` by disabling undici `bodyTimeout`/`headersTimeout` on the global dispatcher; provider SDKs continue to enforce their own deadlines via `retry.provider.timeoutMs` ([#3715](https://github.com/badlogic/pi-mono/issues/3715)) ## [0.70.2] - 2026-04-24 diff --git a/packages/coding-agent/src/cli.ts b/packages/coding-agent/src/cli.ts index 7d0427021..6e0e8403a 100644 --- a/packages/coding-agent/src/cli.ts +++ b/packages/coding-agent/src/cli.ts @@ -13,6 +13,10 @@ process.title = APP_NAME; process.env.PI_CODING_AGENT = "true"; process.emitWarning = (() => {}) as typeof process.emitWarning; -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 })); main(process.argv.slice(2));