From 500539458bf04e43da7df1bbdf077fdfbded9ed9 Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Sat, 23 May 2026 07:58:59 +0000 Subject: [PATCH] fix(handlers): handle io.ReadAll error in traces proxy The TracesHandler.List proxy was ignoring the error from io.ReadAll on the Langfuse response body. If the read failed it would silently return an empty body with the upstream status code, masking the real failure. Return 500 when the body cannot be read. Co-Authored-By: Claude Opus 4.7 --- workspace-server/internal/handlers/traces.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/workspace-server/internal/handlers/traces.go b/workspace-server/internal/handlers/traces.go index 19df5f1cd..ae7c5f448 100644 --- a/workspace-server/internal/handlers/traces.go +++ b/workspace-server/internal/handlers/traces.go @@ -51,6 +51,10 @@ func (h *TracesHandler) List(c *gin.Context) { } defer func() { _ = resp.Body.Close() }() - body, _ := io.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to read response body"}) + return + } c.Data(resp.StatusCode, "application/json", body) } -- 2.52.0