fix: a non-JSON vendor error body keeps the vendor's status; cut dead items and wrong comments - #128
Merged
Merged
Conversation
An upstream that answers an error status with a non-JSON body (a CDN or proxy HTML page on 502/504, a relay's plain-text 429 or 413) failed serde parsing and became a gateway-internal 500 "parse ... response": the account took a fault and failed over, the model's fallback_models chain never ran (is_upstream_fault ignores a 500 without an upstream status), and the client saw InternalServerException instead of the documented 424/429/503 with original_status_code. The six body-parse sites now classify such a body through vendor_error at its real status; a non-JSON body on a success status stays our parse error.
…rotocol Since the wire-type enum became the protocol catalog (39c81a2) the 400 interpolated the protocol string, so every refusal read "realtime model `realtime`" whatever model the client sent.
… arm BillingRecord derives only Serialize, so its seven #[serde(default)] attributes never took effect. Every Llama call rides a /model/ URL, which the Bedrock arm answers first, so the meta.llama arm never ran.
MOCK_B64 decodes to "MOCKBYTES", not PNG bytes; Account holds seven strings and two vectors, not six strings; the content_block_delta arm stated the native-versus-chat delta handling twice.
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.
Four commits from a whole-repo read of main@38927996: two fixes, then the read's cut-list.
Fixes
a3e4d37c— a non-JSON vendor error body keeps the vendor's status. An upstream that answers an error status with a non-JSON body (a CDN or proxy HTML page on 502/504, a relay's plain-text 413/429) failed serde parsing and became a gateway-internal 500parse … response. The account took a fault and failed over, the model'sfallback_modelschain never ran (is_upstream_faultignores a 500 without an upstream status), a client-caused 413 page cooled the account, and the client sawinternal_server_exceptioninstead of the documented 424model_error_exceptionwithoriginal_status_code(docs/api.md, docs/governance.md "Model fallback"). The six body-parse sites now classify such a body throughvendor_errorat its real status; a non-JSON body on a success status keeps the gateway parse error. Hot path unchanged: only the error branch differs.26dcb85e— the realtime refusal on the chat path names the model. Since 39c81a2 the 400 interpolated the protocol string, so it always read "realtime model `realtime`".Cuts (behavior-preserving, no test changed)
ca48cfe2—BillingRecordderives onlySerialize, so its seven#[serde(default)]never took effect; the mock'smeta.llamaarm is unreachable behind the/model/arm.740f67fe— comments the code contradicts or repeats:MOCK_B64is base64 of "MOCKBYTES", not PNG bytes;Accountholds seven strings and two vectors; thecontent_block_deltaarm stated one fact twice.Net: prod −3 lines, comment lines −3, tests +38.
Evidence
a_non_json_error_body_keeps_the_vendor_status(handler/tests/fallback.rs) failed on main withGatewayError { code: 1000, http_status: 500, message: "parse openai response", original_status: None };a_realtime_refusal_names_the_modelfailed with "realtime model `realtime` …".gwtest_*database and governance keys were created).internal_server_exception/v1/messages, proxy 502 page, fallback claude-haiku-4-5/v1/responsesstream, proxy 502 page, fallback gpt-4.1-miniinternal_server_exceptioncoolingmodel_error_exception,original_status_code: 413, no fallback, accountok