[router][grpc] Fix request_id extraction when n > 1#11311
Conversation
Summary of ChangesHello @CatherineSue, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug in the gRPC request manager where the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a bug in grpc_request_manager.py where the request ID was being extracted incorrectly for streaming responses when n > 1. The change correctly modifies the logic to look for request_id at the top level of the response dictionary, instead of a non-existent id field within meta_info. The fix is accurate and improves the code's correctness and clarity. The change is well-contained and I have no further suggestions.
Motivation
When
n>1,grpc_request_manager.pyrelies onrid_to_indexto map the rid to its index.However, the current rid extraction is wrong. As in
_handle_batch_output, rid is stored inoutput_data["request_id"]sglang/python/sglang/srt/entrypoints/grpc_request_manager.py
Lines 564 to 566 in 4ed67c2
Modifications
Accuracy Tests
Before
request.n = 2No index = 1
After
There is index = 1

Benchmarking and Profiling
Checklist