Skip to content

HTTP response collection failures currently collapse the upstream body to empty #67

@GuthL

Description

@GuthL

Summary

When KeyClaw intercepts a non-SSE HTTP response and body.collect().await fails, the handler currently returns the upstream response headers with Body::empty().

Evidence

  • src/proxy/http.rs:252-255
let (mut parts, body) = res.into_parts();
let collected = match body.collect().await {
    Ok(collected) => collected,
    Err(_) => return Response::from_parts(parts, Body::empty()),
};

Why this matters

A transient upstream read error or truncated body should not silently turn into a successful-looking empty response. That corrupts the client-visible result and makes debugging much harder because the original failure mode is discarded.

Suggested scope

  • Preserve or surface the upstream read failure instead of swapping in an empty body.
  • Add a regression test for the error path so intercepted responses do not degrade into silent empties.
  • Keep placeholder-resolution behavior unchanged on the successful path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions