Skip to content

fix(vllm): return HTTP 400 for chat completion context overflow - #3844

Open
jepio wants to merge 1 commit into
mainfrom
jpiotrowski/vllm-http-400-on-overflow
Open

fix(vllm): return HTTP 400 for chat completion context overflow#3844
jepio wants to merge 1 commit into
mainfrom
jpiotrowski/vllm-http-400-on-overflow

Conversation

@jepio

@jepio jepio commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

This PR fixes a contract mismatch between NeMo-RL and NeMo-Gym: when _clamp_max_tokens detects an overflow the ValueError exception results in an HTTP 500 error that Gym retries. Turn it into an VLLMValidationError that Gym sees as HTTP 400 and can immediately treat as a context overflow.

Issues

List issues that this PR closes (syntax):

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

  • ...

_clamp_max_tokens raised ValueError when prompts filled max_model_len,
which bypassed the chat handler and surfaced as HTTP 500. NeMo Gym then
retried the deterministic request instead of treating it as overflow.

Raise VLLMValidationError with a context-length message so the handler
maps it to HTTP 400 that vllm_model recognizes, and add a unit test
for that contract.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@nvidia.com>
@jepio
jepio requested review from a team as code owners August 26, 2026 15:45
@copy-pr-bot

copy-pr-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant