fix: always strip old functionCall/functionResponse from LS history

The function call stripping was only happening when no custom tools
were present. But even with custom tools injected, the LS history
contains functionCall/functionResponse parts for LS-internal tools
that we stripped, causing MALFORMED_FUNCTION_CALL. Now always strip
regardless of custom tools presence.
This commit is contained in:
Nikketryhard
2026-02-14 23:59:13 -06:00
parent 3303ce38de
commit 19ff784cae
2 changed files with 12 additions and 1 deletions

View File

@@ -726,6 +726,12 @@ async fn handle_http_over_tls(
}
headers_parsed = true;
// Log error response bodies for debugging
if resp.code.unwrap_or(0) >= 400 {
let body_preview = String::from_utf8_lossy(&header_buf[hdr_end..]);
warn!(domain, status = resp.code.unwrap_or(0), body = %body_preview, "MITM: upstream error response");
}
// Save body for usage parsing
response_body_buf.extend_from_slice(&header_buf[hdr_end..]);