From f9006c4eff3825f7cfbfefa1fabcff4b5e163b1a Mon Sep 17 00:00:00 2001 From: Yuna Seol Date: Mon, 30 Mar 2026 13:13:52 -0400 Subject: [PATCH] feat(core): use experiment flags for default fetch timeouts Replaces hardcoded fetch timeouts in `undici`'s Agent and ProxyAgent with newly defined experiment flags `DEFAULT_REQUEST_TIMEOUT` and `DEFAULT_TOTAL_REQUEST_TIMEOUT`. This allows for remote configuration of request timeouts. - Added `DEFAULT_REQUEST_TIMEOUT` and `DEFAULT_TOTAL_REQUEST_TIMEOUT` to `ExperimentFlags`. - Updated `fetch.ts` to use `DEFAULT_REQUEST_TIMEOUT` for headers and body timeouts. - Added unit tests to verify `setGlobalProxy` correctly applies the timeout flags. --- packages/core/src/config/config.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index 0edd4af7b0..d0c04b3773 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -1593,6 +1593,14 @@ export class Config implements McpContext, AgentLoopContext { this.setModel(DEFAULT_GEMINI_MODEL_AUTO); } + // Fetch admin controls + const experiments = await this.experimentsPromise; + + const requestTimeoutMs = this.getRequestTimeoutMs(); + if (requestTimeoutMs !== undefined) { + updateGlobalFetchTimeouts(requestTimeoutMs); + } + const adminControlsEnabled = experiments?.flags[ExperimentFlags.ENABLE_ADMIN_CONTROLS]?.boolValue ?? false;