Repository navigation
test(providers): compare sagemaker embedding bodies exactly and assert caller encoding wins - #51536
Merged
mateo-berri merged 1 commit intoNov 13, 2026
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
PR overviewNo security issues were found in this pull request. Reviews
|
mateo-berri
enabled auto-merge (squash)
November 13, 2026 03:08
mateo-berri
deleted the
litellm_flakeheal_20261113_test_container_outage_errors_reach_the_c
branch
November 13, 2026 03:21
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Handwritten 1-3 sentence description
Two SageMaker embedding wire tests failed in the scheduled integration runs after #51335 changed how the request body is assembled. One compared request bodies as raw text, so it broke when the same fields came out in a different order, and the other still expected the old rule where deployment extra body settings beat the caller's encoding format, which #51335 deliberately reversed. This PR compares the parsed bodies exactly and updates the second test to assert the new intended precedence
Details
Link to Devin session: https://app.devin.ai/sessions/0018b787be4347e394bc450ca32e1f1e
Open in Devin Desktop: https://app.devin.ai/desktop/session/0018b787be4347e394bc450ca32e1f1e?variant=devin
Requested by: @mateo-berri
TLDR
Problem this solves:
How it solves it:
CI evidence: outage test job (failed 3 times), precedence test job (failed 1 time)
Mechanism: the outage assertion compared serialized JSON including key order, and #51335 changed body assembly order; the precedence assertion was a stale expectation of the deliberate change in #51335
Fix: exact dictionary equality for the outage bodies, and the precedence test now asserts
encoding_format=base64and is renamedtest_callers_encoding_format_wins_over_deployment_extra_bodyScreenshots / Proof of Fix
E2E exception at a013eff: test-only change, proven with the integration rig at 1 worker (
INTEGRATION_WORKERS=1 uv run --no-sync python tests/integration/run.py providers <node-or-file>, retries off)make lint: exit 0Full evidence
Heal A evidence
Only tests/integration/providers/test_sagemaker_embedding_wire.py changes
Every outage attempt is parsed with the existing JSON-object helper and compared to the exact input/model dictionary, so key order no longer matters and extra or missing fields still fail
The precedence test now expects the caller's mapped encoding_format=base64 to win over deployment extra_body= float, matching intentional change #51335
Renamed test: test_callers_encoding_format_wins_over_deployment_extra_body
Branch: litellm_flakeheal_20261113_test_container_outage_errors_reach_the_c
Pushed tip: a013eff
Original tested main: 78db4f1
Rebased main: 865eb25
Rig
Worker count 1 reproduced both failures, so no escalation to 4 or 8 was needed
Used Python 3.12.16, local PostgreSQL 14.24, the CI-pinned Redis 7.2.16 binary, the real proxy, and scripted upstreams
The first proxy startup failed because the stale environment's editable proxy-extras installation pointed to a removed path
One repair with make install-test-deps completed successfully and the rig then became ready
Local differences from the full CI sandbox: host PostgreSQL instead of the CI PostgreSQL 16 container, a dedicated Redis port 6389 to avoid touching the existing Redis service, and no cgroup egress firewall
Setup and logs are preserved in /home/ubuntu/scratchpad/heal-A
Setup commands and environment
Run from /home/ubuntu/repos/litellm
The saved env.sh exports these synthetic integration settings
Upstream and proxy were launched in separate shells with env -i, carrying only the above settings needed by each service
Readiness and retry configuration
Observed output
The existing owned-proxy helper also injects num_retries=0 into its private configuration and run.py disables both pytest retry plugins
Red before the fix
All verification commands below ran from the repository root after sourcing /home/ubuntu/scratchpad/heal-A/env.sh
All three commands exited 1 with the same assertion failures as CI
The outage failures show identical model/input values serialized in the opposite key order
The precedence failure shows encoding_format=base64 instead of the stale float expectation
The unchanged whole-file run has no unrelated failures
Green after the fix
The final patch keeps the original SDK call and exact returned-vector assertion unchanged
An initial attempt also passed encoding_format=base64 explicitly, which made the SDK return an encoded string and caused one failure before the wire assertion
That unnecessary call edit was removed before all final verification below
Every command exited 0, covering both functions in every repetition and all three outage parameters
Temporary product mistakes caught by the tests
Only for this sensitivity check, litellm/llms/sagemaker/completion/handler.py was temporarily changed, then restored exactly
First mutation added an unexpected request field to the serialized embedding body
Exit 1 at the new exact parsed-JSON assertion in all three cases
After restoring that mutation, the second mutation merged deployment extra_body after transformed parameters
Exit 1 at the new exact precedence assertion
Restored product code, checked its diff was empty, and ran both selected functions again
Both commands exited 0
Lint, rebase, and push
Exit 0 after the normal machine-wide gate queue and dependency setup
The large product type-error total is the repository's existing ceiling check, not a claim of zero product type errors
The target-file history query returned no commits, so the conditional five unchanged-main reruns were not required
Incoming main changes were limited to customer-budget UI code and Together model pricing, with no SageMaker or integration-harness changes
The tested content was unchanged by the rebase
Only the requested test file differs from origin/main
Final git status contains only the pre-existing untracked litellm-rust/ directory
No product changes remain, no PR was opened, no labels were added, and no other workflow runs were touched
No workflow dispatch was needed because both failures reproduced locally
Stopped the owned proxy, upstream, and dedicated Redis after verification, leaving the host PostgreSQL and pre-existing Redis service alone
Type
✅ Test