The open-source agent harness - the runtime layer that turns an LLM into a working agent.
Raise default model HTTP headers and body timeouts to 2 minutes (#1007)
Chirag Jaine1f470f6f14e
diff --git a/.changeset/model-http-timeouts-2m.md b/.changeset/model-http-timeouts-2m.mdnew file mode 100644index 000000000..ba1356f1d--- /dev/null+++ b/.changeset/model-http-timeouts-2m.md@@ -0,0 +1,6 @@+---+"@truefoundry/trueforge": patch+"@truefoundry/trueforge-core": patch+---++Raise the default model HTTP headers and body timeouts to 2 minutes so slow first-token and idle stream responses are not dropped.diff --git a/packages/trueforge-core/src/core/util/outboundFetch.ts b/packages/trueforge-core/src/core/util/outboundFetch.tsindex 708ff5979..2c4f2f52b 100644--- a/packages/trueforge-core/src/core/util/outboundFetch.ts+++ b/packages/trueforge-core/src/core/util/outboundFetch.ts@@ -10,11 +10,11 @@ export const DEFAULT_OUTBOUND_HTTP_BODY_TIMEOUT_MS = 5_000;export const DEFAULT_OUTBOUND_HTTP_MAX_RETRIES = 2;/** Model outbound undici headersTimeout. Env: `MODEL_HTTP_HEADERS_TIMEOUT_MS`. */-export const DEFAULT_MODEL_HTTP_HEADERS_TIMEOUT_MS = 60_000;+export const DEFAULT_MODEL_HTTP_HEADERS_TIMEOUT_MS = 2 * 60 * 1000;/** Model outbound undici connect timeout. Env: `MODEL_HTTP_CONNECT_TIMEOUT_MS`. */export const DEFAULT_MODEL_HTTP_CONNECT_TIMEOUT_MS = 5_000;/** Model outbound undici bodyTimeout. Env: `MODEL_HTTP_BODY_TIMEOUT_MS`. */-export const DEFAULT_MODEL_HTTP_BODY_TIMEOUT_MS = 60_000;+export const DEFAULT_MODEL_HTTP_BODY_TIMEOUT_MS = 2 * 60 * 1000;/** Model outbound fetch retries. Env: `MODEL_HTTP_MAX_RETRIES`. */export const DEFAULT_MODEL_HTTP_MAX_RETRIES = 2;diff --git a/packages/trueforge/.env.example b/packages/trueforge/.env.exampleindex c679fd054..48b001e2b 100644--- a/packages/trueforge/.env.example+++ b/packages/trueforge/.env.example@@ -169,10 +169,10 @@ TRUEFORGE_API_KEY=placeholder-value-please-generate-your-own# OUTBOUND_HTTP_BODY_TIMEOUT_MS=5000# OUTBOUND_HTTP_MAX_RETRIES=2## Model-provider undici timeouts/retries.-# MODEL_HTTP_HEADERS_TIMEOUT_MS=60000+# MODEL_HTTP_HEADERS_TIMEOUT_MS=120000# MODEL_HTTP_CONNECT_TIMEOUT_MS=5000-## undici bodyTimeout for model fetch (idle between body chunks). Default 60000.-# MODEL_HTTP_BODY_TIMEOUT_MS=60000+## undici bodyTimeout for model fetch (idle between body chunks). Default 120000 (2m).+# MODEL_HTTP_BODY_TIMEOUT_MS=120000## Retries for model connect/headers timeouts and 408/409/429/520–524/530. Honors Retry-After up to 5s, else backoff. Default 2.# MODEL_HTTP_MAX_RETRIES=2diff --git a/packages/trueforge/src/config.ts b/packages/trueforge/src/config.tsindex 472d7a7ca..c180c8890 100644--- a/packages/trueforge/src/config.ts+++ b/packages/trueforge/src/config.ts@@ -867,12 +867,12 @@ export interface SharedServerConfiguration {MODEL_HTTP_CONNECT_TIMEOUT_MS: number;/*** undici headersTimeout for model-provider outbound fetch.- * Env: `MODEL_HTTP_HEADERS_TIMEOUT_MS`. Default 60000.+ * Env: `MODEL_HTTP_HEADERS_TIMEOUT_MS`. Default 2 minutes.*/MODEL_HTTP_HEADERS_TIMEOUT_MS: number;/*** undici bodyTimeout for model-provider outbound fetch (idle between body chunks).- * Env: `MODEL_HTTP_BODY_TIMEOUT_MS`. Default 60000.+ * Env: `MODEL_HTTP_BODY_TIMEOUT_MS`. Default 2 minutes.*/MODEL_HTTP_BODY_TIMEOUT_MS: number;/**@@ -1250,12 +1250,12 @@ const shared: SharedServerConfiguration = {MODEL_HTTP_HEADERS_TIMEOUT_MS: parsePositiveInt({envKey: 'MODEL_HTTP_HEADERS_TIMEOUT_MS',raw: getEnv('MODEL_HTTP_HEADERS_TIMEOUT_MS'),- defaultValue: 60_000,+ defaultValue: 2 * 60 * 1000,}),MODEL_HTTP_BODY_TIMEOUT_MS: parsePositiveInt({envKey: 'MODEL_HTTP_BODY_TIMEOUT_MS',raw: getEnv('MODEL_HTTP_BODY_TIMEOUT_MS'),- defaultValue: 60_000,+ defaultValue: 2 * 60 * 1000,}),MODEL_HTTP_MAX_RETRIES: parseNonNegativeInt({envKey: 'MODEL_HTTP_MAX_RETRIES',