From 46053c5fe911cd044601f89a80f782fddac40170 Mon Sep 17 00:00:00 2001 From: ZhouYongyou <128128010+zhouyongyou@users.noreply.github.com> Date: Sun, 2 Nov 2025 09:05:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=20HTTP/2=20stream=20e?= =?UTF-8?q?rror=20=E5=88=B0=E5=8F=AF=E9=87=8D=E8=A9=A6=E9=8C=AF=E8=AA=A4?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 問題: - 用戶遇到錯誤:stream error: stream ID 1; INTERNAL_ERROR - 這是 HTTP/2 連接被服務端關閉的錯誤 - 當前重試機制不包含此類錯誤,導致直接失敗 修復: - 添加 "stream error" 到可重試列表 - 添加 "INTERNAL_ERROR" 到可重試列表 - 遇到此類錯誤時會自動重試(最多 3 次) 影響: - 提高 API 調用穩定性 - 自動處理服務端臨時故障 - 減少因網絡波動導致的失敗 --- mcp/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mcp/client.go b/mcp/client.go index 9191dfaf..5ef090e8 100644 --- a/mcp/client.go +++ b/mcp/client.go @@ -280,6 +280,8 @@ func isRetryableError(err error) bool { "connection refused", "temporary failure", "no such host", + "stream error", // HTTP/2 stream 错误 + "INTERNAL_ERROR", // 服务端内部错误 } for _, retryable := range retryableErrors { if strings.Contains(errStr, retryable) {