Repository navigation
fix(vllm): return 400 for plain context overflow - #3878
Merged
Merged
Conversation
vLLM 0.25 can raise a plain ValueError when a chat prompt exceeds the model context. The embedded endpoint surfaced that as HTTP 500, causing NeMo Gym to retry a deterministic request that cannot succeed. Translate only context-length-shaped ValueErrors to HTTP 400 while preserving all typed VLLMValidationError handling and re-raising unrelated ValueErrors. Keep local clamp errors recognizable by Gym and cover each exception path with unit tests. Signed-off-by: Yi-Fu Wu <[email protected]>
yfw
added a commit
that referenced
this pull request
Sep 2, 2026
Conflicts in vllm_worker_async.py: both sides converted context-length overflow errors to HTTP 400. Kept this branch's version, which keys on the "context length" marker that Gym's vllm_model proxy actually checks and is pinned by tests/unit/models/generation/test_vllm_context_length_overflow.py. Dropped the now-unreachable plain-ValueError handler from #3878 and replaced its test parameter that lacked the marker with the two real vLLM messages. Co-Authored-By: Claude Fable 5.1 <[email protected]>
3 of 4 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.
Summary
ValueErrors into HTTP 400 responsesVLLMValidationErrors and re-raise unrelated plainValueErrorsMotivation
vLLM 0.25 may raise a plain
ValueErrorwhile preprocessing an oversized chat prompt. The embedded NeMo RL server previously surfaced it as HTTP 500, causing NeMo Gym to retry the same request even though it cannot succeed.Validation