From 6f5a7c2d36c8de65d80691f87ad7bbe6d8b11598 Mon Sep 17 00:00:00 2001 From: umairnadeem Date: Thu, 30 Apr 2026 22:00:57 -0700 Subject: [PATCH] fix(vercel-sandbox): disable headers timeout on default agent `DEFAULT_AGENT` already disables `bodyTimeout` to support long-running streams, but undici's `headersTimeout` was left at its 5-min default. That cuts off `cmd.wait()`'s long-poll request when a sandbox command runs longer than 5 minutes, even when the sandbox itself has a longer timeout. Set `headersTimeout: 0` to match the existing intent. Co-Authored-By: Claude Opus 4.7 (1M context) --- .changeset/disable-headers-timeout.md | 5 +++++ packages/vercel-sandbox/src/api-client/base-client.ts | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/disable-headers-timeout.md diff --git a/.changeset/disable-headers-timeout.md b/.changeset/disable-headers-timeout.md new file mode 100644 index 00000000..428394fe --- /dev/null +++ b/.changeset/disable-headers-timeout.md @@ -0,0 +1,5 @@ +--- +"@vercel/sandbox": patch +--- + +Disable `headersTimeout` on the default undici Agent so long-running `cmd.wait()` long-polls don't abort at undici's 5-minute default. Previously `bodyTimeout` was disabled but `headersTimeout` was left at the default, which cut off `cmd.wait()` when a sandbox command took longer than 5 minutes — even though the sandbox itself was still alive. diff --git a/packages/vercel-sandbox/src/api-client/base-client.ts b/packages/vercel-sandbox/src/api-client/base-client.ts index 42f83424..209997a7 100644 --- a/packages/vercel-sandbox/src/api-client/base-client.ts +++ b/packages/vercel-sandbox/src/api-client/base-client.ts @@ -15,6 +15,7 @@ export interface RequestParams extends RequestInit { const DEFAULT_AGENT = new Agent({ bodyTimeout: 0, // disable body timeout to allow long logs streaming + headersTimeout: 0, // disable headers timeout so long-poll cmd.wait() doesn't abort after undici's 5-min default }); /**