From 8b0cc3a849676d1a367227dc1caf0b4a2e4c751a Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Sat, 13 Jun 2026 00:39:45 +0000 Subject: [PATCH] fix(a2a_proxy): branch request-body read errors Distinguish errA2ABodyTooLarge (413 + truncated flag) from an unexpected I/O read error (400) so transient read failures are not mislabeled as truncation. Suggested by CR2 #11247. --- workspace-server/internal/handlers/a2a_proxy.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/workspace-server/internal/handlers/a2a_proxy.go b/workspace-server/internal/handlers/a2a_proxy.go index f0a2fa838..4b6eb1819 100644 --- a/workspace-server/internal/handlers/a2a_proxy.go +++ b/workspace-server/internal/handlers/a2a_proxy.go @@ -290,11 +290,15 @@ func (h *WorkspaceHandler) ProxyA2A(c *gin.Context) { // truncating mid-message (core#2677). body, err := readBodyWithLimit(c.Request.Body, maxProxyRequestBody, "request") if err != nil { - c.JSON(http.StatusRequestEntityTooLarge, gin.H{ - "error": err.Error(), - "truncated": true, - "max_bytes": maxProxyRequestBody, - }) + if errors.Is(err, errA2ABodyTooLarge) { + c.JSON(http.StatusRequestEntityTooLarge, gin.H{ + "error": err.Error(), + "truncated": true, + "max_bytes": maxProxyRequestBody, + }) + } else { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + } return } -- 2.52.0