fix(server): render Anthropic error envelopes - #315
Conversation
Signed-off-by: nachiketb <nachiketb@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
WalkthroughThe server now stores structured ChangesError rendering
Estimated code review effort: 4 (Complex) | ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Signed-off-by: nachiketb <nachiketb@nvidia.com>
What
Render errors from
/v1/messagesand/v1/messages/count_tokenswith Anthropic's nativetype: "error"envelope. OpenAI Chat and Responses errors keep their existing envelope.Why
Anthropic-compatible clients currently receive native Anthropic success bodies but OpenAI-shaped failures. Upstream JSON error bodies are also embedded as escaped strings instead of exposing their message.
Fixes SWITCH-1221.
How
What to review
Validation
cargo test -p switchyard-server --test server request_and_upstream_errors_use_the_inbound_wire_formatcargo clippy -p switchyard-server --all-targets -- -D warningscargo fmt --all -- --checkSummary by CodeRabbit