Skip to content

[Bugfix] Validate routed-expert prompt offsets before engine submission - #56844

Merged
aoshen02 merged 2 commits into
vllm-project:mainfrom
aoshen02:codex/r3-prompt-offset-validation
Sep 15, 2026
Merged

aoshen02 merged 2 commits into
vllm-project:mainfrom
aoshen02:codex/r3-prompt-offset-validation

Conversation

@aoshen02

Copy link
Copy Markdown
Collaborator

Purpose

Fixes #55750.

Validate 0 <= routed_experts_prompt_start <= prompt_length in InputProcessor, before EngineCore submission. Invalid offsets become validation errors instead of reaching the engine or overflowing MessagePack serialization. An offset equal to the prompt length is valid and returns an empty prompt routing slice.

Only two production files change (net +4 lines): reuse the existing prompt-length calculation for one inline range check, and change the scheduler's boundary assertion from < to <=. No clamping or new helper abstraction.

Existing work and credit

This intentionally consolidates the overlapping fixes in #55764 and #55765 at the submitter's request; it is not a separate bug discovery. Both PRs are still open. Compared with those patches, the range check lives in one place, with no extra helper or scheduler clamping. This is limited to prompt offsets, not the broader validation changes in #51891.

Credit, in order:

  1. @bhushanasati25 — primary author, [Bugfix] Avoid routed-expert metadata crash at prompt boundary #55764.
  2. @meghaagr13 — second co-author, Fix for negative prompt length #55765, including the prompt-end regression test.

Validation

  • Targeted offset tests: 7 passed. With the range check and boundary fix removed, 4 failed / 3 passed, confirming that the tests detect both bugs.
  • Relevant full suites: 202 passed in 121.15s.
  • All applicable pre-commit hooks passed, including mypy and commit sign-off.
  • No GPU/model evaluation was run. This changes input validation and the empty prompt-slice boundary, not model computation. It does not claim to fix the separate ROCm GPU hang seen on a CI retry.

Commands (existing uv-managed Python 3.12 environment with precompiled extensions):

.venv/bin/python -m pytest tests/test_request_input_bounds.py tests/v1/core/test_scheduler.py -k 'routed_experts_offset or routed_experts_prompt_start_at_prompt_end' -q
.venv/bin/python -m pytest tests/test_request_input_bounds.py tests/v1/core/test_scheduler.py tests/v1/engine/test_input_processor_trace_replay.py -q --tb=short
.venv/bin/pre-commit run --files vllm/v1/engine/input_processor.py vllm/v1/core/sched/scheduler.py tests/test_request_input_bounds.py tests/v1/core/test_scheduler.py

Implementation and testing were AI-assisted with Codex. Submitted as a draft pending the human submitter's line-by-line review and test confirmation; attribution does not imply approval of this consolidation by the original authors.

Consolidate the prompt boundary fixes from vllm-project#55764 and vllm-project#55765. Validate the inclusive offset range in InputProcessor before engine submission, and allow an empty prompt routing slice.

Co-authored-by: Megha Agarwal <19240983+meghaagr13@users.noreply.github.com>
Co-authored-by: Codex
Signed-off-by: aoshen02 <aoshen@inferact.ai>
@mergify mergify Bot added bug Something isn't working scheduler labels Sep 14, 2026
@aoshen02 aoshen02 added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 14, 2026
@aoshen02
aoshen02 marked this pull request as ready for review September 14, 2026 14:26

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@aoshen02

Copy link
Copy Markdown
Collaborator Author

/amd-ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite AMD CI #12919 for commit 3e5a8476b6b9.

@aoshen02

Copy link
Copy Markdown
Collaborator Author

/ci run

@aoshen02

Copy link
Copy Markdown
Collaborator Author

/ci run all

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #88846 for commit 3e5a8476b6b9.

@github-actions

Copy link
Copy Markdown

✅ CI is already running for this commit: https://buildkite.com/vllm/ci/builds/88846

@aoshen02

Copy link
Copy Markdown
Collaborator Author

/ci cancel

@github-actions

Copy link
Copy Markdown

✅ Requested cancellation of 1 CI build for codex/r3-prompt-offset-validation: #88846.

@aoshen02

Copy link
Copy Markdown
Collaborator Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #88847 for commit 3e5a8476b6b9.

@aoshen02

Copy link
Copy Markdown
Collaborator Author

@AndreasKaratzas Can I get a stamp?

@aoshen02
aoshen02 enabled auto-merge (squash) September 15, 2026 00:37
@aoshen02
aoshen02 merged commit 84e5f3e into vllm-project:main Sep 15, 2026
131 checks passed
@aoshen02
aoshen02 deleted the codex/r3-prompt-offset-validation branch September 15, 2026 01:36
ItsRoy69 pushed a commit to ItsRoy69/vllm that referenced this pull request Sep 15, 2026
…on (vllm-project#56844)

Signed-off-by: aoshen02 <aoshen@inferact.ai>
Co-authored-by: Bhushan Asati <bhushanasati25@gmail.com>
Co-authored-by: Megha Agarwal <19240983+meghaagr13@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready ONLY add when PR is ready to merge/full CI is needed scheduler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Routed-expert metadata request crashes EngineCore and breaks subsequent requests

3 participants