server: capture failed (non-200) LLM requests (#862)

Store a request/response capture for non-200 responses so failed
requests can be inspected in the activity log's Capture dialog, matching
the existing behavior for successful requests.

- extract storeCapture/decodeResponseBody helpers to share capture logic
between the success and non-200 paths
- record non-200 bodies (decompressed) so error details are viewable
- the activity UI already gates the View button on has_capture, so it
now appears for failed requests with no UI changes
- add tests for capturing failed requests and the disabled-captures case

closes #766
This commit is contained in:
Benson Wong
2026-06-20 11:50:35 -07:00
committed by GitHub
parent 9bcddad91b
commit eff9b60434
4 changed files with 280 additions and 26 deletions
+1
View File
@@ -43,6 +43,7 @@ export interface ActivityLogEntry {
tokens: TokenMetrics;
duration_ms: number;
has_capture: boolean;
error_msg?: string;
metadata?: Record<string, string>;
}