Skip to content

[PD-Disagg][Fix] Remove 'test_external_dp_routing' from Rust Router constructor parameters.#19492

Merged
HaiShaw merged 1 commit intosgl-project:mainfrom
Duyi-Wang:pd_router_fix
Feb 27, 2026
Merged

[PD-Disagg][Fix] Remove 'test_external_dp_routing' from Rust Router constructor parameters.#19492
HaiShaw merged 1 commit intosgl-project:mainfrom
Duyi-Wang:pd_router_fix

Conversation

@Duyi-Wang
Copy link
Copy Markdown
Contributor

cc @hnyls2002

Motivation

test_external_dp_routing param has been introduced in #19268 for minilb test and was not filtered out when transmitted to the Rust implementation. The error occured.

python -m sglang_router.launch_router --pd-disaggregation --port 30000 --policy random --prefill-policy random --decode-policy random --prefill http://10.235.192.132:8000 --decode http://10.235.192.132:8000
Both --prefill-policy and --decode-policy are specified. The main --policy flag will be ignored for PD mode.
Error starting router: Router.__new__() got an unexpected keyword argument 'test_external_dp_routing'
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/opt/venv/lib/python3.10/site-packages/sglang_router/launch_router.py", line 109, in <module>
    main()
  File "/opt/venv/lib/python3.10/site-packages/sglang_router/launch_router.py", line 105, in main
    launch_router(router_args)
  File "/opt/venv/lib/python3.10/site-packages/sglang_router/launch_router.py", line 52, in launch_router
    raise e
  File "/opt/venv/lib/python3.10/site-packages/sglang_router/launch_router.py", line 47, in launch_router
    router = Router.from_args(router_args)
  File "/opt/venv/lib/python3.10/site-packages/sglang_router/router.py", line 312, in from_args
    return Router(_Router(**args_dict))
TypeError: Router.__new__() got an unexpected keyword argument 'test_external_dp_routing'

Modifications

Add it to filter list.

Accuracy Tests

GSM8K test with 1P/1D of DeepSeek R1 TP8

/sgl-workspace/sglang/benchmark/gsm8k# python bench_sglang.py --num-questions 200 --port 8000
Downloading from https://raw.githubusercontent.com/openai/grade-school-math/master/grade_school_math/data/test.jsonl to /tmp/test.jsonl
/tmp/test.jsonl: 732kB [00:00, 20.4MB/s]                                                           
100%|████████████████████████████████████████████████████████████| 200/200 [00:16<00:00, 12.48it/s]
Accuracy: 0.970
Invalid: 0.000
Latency: 16.031 s
Output throughput: 1129.922 token/s

Benchmarking and Profiling

Checklist

Review Process

  1. Ping Merge Oncalls to start the PR flow. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • /tag-run-ci-label, /rerun-failed-ci, /tag-and-rerun-ci
  4. After green CI and required approvals, ask Merge Oncalls to merge.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 runtime error during the router's initialization by preventing a Python-specific test argument from being incorrectly forwarded to the underlying Rust implementation. This ensures the router starts without encountering unexpected keyword argument errors, improving stability and correct argument handling.

Highlights

  • Bug Fix: Resolved a TypeError that occurred when the test_external_dp_routing parameter was unexpectedly passed to the Rust Router constructor, by adding it to the argument filtering list.

🧠 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
  • sgl-model-gateway/bindings/python/src/sglang_router/router.py
    • Added test_external_dp_routing to the list of arguments that are filtered out before being passed to the Rust Router constructor.
Activity
  • Initial review requested by Duyi-Wang, with cc @hnyls2002.
  • Accuracy tests for GSM8K were performed and passed, indicating no regression in model outputs.
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 correctly addresses a TypeError by filtering out the test_external_dp_routing parameter before it's passed to the Rust Router constructor. This resolves the crash described. I've included one suggestion to also filter out shutdown_grace_period_secs, which appears to be another parameter from RouterArgs not handled by the Rust implementation, to prevent a similar issue in the future.

@HaiShaw HaiShaw merged commit 98e433e into sgl-project:main Feb 27, 2026
52 checks passed
@Duyi-Wang Duyi-Wang deleted the pd_router_fix branch March 3, 2026 01:00
magicYang1573 pushed a commit to magicYang1573/sglang that referenced this pull request Mar 9, 2026
Wangzheee pushed a commit to Wangzheee/sglang that referenced this pull request Mar 21, 2026
JustinTong0323 pushed a commit to JustinTong0323/sglang that referenced this pull request Apr 7, 2026
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