Repository navigation
test(anthropic): expect no output tokens on a /v1/messages attempt dropped before content - #53885
Merged
mateo-berri merged 1 commit intoNov 23, 2026
Conversation
…opped before content Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
mateo-berri
enabled auto-merge (squash)
November 23, 2026 19:15
Contributor
PR overviewNo security issues were found in this pull request. Reviews
|
mateo-berri
deleted the
litellm_flakeheal_20261123_test_every_dropped_attempt_logs_its_own_fai
branch
November 23, 2026 19:24
3 of 5 tasks
1 of 10 tasks
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
Three Anthropic
/v1/messagesretry tests went red on main after #53394 changed how a stream that is cut right after it opens is logged. Such an attempt used to log the 1 output token Anthropic sends as a placeholder when a stream opens, and it now logs 0 because no text arrived. The tests now expect 0 for a dropped connection and still expect 1 when the provider sends an error frame, which did not changeDetails
Link to Devin session: https://app.devin.ai/sessions/cb4bbb904f32462a9692dfeddcebc9e9
Open in Devin Desktop: https://app.devin.ai/desktop/session/cb4bbb904f32462a9692dfeddcebc9e9?variant=devin
Requested by: @mateo-berri
TLDR
Problem this solves:
test_anthropic_messages_pre_content_retry_wire.pyare red on main, each failed 1 of 1 scheduledintegrationruns since fix(responses): bill the provider-reported input on a cut bridged stream #53394completion_tokens1, themessage_startplaceholdermessage_startchunk, so a cut stream now estimates output from the text received, which is 0 hereHow it solves it:
test_superseded_attempt_and_its_retry_each_log_their_own_usagetakes the expected value per case: 0 fortransport-drop, 1 forrecoverable-error-frameRelevant issues
Failing job: https://github.com/BerriAI/litellm/actions/runs/45214198063/job/137830801373
git bisectover the range between the last green and the first red scheduled run, on the whole file, ends at b099ac8 (#53394): its parent 1fdee58 gives39 cases 0 failed, b099ac8 gives39 cases 3 failedScreenshots / Proof of Fix
E2E exception at b9329df: test-only change, run on the integration rig locally with
INTEGRATION_WORKERS=2 python tests/integration/run.py providers <target>and the environmentrun_integration.shsets39 cases 3 failed, the three tests above with the CI errors4 cases 0 failed, five runs in a row39 cases 0 failedanthropic_message_startmark removed fromlitellm/llms/anthropic/chat/handler.py, all four cases fail with the old value (('failure', 5, 1),'completion_tokens': 1). RevertedOpen point for a reviewer: a provider error frame right after
message_startstill logs the placeholder 1, while a dropped connection at the same point logs 0. This PR asserts both as they are today and does not change eitherThis file first runs in CI on main after merge, since integration groups do not run on pull requests
Type
✅ Test