fix(mcp): 将 mcp server连接失败的真实原因传递给下游 error_message - #413
Open
openjiuwen-sync-bot[bot] wants to merge 1 commit into
Open
fix(mcp): 将 mcp server连接失败的真实原因传递给下游 error_message#413openjiuwen-sync-bot[bot] wants to merge 1 commit into
openjiuwen-sync-bot[bot] wants to merge 1 commit into
Conversation
|
|
openjiuwenai
force-pushed
the
sync/pr-2247
branch
from
August 8, 2026 08:56
e83cf31 to
eaae345
Compare
openjiuwenai
force-pushed
the
sync/pr-2247
branch
from
August 12, 2026 08:49
eaae345 to
b71baaf
Compare
add_tool_server 此前对连接失败的可观测性不足,失败原因到不了 Error.error_message: 1. connect() 返回 False 时只抛空 reason 的 BaseError,真实异常丢失。 现在让各 McpClient 记录 _last_connect_error,add_tool_server 读取 它填入 CONNECTION_ERROR 的 reason。该自产 BaseError 在 except BaseException 入口即放行,避免被重包成 ADD_ERROR 而语义降级、 异常类型被埋进嵌套 message。 2. connect/list_tools 抛裸 CancelledError(MCP SDK streamable-http anyio task-group teardown)或含 GeneratorExit 的 BaseExceptionGroup 时,会穿透 except Exception 经 add_mcp_server 静默吞掉。现归一为 带 reason 的 BaseError(AD_ERROR),KeyboardInterrupt 原样透传。 新增单测固定 connect=False 穿透、CancelledError 归一、 BaseExceptionGroup 归一三条路径。
openjiuwenai
force-pushed
the
sync/pr-2247
branch
from
August 13, 2026 03:29
b71baaf to
5e52461
Compare
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.
Paired: GitHub #413 ↔ GitCode !2247
What type of PR is this?
/kind
Self-checklist:(请自检,在[ ]内打上x,我们将检视你的完成情况,否则会导致pr无法合入)
Linked Closing Issues: