feat: install Anthropic error response formatter for proxy failures - #846
Open
skamenan7 wants to merge 7 commits into
Open
feat: install Anthropic error response formatter for proxy failures#846skamenan7 wants to merge 7 commits into
skamenan7 wants to merge 7 commits into
Conversation
skamenan7
force-pushed
the
feat/J-6941-anthropic-error-formatter
branch
from
August 31, 2026 22:40
a611d6a to
baf0db7
Compare
… proxy failures Add an ErrorResponseFormatter implementation that produces the standard Anthropic error envelope when Praxis synthesizes a fatal proxy response (connection refusal, timeout, etc.). The formatter is installed as a request extension after positive Anthropic Messages classification. Praxis invokes it from fail_to_proxy instead of emitting RFC 9457 Problem Details. Mapping: - 504 → timeout_error - 529 → overloaded_error - 429 → rate_limit_error - other → api_error - Top-level type is always "error" - request_id captured from x-request-id header or generated - Content-Type: application/json Known gap: FormattedErrorResponse in praxis-filter 0.5.3 carries only body + content_type. The matching request-id response header cannot be set until Praxis extends the contract. The request ID is included in the JSON body only. See Seb's confirmation in AI praxis-proxy#683. Non-Anthropic classifications do not install the formatter. Closes: RHAIENG-6941 Ref: praxis-proxy#683 Signed-off-by: Sumanth Kamenani <skamenan@redhat.com>
Signed-off-by: Sumanth Kamenani <skamenan@redhat.com>
… integration tests Signed-off-by: Sumanth Kamenani <skamenan@redhat.com>
skamenan7
force-pushed
the
feat/J-6941-anthropic-error-formatter
branch
from
August 31, 2026 23:00
baf0db7 to
8097933
Compare
…on test yaml Signed-off-by: Sumanth Kamenani <skamenan@redhat.com>
…b.com/skamenan7/ai into feat/J-6941-anthropic-error-formatter
skamenan7
marked this pull request as ready for review
September 1, 2026 13:43
Contributor
|
Can we get a demo test like you did for the OpenAI one? Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Installs the
AnthropicErrorFormatteron requests positively classified as Anthropic Messages API formats (/v1/messages). When a fatal proxy failure occurs (e.g., upstream connection refused, timeout, or overload), this ensures downstream clients receive a standard Anthropic-compatible{"type":"error","error":{"type":...},"request_id":...}JSON envelope rather than a default proxy error response.This covers the formatter installation, status code mapping, Unicode handling, fallback request ID generation, and comprehensive unit and integration testing.
Related issue
Closes #683
Validation
cargo test -p praxis-ai-apis -- anthropic)cargo test -p praxis-tests-integration --test suite -- anthropic_messages)make lintChecklist
Signed-off-bytrailer.Breaking changes
None.