fix(coding-agent): align undici fetch globals

closes #4650

closes #4652

closes #4653
This commit is contained in:
Mario Zechner
2026-05-18 01:56:14 +02:00
parent 9e2bfc7c40
commit 085230373f
2 changed files with 7 additions and 1 deletions

View File

@@ -5,7 +5,7 @@
*
* Test with: npx tsx src/cli-new.ts [args...]
*/
import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
import { EnvHttpProxyAgent, install as installUndiciGlobals, setGlobalDispatcher } from "undici";
import { APP_NAME } from "./config.js";
import { main } from "./main.js";
@@ -19,4 +19,9 @@ process.emitWarning = (() => {}) as typeof process.emitWarning;
// AbortController-based deadlines via retry.provider.timeoutMs.
setGlobalDispatcher(new EnvHttpProxyAgent({ bodyTimeout: 0, headersTimeout: 0 }));
// Keep fetch and the dispatcher on the same undici implementation. Node 26.0's
// bundled fetch can otherwise consume compressed responses through npm undici's
// dispatcher without decompressing them, causing response.json() failures.
installUndiciGlobals();
main(process.argv.slice(2));