Skip to content

Clean up ServerArgs post-init dispatch - #30186

Merged
merrymercy merged 2 commits into
mainfrom
lianmin/cleanup-server-args
Jul 6, 2026
Merged

merrymercy merged 2 commits into
mainfrom
lianmin/cleanup-server-args

Conversation

@merrymercy

@merrymercy merrymercy commented Jul 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Move the ServerArgs dummy-model short-circuit earlier.
  • Hide RunAI object-store path handling behind a general model-source path handler.
  • Move load-balance normalization into the later parallelism area and move inline validations/mutations into existing related handlers.
  • Update dummy-model unit tests to exercise specific handlers directly.

Tests

  • python3 -m py_compile python/sglang/srt/server_args.py test/registered/unit/server_args/test_server_args.py test/registered/unit/managers/test_mm_process_config.py
  • git diff --check
  • PYTHONPATH=python python3 test/registered/unit/server_args/test_server_args.py (blocked: ModuleNotFoundError: No module named 'numpy')

CI States

Latest PR Test (Base): ✅ Run #28759105008
Latest PR Test (Extra): ✅ Run #28762676324

@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 refactors the __post_init__ method of ServerArgs to follow dispatcher-style principles, modularizing validation and configuration steps into dedicated helper methods and moving the dummy-model early return higher up. Unit tests are updated accordingly to invoke these specific handler methods directly. The feedback recommends adding a defensive check for self.model_path to prevent a potential AttributeError if it is None or empty when calling .lower().

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@@ -2622,58 +2642,36 @@ def __post_init__(self):
# _handle_model_specific_adjustments never runs.
self._resolved_overrides = []

self._maybe_download_model_for_runai()
if self.model_path.lower() in ["none", "dummy"]:

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.

medium

If self.model_path is programmatically initialized to None or is empty, calling .lower() on it will raise an AttributeError. To enforce defensive programming and handle potential null/empty values gracefully, consider adding a guard check or raising a clear ValueError if self.model_path is not set.

Suggested change
if self.model_path.lower() in ["none", "dummy"]:
if not self.model_path:
raise ValueError("model_path must be specified and cannot be empty or None.")
if self.model_path.lower() in ["none", "dummy"]:

@merrymercy merrymercy added the run-ci CI: run the baseline test suite on this PR label Jul 5, 2026
@merrymercy
merrymercy force-pushed the lianmin/cleanup-server-args branch from 2d4a279 to b087bcd Compare July 5, 2026 23:41
@merrymercy
merrymercy force-pushed the lianmin/cleanup-server-args branch from b087bcd to e4d21c2 Compare July 5, 2026 23:47
@merrymercy
merrymercy merged commit 24c42c9 into main Jul 6, 2026
222 of 247 checks passed
@merrymercy
merrymercy deleted the lianmin/cleanup-server-args branch July 6, 2026 06:05
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bypass-fastfail run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant