The open-source agent harness - the runtime layer that turns an LLM into a working agent.
Give model fetches a 60s body timeout and shorten the default MCP request timeout to 2 minutes. (#965)
Chirag Jain8b6c4bfc4665
diff --git a/.changeset/http-timeout-defaults.md b/.changeset/http-timeout-defaults.mdnew file mode 100644index 000000000..416cf1638--- /dev/null+++ b/.changeset/http-timeout-defaults.md@@ -0,0 +1,6 @@+---+'@truefoundry/trueforge': patch+'@truefoundry/trueforge-core': patch+---++Raise the default model HTTP body timeout to 60s and shorten the default MCP request timeout to 2 minutes.diff --git a/packages/trueforge-core/src/core/util/outboundFetch.ts b/packages/trueforge-core/src/core/util/outboundFetch.tsindex 208a43690..36b810fae 100644--- a/packages/trueforge-core/src/core/util/outboundFetch.ts+++ b/packages/trueforge-core/src/core/util/outboundFetch.ts@@ -14,7 +14,7 @@ export const DEFAULT_MODEL_HTTP_HEADERS_TIMEOUT_MS = 5_000;/** 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 = 5_000;+export const DEFAULT_MODEL_HTTP_BODY_TIMEOUT_MS = 60_000;/** Model outbound fetch retries. Env: `MODEL_HTTP_MAX_RETRIES`. */export const DEFAULT_MODEL_HTTP_MAX_RETRIES = 2;@@ -22,7 +22,7 @@ export const DEFAULT_MODEL_HTTP_MAX_RETRIES = 2;* MCP outbound undici headersTimeout. Env: `MCP_HTTP_HEADERS_TIMEOUT_MS`.* Matches the default MCP request timeout: JSON-response servers send headers only after the tool finishes.*/-export const DEFAULT_MCP_HTTP_HEADERS_TIMEOUT_MS = 4 * 60 * 1000;+export const DEFAULT_MCP_HTTP_HEADERS_TIMEOUT_MS = 2 * 60 * 1000;/** MCP outbound undici connect timeout. Env: `MCP_HTTP_CONNECT_TIMEOUT_MS`. */export const DEFAULT_MCP_HTTP_CONNECT_TIMEOUT_MS = 5_000;/**diff --git a/packages/trueforge/.env.example b/packages/trueforge/.env.exampleindex 2692d6e5c..28c8f83f1 100644--- a/packages/trueforge/.env.example+++ b/packages/trueforge/.env.example@@ -142,15 +142,15 @@ TRUEFORGE_API_KEY=placeholder-value-please-generate-your-own# MCP_DCR_OAUTH_CLIENT_NAME=truefoundry-harness## MCP client timeouts. All optional.-## Max ms for one MCP JSON-RPC request end to end. Default 240000 (4 minutes).-# MCP_REQUEST_TIMEOUT_MS=240000+## Max ms for one MCP JSON-RPC request end to end. Default 120000 (2 minutes).+# MCP_REQUEST_TIMEOUT_MS=120000## Max ms for the MCP initialize handshake per transport attempt. Default 30000.# MCP_CONNECT_TIMEOUT_MS=30000## Max bytes for one remote MCP tool-call HTTP response body (JSON / POST SSE). Default 50 MB.# MCP_TOOL_CALL_MAX_RESPONSE_BYTES=52428800## undici headersTimeout for MCP fetch. JSON-response servers send headers only after the tool## finishes, so keep this >= MCP_REQUEST_TIMEOUT_MS. Default MCP_REQUEST_TIMEOUT_MS.-# MCP_HTTP_HEADERS_TIMEOUT_MS=240000+# MCP_HTTP_HEADERS_TIMEOUT_MS=120000## undici connect timeout for MCP fetch. Default 5000.# MCP_HTTP_CONNECT_TIMEOUT_MS=5000## undici bodyTimeout for MCP fetch (idle between body chunks). Default 1800000 (30m).@@ -171,8 +171,8 @@ TRUEFORGE_API_KEY=placeholder-value-please-generate-your-own## Model-provider undici timeouts/retries.# MODEL_HTTP_HEADERS_TIMEOUT_MS=5000# MODEL_HTTP_CONNECT_TIMEOUT_MS=5000-## undici bodyTimeout for model fetch (idle between body chunks). Default 5000.-# MODEL_HTTP_BODY_TIMEOUT_MS=5000+## undici bodyTimeout for model fetch (idle between body chunks). Default 60000.+# MODEL_HTTP_BODY_TIMEOUT_MS=60000## 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 6b9cfcf6c..aa2ef1f09 100644--- a/packages/trueforge/src/config.ts+++ b/packages/trueforge/src/config.ts@@ -866,7 +866,7 @@ export interface SharedServerConfiguration {MODEL_HTTP_HEADERS_TIMEOUT_MS: number;/*** undici bodyTimeout for model-provider outbound fetch (idle between body chunks).- * Env: `MODEL_HTTP_BODY_TIMEOUT_MS`. Default 5000.+ * Env: `MODEL_HTTP_BODY_TIMEOUT_MS`. Default 60000.*/MODEL_HTTP_BODY_TIMEOUT_MS: number;/**@@ -874,7 +874,7 @@ export interface SharedServerConfiguration {* Env: `MODEL_HTTP_MAX_RETRIES`. Default 2.*/MODEL_HTTP_MAX_RETRIES: number;- /** Max milliseconds for one MCP JSON-RPC request end to end. Env: `MCP_REQUEST_TIMEOUT_MS`. Default 4 minutes. */+ /** Max milliseconds for one MCP JSON-RPC request end to end. Env: `MCP_REQUEST_TIMEOUT_MS`. Default 2 minutes. */MCP_REQUEST_TIMEOUT_MS: number;/** Max milliseconds for the MCP initialize handshake per transport attempt. Env: `MCP_CONNECT_TIMEOUT_MS`. Default 30 seconds. */MCP_CONNECT_TIMEOUT_MS: number;@@ -1084,7 +1084,7 @@ const serverExecutionTimeoutSeconds = parsePositiveInt({const mcpRequestTimeoutMs = parsePositiveInt({envKey: 'MCP_REQUEST_TIMEOUT_MS',raw: getEnv('MCP_REQUEST_TIMEOUT_MS'),- defaultValue: 4 * 60 * 1000,+ defaultValue: 2 * 60 * 1000,});const standalone = parseBoolean({@@ -1234,7 +1234,7 @@ const shared: SharedServerConfiguration = {MODEL_HTTP_BODY_TIMEOUT_MS: parsePositiveInt({envKey: 'MODEL_HTTP_BODY_TIMEOUT_MS',raw: getEnv('MODEL_HTTP_BODY_TIMEOUT_MS'),- defaultValue: 5_000,+ defaultValue: 60_000,}),MODEL_HTTP_MAX_RETRIES: parseNonNegativeInt({envKey: 'MODEL_HTTP_MAX_RETRIES',@@ -1260,7 +1260,7 @@ const shared: SharedServerConfiguration = {MCP_HTTP_BODY_TIMEOUT_MS: parsePositiveInt({envKey: 'MCP_HTTP_BODY_TIMEOUT_MS',raw: getEnv('MCP_HTTP_BODY_TIMEOUT_MS'),- defaultValue: 1_800_000,+ defaultValue: 30 * 60 * 1000,}),MCP_HTTP_MAX_RETRIES: parseNonNegativeInt({envKey: 'MCP_HTTP_MAX_RETRIES',