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.
This commit is contained in:
Yuna Seol
2026-03-30 13:13:52 -04:00
parent e77b22e638
commit f9006c4eff
+8
View File
@@ -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;