Repository navigation
fix(mcp): retry failed connections on later tool calls - #2481
Merged
Merged
Conversation
A failed recovery previously remained cached until the user edited the server or ran Test connection. Let explicit tool calls re-handshake while keeping session assembly from repeatedly dialing unavailable servers.
Incorporate the latest upstream main before candidate validation and PR creation.
There was a problem hiding this comment.
AIUO CodePilot · Preliminary review
Diff-only preliminary review of the failed-MCP-connection retry change in UserMcpRuntime, with the related tests and spec updates. The pin/failed-transport handling, active-call preservation, and no-session-assembly-redial behavior appear internally consistent in the shown hunks; no concrete added-line defect is evidenced. Verification is limited to the supplied diff text, with no runtime, typecheck, or repository access.
No evidenced findings in the supplied diff.
Head: b908d60
Base: 5d480b7
CI: success; mergeable: true.
Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2471.
问题
MCP 断线后的第一次恢复握手如果再次失败,连接条目会一直缓存为
failed。即使服务器随后恢复,后续工具调用仍直接返回UNAVAILABLE,只能编辑配置或手动点击 Test connection。修复
tools/call,避免重复执行已经发生过的写操作。E2E-100的自动恢复预期。验证
Task candidate:
b908d601bdf6Base main:
5d480b7c936eEnvironment: macOS, Node.js
v26.13.1node --test apps/desktop/test/user-mcp.test.mjs apps/desktop/test/plugin-mcp.test.mjs(72/72)。ready,调用返回ok,无需手动 Test connection。2 !== 3失败,证明后续显式调用没有触发握手;修复后通过。node scripts/check-pr-base-main.mjs --base upstream/main --head HEAD。git diff --check upstream/main...HEAD。E2E-100当前在仓库中标记为 unit-covered,完整 UI journey 仍为 Draft;本次运行了其对应运行时测试和真实 stdio 恢复场景。兼容性与剩余风险
不改变 MCP 协议、持久化数据、权限或作用域检查。故障服务器仍可能让每次显式重试支付一次连接超时,但不会再无限期卡在陈旧失败状态。