Repository navigation
chore(release): v1.103.6 patch - #47522
Merged
Merged
Conversation
…t and policy close (#42388) * fix(realtime): surface an upstream handshake refusal as an error event and policy close Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(realtime): tidy the handshake refusal e2e Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(realtime): keep upstream exception text out of the Azure client error Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor(realtime): map handshake refusal close codes with a lookup Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 2bab39e)
…s imports (#42624) The two redaction tests raised the deprecated InvalidStatusCode, which the websockets 15 asyncio client never raises, and asserted the raw 403 close code that the handshake refusal path replaced with 1008. The refusal path builds its close reason from the status code alone, so there is no secret to redact there, and the handshake refusal tests already cover the error event and the 1008 close. Those refusal tests only passed when run after a sibling test had imported websockets.asyncio.client, since websockets lazy-loads its exceptions submodule. Importing InvalidStatus, Response, and Headers from their own submodules makes them pass in any order. Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> (cherry picked from commit 38f0eb8)
…chat to Responses bridge (#44508) * fix(logging): claim the async success dedup flag before the first await Nested @client wrappers on the chat -> Responses bridge schedule two async success tasks on one logging object. The dedup flag was checked at the top of _async_success_handler_body but only set after several awaits; the worker-thread base64 offload for messages >= 256 KiB yields there, so the second task passed the same check and the request was logged twice (two SpendLogs rows, key/team/daily spend counted twice). Fixes #44500 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(logging): serialise async success handlers per logging object instead of claiming early Claiming the dedup flag before the first await (previous commit) let a first handler that is cancelled before its callbacks run (e.g. by the logging worker's per-coroutine timeout) suppress the second one, losing the request's success accounting. Serialise non-streaming handlers on the same Logging object with an asyncio.Lock kept in a module-level WeakKeyDictionary: the second handler waits, then skips if the first logged, or logs itself if the first raised or was cancelled first. Streaming chunk logging is not locked. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(integration): pin one spend row and one key charge for large bridged chat completions Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): wait for the large request's spend row before asserting Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(logging): use fixed timestamps in async success dedup tests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * style(logging): trim the async success dedup lock comment Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(logging): reset background interaction dedupe under the success dedup lock Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(logging): use a fixed start time in the interactions logging helper Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: claim the async success log at schedule time instead of locking the handler Nested @client wrappers (chat over the Responses bridge, Anthropic Messages over the chat adapter) exit with one shared Logging object and each queued their own async success handler. The handler checked has_logged_async_success before its awaited work and set it after, so both could pass the check and the request was logged and billed twice. _schedule_async_success_logging now claims the log on the Logging object synchronously through claim_async_success_log, and a later wrapper returns without enqueuing. There is no await between the check and the decision, so no lock is needed. The per-object asyncio.Lock, the WeakKeyDictionary that held it and the locked block in async_log_background_interaction_completion are gone. Tests: the regression test moves to tests/unit/test_utils.py and drives two _dispatch_success_logging exits with one Logging object through the logging worker, asserting one log with the inner result. It fails without the claim. The cancelled-handler test is dropped since a second wrapper no longer retries. The background interaction completion test stays. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(logging): pin the background completion event order and name the innermost wrapper in the claim docstrings Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): send one bridged request and assert the inner Responses result is the logged one Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: kerry <kerry@berri.ai> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 157d96d)
litellm 1.103.5 already shipped, so the next release off this line is 1.103.6
yuneng-berri
had a problem deploying
to
e2e-changed
October 20, 2026 08:31 — with
GitHub Actions
Error
|
|
yuneng-berri
marked this pull request as ready for review
October 20, 2026 16:08
klu-berri
approved these changes
Oct 20, 2026
This branch was successfully deployed
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.
TLDR
Problem this solves:
stable/1.103.xis missing 2 fixes from main that stable/1.102.x already shipsHow it solves it:
-xcherry-pick per main PR, in main merge order, plus 1 test-only prerequisiteIntentional product change: a refused upstream realtime handshake now sends an error event and closes 1008, 1013 or 1011, instead of a bare 1011 or 1006 close with no event
Backport
c66597f432, adaptedfb0f3b693a, verbatim (added prerequisite)cd788ce1aa, adaptedfe02b14e96bumps litellm 1.103.5 -> 1.103.6, since 1.103.5 already shippedAdded prerequisites
assert 1011 == 403at the pick). test(realtime): drop legacy InvalidStatusCode tests and pin websockets imports #42624 is main's own fix for exactly those tests and changes no product codeAdaptation notes
#42388
close_after_upstream_handshake_refusalwrapswebsocket.close()on this line. Without it, a client that hangs up while the upstream handshake is pending makes the close raise, and the Router retries the refused handshake. A local proxy pointed at an upstream that refuses with 401 opened 3 upstream handshakes per client connection with the unwrapped close and 1 on the line tipRuntimeError#42388 interdiff against main 2bab39e
#44508 has context-only divergences, the fix's own lines are byte-for-byte main's
claim_async_success_logis stillhas_run_loggingon this line (main renamed itmark_logging_complete), so it stays and the new method sits in front of it, same as the stable/1.102.x backporttests/test_litellm/on this line. Both test files hit empty-HEAD append conflicts, so each was reset to the line's copy and only the PR's own lines were appendedtests/integration/contracts.jsonwith itscoversmarker, since this line enforces that manifest at collection and main no longer doesassert 2 == 1, logged twice) and passes with the pick#44508 interdiff against main 157d96d
Gate
42f52a591b, which differs from the tip only intest_realtime_errors.py, not a cost map testfe02b14e96/v1/responsesbudget reservation in Caveats, not verdict-flippingUser Flow
#42388
Before: a developer connecting to a realtime deployment whose Azure credential is rejected sees the socket vanish with no explanation
wscat -c "wss://litellm-domain/v1/realtime?model=azure-realtime" -H "Authorization: Bearer sk-..."Connected (press CTRL+C to quit)Disconnected (code: 1006, reason: "")After: the same connection tells them exactly what the upstream said and closes cleanly
wscat -c "wss://litellm-domain/v1/realtime?model=azure-realtime" -H "Authorization: Bearer sk-..."Connected (press CTRL+C to quit){"type": "error", "error": {"type": "server_error", "message": "Upstream realtime handshake rejected with HTTP 401"}}Disconnected (code: 1008, reason: "Upstream realtime handshake rejected with HTTP 401")#42624
Before: a contributor running the realtime unit tests on main gets two failures unrelated to their change, and cannot rerun a refusal test on its own
uv run pytest tests/test_litellm/test_redact_string_in_error_paths.py -k realtimeTestOpenAIRealtimeRedaction::test_invalid_status_code_redacts_reasonandTestAzureRealtimeRedaction::test_invalid_status_code_redacts_reasonfail withassert 1011 == 403uv run pytest tests/test_litellm/llms/azure/realtime/test_handler.py::test_async_realtime_upstream_handshake_refusal_sends_error_event_then_policy_closeto look at one refusal test on its ownAttributeError: module 'websockets' has no attribute 'exceptions', though the whole file passesAfter: the same commands pass, and nothing changes for proxy users since only tests move
uv run pytest tests/test_litellm/test_redact_string_in_error_paths.py -k realtimeuv run pytest tests/test_litellm/llms/azure/realtime/test_handler.py::test_async_realtime_upstream_handshake_refusal_sends_error_event_then_policy_close#44508
Before: a developer sends one large chat request and is billed twice in LiteLLM's own accounting
openai/responses/gpt-5.6-lunamodel with ~300k characters of message text, no streamingAfter: the same request is logged once
Relevant issues
Related to #44500, fixed on main by #44508
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreType
🐛 Bug Fix
✅ Test
Caveats (if any)
Medium
fe02b14e96/v1/responseswebsocket handshake keeps its budget reservationLow
claim_async_success_lognow raises on success, real ones are fine/v1/responsesrefusal event says "realtime" and has no status field, same as mainFinal Attestation