fix(core): complete MCP discovery when configured servers are skipped - #18586
Conversation
Summary of ChangesHello @LyalinDotCom, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical bug that prevented the MCP discovery process from finalizing when all configured servers were intentionally bypassed. By ensuring that the system correctly transitions to a completed state under these conditions, it prevents the user interface from indefinitely waiting for initialization and unblocks prompt execution. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly identifies and fixes an important edge case where MCP discovery could remain in an IN_PROGRESS state indefinitely if all configured servers are skipped on startup. The addition of regression tests is also a valuable contribution. The provided critical review comment with a suggested code change makes the logic more robust by checking the discovery state directly, which correctly handles all scenarios. With this change, the fix will be solid.
|
Size Change: +210 B (0%) Total Size: 24.3 MB ℹ️ View Unchanged
|
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…google-gemini#18586) Co-authored-by: christine betts <chrstn@uw.edu> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…google-gemini#18586) Co-authored-by: christine betts <chrstn@uw.edu> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…#18586) Co-authored-by: christine betts <chrstn@uw.edu> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…google-gemini#18586) Co-authored-by: christine betts <chrstn@uw.edu> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary
Fixes an MCP readiness edge case that could block normal prompt execution indefinitely.
When configured MCP servers are all skipped during startup (for example, user-disabled or blocked), discovery could remain in
IN_PROGRESSforever. The UI then kept queueing prompts behind "Waiting for MCP servers to initialize...".Details
startConfiguredMcpServers()inpackages/core/src/tools/mcp-client-manager.ts:COMPLETEDand emitmcp-client-update.packages/core/src/tools/mcp-client-manager.test.ts:should mark discovery completed when all configured servers are user-disabledshould mark discovery completed when all configured servers are blockedBehavioral flow:
Related Issues
Fixes #18585
How to Validate
npm run test --workspace @google/gemini-cli-core -- src/tools/mcp-client-manager.test.tsnpm run test --workspace @google/gemini-cli-core -- src/tools/mcp-client.test.ts src/tools/mcp-tool.test.ts src/prompts/mcp-prompts.test.ts src/tools/xcode-mcp-fix-transport.test.ts src/code_assist/admin/mcpUtils.test.tsnpm run test --workspace @google/gemini-cli -- src/ui/hooks/useMcpStatus.test.tsx src/ui/hooks/useMessageQueue.test.tsxnpm run test --workspace @google/gemini-cli-coreExpected result: all listed suites pass; when all configured MCP servers are skipped, discovery transitions to
COMPLETEDand prompts are not permanently queued.Pre-Merge Checklist