Repository navigation
test(e2e): fail the run when a Rust gateway silently serves /messages through Python - #34208
Merged
yassin-berriai merged 1 commit intoJul 22, 2026
Merged
Conversation
… through Python A gateway whose native extension is unavailable falls back to the Python implementation without raising, so it answers /v1/messages normally and the only difference on the wire is the absent x-litellm-rust header. Nothing in the suite read that header, so a Rust deployment that had stopped running Rust produced a fully green e2e run. Assert the marker on the streamed Messages assertions when E2E_EXPECT_RUST is set. It stays opt-in because the same suite image also runs against the standard gateway, which has no Rust path and must keep passing; the two deployments are already separate Applications, so this is one value on the Rust instance rather than branching inside the tests.
|
|
Contributor
Greptile SummaryThis PR makes the streamed Azure Foundry Messages tests verify that a configured Rust gateway actually uses the Rust path. The main changes are:
Confidence Score: 5/5This looks safe to merge.
|
| Filename | Overview |
|---|---|
| tests/e2e/e2e_config.py | Adds an environment-derived boolean that defaults to disabled and accepts common true values. |
| tests/e2e/llm_translation/test_messages_azure_foundry_e2e.py | Conditionally validates the Rust response marker in the shared streamed-response assertion. |
Reviews (1): Last reviewed commit: "test(e2e): fail the run when a Rust gate..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
yassin-berriai
enabled auto-merge (squash)
July 22, 2026 21:43
yucheng-berri
approved these changes
Jul 22, 2026
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.
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
A gateway whose Rust extension is unavailable serves
/v1/messagesthrough Python and returns a completely normal response; the only difference on the wire is the absentx-litellm-rustheader. Nothing in the suite looked at that header, so a Rust deployment that had silently stopped running Rust would produce a fully green e2e runBoth gateways below are the SAME image, same config, answering real Azure AI Foundry Claude calls (real spend). The only difference is that one has the native extension deleted from the import path, reproducing exactly what a broken Rust image does
Driving a real streamed
/v1/messagescall against each and feeding the response into the changed helper, withE2E_EXPECT_RUST=1(captured at3b4d3d4):Confirming the marker is genuinely present on the wire for a streamed response, not just in
_hidden_params:With
E2E_EXPECT_RUSTunset (every existing run, including the standard staging instance) both gateways pass exactly as before, so this is inert for non-Rust deploymentsmake lint-e2e-basedpyrightreports0 errors, 0 warnings, 0 notesType
✅ Test
Changes
Adds
EXPECT_RUSTtotests/e2e/e2e_config.py, read fromE2E_EXPECT_RUSTin the same module-level style as the suite's other env-derived settings, and asserts thex-litellm-rustresponse marker inside_assert_streamed_okin the Azure Foundry Messages e2e test when it is setThe assertion is opt-in because the same suite image runs against both the standard gateway (which has no Rust path and must keep passing) and the Rust gateway (which must fail if it is not actually running Rust). The two deployments are already separate ArgoCD Applications, so this is one value on the Rust instance rather than any branching inside the tests
Scoped to the streamed assertions because
StreamingResponsealready carries response headers, so no harness change is needed. The non-streaming path returnsResult[AnthropicMessagesResponse], which does not surface headers; plumbing that through would be a larger change for the same signal, since a missing extension takes out streaming and non-streaming alikeQA runbook
tests/e2e/llm_translation/test_messages_azure_foundry_e2e.py::TestAzureFoundryMessages::test_basic_stream - a streamed Messages call against a gateway declared to be running Rust must carry the Rust marker, and the run must fail if the gateway quietly fell back to Python
E2E_EXPECT_RUST=1/v1/messagesrequest for anazure_ai/<claude>deployment and confirm HTTP 200 withcontent-type: text/event-streamand anx-litellm-rust: trueresponse headerx-litellm-rustmarkerE2E_EXPECT_RUSTand re-run against that same fallback gateway: the test must PASS again, proving the assertion is inert for non-Rust deploymentstests/e2e/llm_translation/test_messages_azure_foundry_e2e.py::TestAzureFoundryMessages::test_tool_use_stream - the same guarantee holds for the streamed tool-use path, which shares the helper
E2E_EXPECT_RUST=1, send a streamed/v1/messagesrequest carrying theget_weathertool and confirm the stream reachesmessage_stopand carriesx-litellm-rust: trueFinal Attestation