fix(core): handle non-compliant mcpbridge responses from Xcode 26.3#18376
Conversation
Summary of ChangesHello @peterfriese, 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 addresses a compatibility issue with Xcode 26.3's 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 introduces a fix for non-compliant responses from Xcode's mcpbridge by wrapping the transport and parsing the content to populate the missing structuredContent field. The approach is well-isolated and includes good unit test coverage. My review includes a suggestion to improve encapsulation and type safety by avoiding the use of an any cast to access a private property, which will make the code more maintainable.
| extends EventEmitter | ||
| implements Transport | ||
| { | ||
| constructor(private readonly transport: Transport) { |
There was a problem hiding this comment.
To improve encapsulation and type safety, consider making the transport property public. The mcp-client.ts file needs to access this property to attach a debug listener to the underlying transport's stderr. Making it public allows for direct, type-safe access from the consuming module and avoids the use of any casting, which makes the code more robust and maintainable.
| constructor(private readonly transport: Transport) { | |
| constructor(public readonly transport: Transport) { |
| const underlyingTransport = | ||
| transport instanceof XcodeMcpBridgeFixTransport | ||
| ? // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| (transport as any).transport | ||
| : transport; |
There was a problem hiding this comment.
Following the change to make XcodeMcpBridgeFixTransport.transport public, this logic can be simplified to access the property directly. This removes the need for an any cast and the associated eslint-disable comment, leading to more maintainable and type-safe code.
const underlyingTransport =
transport instanceof XcodeMcpBridgeFixTransport
? transport.transport
: transport;|
/patch preview |
|
✅ Patch workflow(s) dispatched successfully! 📋 Details:
🔗 Track Progress: |
|
/patch stable |
|
✅ Patch workflow(s) dispatched successfully! 📋 Details:
🔗 Track Progress: |
|
/patch |
|
✅ Patch workflow(s) dispatched successfully! 📋 Details:
🔗 Track Progress: |
|
🚀 Patch PR Created! 📋 Patch Details:
📝 Next Steps:
🔗 Track Progress: |
|
🚀 Patch PR Created! 📋 Patch Details:
📝 Next Steps:
🔗 Track Progress: |
|
🚀 Patch Release Started! 📋 Release Details:
⏳ Status: The patch release is now running. You'll receive another update when it completes. 🔗 Track Progress: |
|
🚀 Patch Release Started! 📋 Release Details:
⏳ Status: The patch release is now running. You'll receive another update when it completes. 🔗 Track Progress: |
|
✅ Patch Release Complete! 📦 Release Details:
🎉 Status: Your patch has been successfully released and published to npm! 📝 What's Available:
🔗 Links: |
|
✅ Patch Release Complete! 📦 Release Details:
🎉 Status: Your patch has been successfully released and published to npm! 📝 What's Available:
🔗 Links: |
Summary
Provides a fix for #18371
Details
Xcode 26.3's
xcrun mcpbridgereturns tool results as an unparsed JSON string within thecontentfield, failing to provide the expectedstructuredContent. This behavior breaks strict MCP clients likegemini-cli.This PR introduces XcodeMcpBridgeFixTransport, a transport wrapper that intercepts JSON-RPC messages from the Xcode bridge. It detects responses with missing
structuredContentand attempts to parse thecontentstring as JSON to backfill the missing field.Key Changes:
xcrunand arguments includemcpbridge.Related Issues
Fixes #18371
How to Validate
Unit Tests:
Run the new test suite to verify the fix logic:
npm test packages/core/src/tools/xcode-mcp-fix-transport.test.tsLive Verification (MacOS with Xcode 26.3+):
HelloWorld).Pre-Merge Checklist
(Note: this is only relevant on macOS, since it's not possible to run Xcode on any other platform).