Repository navigation
Conversation
…treams Responses streaming currently emits response.completed even when max_output_tokens truncates the response and the final payload status is incomplete. Add a vLLM ResponseIncompleteEvent wrapper and select the terminal event from the final response status. Treat response.incomplete as a terminal stored event during background stream replay. Update streaming event helpers and Responses E2E coverage for direct and background truncated streams. Signed-off-by: Ting Sun <suntcrick@gmail.com>
Sunt-ing
requested review from
AndreasKaratzas,
DarkLight1337,
NickLucche,
aarnphm,
chaunceyjiang,
robertgshaw2-redhat and
russellb
as code owners
June 12, 2026 08:09
5 of 6 tasks
Signed-off-by: Ting Sun <suntcrick@gmail.com>
Contributor
Author
|
Closing in favor of #59324, which covers this fix, including the |
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.
Purpose
OpenAI's Responses streaming reference defines
response.completedas the event emitted when the model response is complete, andresponse.incompleteas the event emitted when a response finishes as incomplete. vLLM already builds the final Responses payload withresponse.status == "incomplete"andincomplete_details.reason == "max_output_tokens"when generation stops on the output-token limit, but the streaming path still wraps that payload in aresponse.completedterminal event.This PR makes the terminal event match the final response status:
incompleteemitsresponse.incomplete, and other successful responses keep emittingresponse.completed. It also adds the vLLMResponseIncompleteEventwrapper, updates the streaming event-stack helper so both completed and incomplete are valid terminal response events, and treatsresponse.incompleteas terminal when replaying stored background stream events.Scope: this only handles max-token truncation after the final payload is already
status="incomplete". It does not change generation-error streaming; #40418 and #38190 coverresponse.failedpaths.Test Plan
max_output_tokens=30.background=True, then replay it withretrieve(..., stream=True).Test Result
response.incomplete; payload status isincomplete; reason ismax_output_tokensresponse.incompleteAssertionError: assert 'response.completed' == 'response.incomplete'tests/entrypoints/openai/responses/test_simple.pyReal server E2E details
Environment:
Qwen/Qwen3-8BRemoteOpenAIServer--reasoning-parser qwen3 --max_model_len 5000VLLM_SYSTEM_START_DATE=2023-09-12,VLLM_ENABLE_RESPONSES_API_STORE=1VLLM_USE_FLASHINFER_SAMPLER=0The committed E2E starts a real OpenAI-compatible server and sends a streaming Responses request that is intentionally truncated:
The background replay E2E uses the same truncation trigger with
background=True, then replays the stored stream:With the fix:
After reverting only the source change and keeping the same test:
Additional checks
Commands:
Results:
AI assistance was used to prepare this PR.
cc @sfeng33 @chaunceyjiang