Skip to content

[Bugfix][Router] dispatch PriorityRouter in proxy_multipart_request - #1095

Open
chrikrah wants to merge 1 commit into
vllm-project:mainfrom
chrikrah:fix/priority-router-multipart
Open

chrikrah wants to merge 1 commit into
vllm-project:mainfrom
chrikrah:fix/priority-router-multipart

Conversation

@chrikrah

Copy link
Copy Markdown
Contributor

PriorityRouter.route_request is async and takes request_json (routing_logic.py:917). route_general_request lists PriorityRouter in both of its isinstance tuples, at request.py:583 and :637. proxy_multipart_request lists it in neither of its branches, at :1290 and :1306. So it falls through to the synchronous else at :1315, which passes four positional arguments where the method takes five.

That call sits outside the try at :1324. The TypeError therefore escapes as a bare 500 on /v1/audio/transcriptions, /v1/audio/translations and /v1/images/edits, for every request, whenever the router runs with --routing-logic priority.

FAILED src/tests/test_multipart_proxy.py::test_audio_translation_routes_under_every_routing_logic[priority]
E  TypeError: PriorityRouter.route_request() missing 1 required positional argument: 'request_json'
   src/vllm_router/services/request_service/request.py:1315: TypeError

A stopgap, not the fix

#1021 corrected the identical omission for SessionRouter. While that sat in review, #1022 wrote down what would happen next: the dispatch "will break silently whenever a new router is added". PriorityRouter merged in #996 on 2026-08-18, after #1022 drew its table. It reached the two route_general_request call sites and not this one.

#1020 proposed this dispatch before #1021 merged it. Its tuple names three routers, predates PriorityRouter, and now conflicts. #1023 answers #1022 by removing the isinstance dispatch. That makes this line unnecessary rather than wrong. Both #1022 and #1023 have sat idle since 2026-07-29, and main returns 500 today, so one line can land now and #1023 deletes it later.

Test

test_multipart_proxy.py hard-coded ROUND_ROBIN, the one routing logic the else branch handles correctly. Its router_client helper now takes the routing logic and defaults to ROUND_ROBIN, so the existing four tests do not change. One new test runs the translation path under both.

$ python -m pytest src/tests/test_multipart_proxy.py -q
6 passed in 7.16s

$ python -m pytest src/tests/ -q
233 passed in 15.00s

Revert the production line, keep the test, and the priority case fails with that TypeError while the round-robin case passes.

Limits

The same dispatch line covers the two image and transcription endpoints, and no new test covers them, because the existing harness stands up only the audio path. No live vLLM backend ran. The backend here is the aiohttp test server the file already uses.


  • Make sure the code changes pass the pre-commit checks.
  • Sign-off your commit by using -s when doing git commit
  • Try to classify PRs for easy understanding of the type of changes, such as [Bugfix], [Feat], and [CI].

PriorityRouter.route_request is async and takes request_json, and
route_general_request lists it in both of its isinstance tuples, at lines 583
and 637. proxy_multipart_request lists it in neither of its branches, so it
falls through to the synchronous else at line 1315 and is called with four
positional arguments instead of five.

The call sits outside the try that begins at line 1324, so the TypeError
escapes as a bare 500 on /v1/audio/transcriptions, /v1/audio/translations and
/v1/images/edits, for every request, whenever the router runs with
--routing-logic priority.

PriorityRouter merged in vllm-project#996 after vllm-project#1021 had already fixed the same omission
for SessionRouter, and vllm-project#1022 predicted this while that fix was being made:
"will break silently whenever a new router is added". vllm-project#1023 answers vllm-project#1022 by
removing the isinstance dispatch entirely, which makes this line unnecessary
rather than wrong; both have been idle since 2026-07-29 and main is broken
today, so this is the one-line stopgap.

test_multipart_proxy.py hard-coded ROUND_ROBIN, the one logic that works. Its
router_client helper now takes the routing logic, defaulting to ROUND_ROBIN so
the existing four tests are unchanged, and one new test runs the translation
path under ROUND_ROBIN and PRIORITY. With the production line reverted the
priority case fails with the TypeError above and the round-robin case passes.

Signed-off-by: chrikrah <[email protected]>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for PriorityRouter in proxy_multipart_request by including it in the isinstance check. It also updates the test suite with a new parameterized test to verify that audio translation requests route correctly under both round-robin and priority routing configurations. There are no review comments, so I have no feedback to provide.

@Shaoting-Feng Shaoting-Feng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for your PR. Would you be interested in doing the root-cause fix as a follow-up PR? vllm-project/production-stack#1023 has been conflicting since 07/29/26 and the author hasn't responded to the rebase request, so it'd be good to have someone pick it up.

@chrikrah

Copy link
Copy Markdown
Contributor Author

Yes, happy to take it on, and sorry for the slow reply.

On credit first. #1023 is @Mohith26's design. I would rebase their commits rather than rewrite them, keep them as author with a Co-authored-by trailer, and open it as a separate pull request closing #1022. If they come back and want it, it is theirs.

On scope: #1023 keeps the DisaggregatedPrefill* isinstance checks, because those dispatch to different request handlers and not to route_request variants. Hold that boundary, or fold the disaggregated paths in too?

Once it lands, the isinstance addition here is dead code and the guard can go entirely.

This branch has not been deployed

No deployments
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.

2 participants