Skip to content

Fix sgl-router silently parse selector wrongly causing OME fail to discover pods#14359

Merged
fzyzcjy merged 5 commits intosgl-project:mainfrom
fzyzcjy:feat/router_warn
Dec 4, 2025
Merged

Fix sgl-router silently parse selector wrongly causing OME fail to discover pods#14359
fzyzcjy merged 5 commits intosgl-project:mainfrom
fzyzcjy:feat/router_warn

Conversation

@fzyzcjy
Copy link
Copy Markdown
Collaborator

@fzyzcjy fzyzcjy commented Dec 3, 2025

Motivation

this will not discover pods

        - --selector
        - component=engine ome.io/inferenceservice=$(INFERENCESERVICE_NAME)

Modifications

Accuracy Tests

Benchmarking and Profiling

Checklist

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @fzyzcjy, 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 sgl-router's argument parsing logic. Previously, the router would incorrectly handle the --selector argument if it was provided as a single string containing multiple space-separated key-value pairs. This silent misinterpretation led to failures in pod discovery for the Open Model Engine (OME). The change introduces a specific check and correction mechanism to properly parse such selector strings, ensuring that pods can be discovered as intended.

Highlights

  • Selector Parsing Fix: Corrected an issue where the sgl-router would silently misinterpret the --selector argument when it contained multiple key-value pairs separated by spaces within a single string.
  • Pod Discovery: Resolved a root cause for OME (Open Model Engine) failing to discover pods due to the previously incorrect selector parsing.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

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

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 aims to fix an issue where selectors are parsed incorrectly. The proposed change attempts to handle space-separated selector arguments. However, the implementation is placed in a method where it will not be executed due to the program flow, and the logic itself is incomplete. I've provided a critical review comment with a detailed explanation and a suggested fix to correctly implement the intended behavior.

Comment thread sgl-router/bindings/python/sglang_router/router_args.py Outdated
@fzyzcjy
Copy link
Copy Markdown
Collaborator Author

fzyzcjy commented Dec 3, 2025

/gemini review

Copy link
Copy Markdown
Contributor

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

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 addresses an issue where sgl-router fails to parse selectors provided as a single space-separated string, which is a common pattern in Kubernetes configurations. The fix involves detecting this format and splitting the string into individual selector items. The change is accompanied by a unit test that validates both the original multi-argument format and the new single-string format, ensuring backward compatibility and correctness of the fix. I have one suggestion to make the implementation slightly more robust.

Comment thread sgl-router/bindings/python/sglang_router/router_args.py
@fzyzcjy
Copy link
Copy Markdown
Collaborator Author

fzyzcjy commented Dec 3, 2025

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci label Dec 3, 2025
This reverts commit 8a2ea1d.
@fzyzcjy fzyzcjy merged commit df026bb into sgl-project:main Dec 4, 2025
56 checks passed
tom-jerr pushed a commit to tom-jerr/sglang that referenced this pull request Dec 4, 2025
yingluosanqian pushed a commit to yingluosanqian/sglang that referenced this pull request Dec 4, 2025
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 5, 2025
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 5, 2025
yuchengz816-bot pushed a commit to yuchengz816-bot/sglang that referenced this pull request Dec 8, 2025
Kevin-XiongC pushed a commit to novitalabs/sglang that referenced this pull request Dec 9, 2025
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 12, 2025
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 12, 2025
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants