mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 05:24:34 -07:00
fix: acp/zed race condition between MCP initialisation and prompt (#20205)
Signed-off-by: Kartik Angiras <angiraskartik@gmail.com>
This commit is contained in:
@@ -716,6 +716,7 @@ export class Config implements McpContext {
|
||||
private compressionTruncationCounter = 0;
|
||||
private initialized = false;
|
||||
private initPromise: Promise<void> | undefined;
|
||||
private mcpInitializationPromise: Promise<void> | null = null;
|
||||
readonly storage: Storage;
|
||||
private readonly fileExclusions: FileExclusions;
|
||||
private readonly eventEmitter?: EventEmitter;
|
||||
@@ -1124,7 +1125,7 @@ export class Config implements McpContext {
|
||||
);
|
||||
// We do not await this promise so that the CLI can start up even if
|
||||
// MCP servers are slow to connect.
|
||||
const mcpInitialization = Promise.allSettled([
|
||||
this.mcpInitializationPromise = Promise.allSettled([
|
||||
this.mcpClientManager.startConfiguredMcpServers(),
|
||||
this.getExtensionLoader().start(this),
|
||||
]).then((results) => {
|
||||
@@ -1136,7 +1137,7 @@ export class Config implements McpContext {
|
||||
});
|
||||
|
||||
if (!this.interactive || this.experimentalZedIntegration) {
|
||||
await mcpInitialization;
|
||||
await this.mcpInitializationPromise;
|
||||
}
|
||||
|
||||
if (this.skillsSupport) {
|
||||
@@ -2234,6 +2235,12 @@ export class Config implements McpContext {
|
||||
return this.experimentalZedIntegration;
|
||||
}
|
||||
|
||||
async waitForMcpInit(): Promise<void> {
|
||||
if (this.mcpInitializationPromise) {
|
||||
await this.mcpInitializationPromise;
|
||||
}
|
||||
}
|
||||
|
||||
getListExtensions(): boolean {
|
||||
return this.listExtensions;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user