plano/crates/brightstaff
Adil Hafeez c90b699c90 fix: surface real upstream error messages from orchestrator HTTP client
`post_and_extract_content` was unconditionally deserializing the upstream
response body as a `ChatCompletionsResponse`, which meant 4xx/5xx error
bodies (OpenAI-style `{"error": {...}}` envelopes) failed with confusing
messages like `missing field 'id' at line 1 column 391`. The real
upstream message (e.g. "This model's maximum context length is 32768
tokens...") only appeared once as a warn log and then got buried in the
generic "Failed to parse JSON response" path.

Now we:
- Check the HTTP status before attempting to parse the success body.
- On non-2xx, extract a human-readable message from the OpenAI-style
  error envelope (or fall back to a UTF-8-safe truncated raw body).
- Return a dedicated `HttpError::Upstream { status, message }` variant
  so callers can log / surface / retry based on the real status code.
- Truncate raw bodies in warn logs to 512 bytes (UTF-8-safe) to avoid
  flooding logs with oversized JSON or HTML error pages.
2026-04-17 18:41:15 -07:00
..
src fix: surface real upstream error messages from orchestrator HTTP client 2026-04-17 18:41:15 -07:00
Cargo.toml Redis-backed session cache for cross-replica model affinity (#879) 2026-04-13 19:30:47 -07:00