Repository navigation
Clean up ServerArgs post-init dispatch - #30186
Conversation
There was a problem hiding this comment.
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"]: | |||
There was a problem hiding this comment.
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.
| 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"]: |
2d4a279 to
b087bcd
Compare
b087bcd to
e4d21c2
Compare
Summary
Tests
CI States
Latest PR Test (Base): ✅ Run #28759105008
Latest PR Test (Extra): ✅ Run #28762676324