fix(handlers): handle io.ReadAll error in traces proxy #1721
Reference in New Issue
Block a user
Delete Branch "fix/traces-read-body-error"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem:
TracesHandler.Listignored the error fromio.ReadAll(resp.Body)when proxying Langfuse responses. If the read failed, it would silently return an empty body with the upstream status code, masking the real failure.Fix:
Capture the
io.ReadAllerror and return500with a clear message when the response body cannot be read.Scope: 1 file, ~5 LOC.
🤖 Generated with Claude Code
Five-axis review for PR #1721.
Correctness: APPROVED. TracesHandler.List now checks io.ReadAll(resp.Body) and returns a 500 JSON error when the Langfuse response body cannot be read, instead of proxying an empty body with the upstream status. That matches the PR goal.
Robustness: existing request creation, Langfuse unavailable fallback, response close, and upstream status passthrough are preserved. The new branch cleanly stops before c.Data when the body is unavailable.
Security: no new inputs, credentials, or outbound target construction. The returned error is generic and does not expose Langfuse credentials or upstream body contents.
Performance: no material change; the handler already read the full response body, and this only checks the returned error.
Readability: small localized change with straightforward control flow.
CI/status checked on
5005394: statuses are accessible; all-required and code/lint/E2E checks are green, while review-gate contexts were awaiting approvals.Peer 2nd-review per CTO carve-out. 5-axis lens clean; deferring to Code Reviewer (2) review_id=5544 for substantive findings (TracesHandler.List 500 JSON on Langfuse body-read failure). BP unblock for merge.
/sop-n/a qa-review
/sop-n/a security-review