Fix test_return_routed_experts to use response-level sglext#18274
Fix test_return_routed_experts to use response-level sglext#18274Kangyan-Zhou merged 1 commit intomainfrom
Conversation
PR #17648 moved the sgl_ext field from choices[0] to the response level and renamed it to sglext. The test was not updated accordingly, causing CI failures. Changes: - Access response.get("sglext") instead of choices[0].get("sgl_ext") - Update field name from sgl_ext to sglext (no underscore) Failure example: https://github.com/sgl-project/sglang/actions/runs/21653054987/job/62421861711
|
/rerun stage-c-test-large-4-gpu |
Summary of ChangesHello @alisonshao, 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 resolves a critical CI failure by updating a test case that extracts routed experts from an OpenAI response. The core issue stemmed from a recent API modification where the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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
|
|
/rerun-stage stage-c-test-large-4-gpu |
|
✅ Triggered |
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a test that was failing due to a recent API change where sglext was moved to the response level. The change is straightforward and addresses the issue described. I've added one suggestion to improve the robustness of the data extraction logic in the test, making it less brittle to unexpected response formats.
| sglext = response.get("sglext", None) | ||
| if sglext is None: | ||
| raise ValueError("OpenAI response missing sglext.") | ||
| routed_experts = sglext.get("routed_experts", None) | ||
| if routed_experts is None: | ||
| raise ValueError("OpenAI response sgl_ext missing routed_experts.") | ||
| raise ValueError("OpenAI response sglext missing routed_experts.") |
There was a problem hiding this comment.
The current implementation for extracting routed_experts could be more robust. If sglext exists but is not a dictionary (e.g., a string), the call to sglext.get() on line 222 would raise an AttributeError. It's better to validate the type of sglext to provide a clearer error message and handle malformed responses gracefully. This also makes the code slightly more concise.
| sglext = response.get("sglext", None) | |
| if sglext is None: | |
| raise ValueError("OpenAI response missing sglext.") | |
| routed_experts = sglext.get("routed_experts", None) | |
| if routed_experts is None: | |
| raise ValueError("OpenAI response sgl_ext missing routed_experts.") | |
| raise ValueError("OpenAI response sglext missing routed_experts.") | |
| sglext = response.get("sglext") | |
| if not isinstance(sglext, dict): | |
| raise ValueError("OpenAI response missing or has an invalid 'sglext' field.") | |
| routed_experts = sglext.get("routed_experts") | |
| if routed_experts is None: | |
| raise ValueError("OpenAI response 'sglext' is missing 'routed_experts'.") |
|
Apologies @Kangyan-Zhou and @alisonshao - I should have caught this. Thank you for the fix |
Summary
test_return_routed_experts.pyto accesssglextat response level instead ofsgl_extin choicesPR #17648 moved the
sgl_extfield fromchoices[0]to the response level and renamed it tosglext(no underscore). The test was not updated accordingly, causing CI failures.Test plan
stage-c-test-large-4-gpusuite🔗 Failure example