@@ -1544,9 +1544,6 @@ export class Config implements McpContext, AgentLoopContext {
15441544 // Only assign to instance properties after successful initialization
15451545 this . contentGeneratorConfig = newContentGeneratorConfig ;
15461546
1547- // Initialize BaseLlmClient now that the ContentGenerator is available
1548- this . baseLlmClient = new BaseLlmClient ( this . contentGenerator , this ) ;
1549-
15501547 const codeAssistServer = getCodeAssistServer ( this ) ;
15511548 const quotaPromise = codeAssistServer ?. projectId
15521549 ? this . refreshUserQuota ( )
@@ -1562,6 +1559,17 @@ export class Config implements McpContext, AgentLoopContext {
15621559 return undefined ;
15631560 } ) ;
15641561
1562+ // Fetch experiments and update timeouts before continuing initialization
1563+ const experiments = await this . experimentsPromise ;
1564+
1565+ const requestTimeoutMs = this . getRequestTimeoutMs ( ) ;
1566+ if ( requestTimeoutMs !== undefined ) {
1567+ updateGlobalFetchTimeouts ( requestTimeoutMs ) ;
1568+ }
1569+
1570+ // Initialize BaseLlmClient now that the ContentGenerator and experiments are available
1571+ this . baseLlmClient = new BaseLlmClient ( this . contentGenerator , this ) ;
1572+
15651573 await quotaPromise ;
15661574
15671575 const authType = this . contentGeneratorConfig . authType ;
@@ -1581,14 +1589,6 @@ export class Config implements McpContext, AgentLoopContext {
15811589 this . setModel ( DEFAULT_GEMINI_MODEL_AUTO ) ;
15821590 }
15831591
1584- // Fetch admin controls
1585- const experiments = await this . experimentsPromise ;
1586-
1587- const requestTimeoutMs = this . getRequestTimeoutMs ( ) ;
1588- if ( requestTimeoutMs !== undefined ) {
1589- updateGlobalFetchTimeouts ( requestTimeoutMs ) ;
1590- }
1591-
15921592 const adminControlsEnabled =
15931593 experiments ?. flags [ ExperimentFlags . ENABLE_ADMIN_CONTROLS ] ?. boolValue ??
15941594 false ;
0 commit comments