fix: fail fast on invalid serve parsers#4701
Open
CUHKSZzxy wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves robustness of the OpenAI server startup path by validating configured parser names earlier (before expensive engine/model initialization) and by making DP launch behavior fail fast when any child server process fails.
Changes:
- Added
validate_parser_names()to centrally validate reasoning/tool parser registry names (including legacy reasoning aliases) and reused it in bothserve()andResponseParser.set_parsers(). - Updated the DP launcher to surface child failures promptly and proactively terminate remaining server process groups rather than blocking behind
join(). - Added unit tests covering parser name validation and
set_parsers()behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_lmdeploy/serve/parsers/test_parser_config.py | Adds tests for parser-name validation and parser setup error handling. |
| lmdeploy/serve/parsers/response_parser.py | Introduces validate_parser_names() and reuses it in BaseResponseParser.set_parsers(). |
| lmdeploy/serve/parsers/init.py | Re-exports validate_parser_names from the parsers package. |
| lmdeploy/serve/openai/launch_server.py | Improves failure propagation and process-group termination logic for DP server launching. |
| lmdeploy/serve/openai/api_server.py | Validates parser names early in serve() to fail fast before engine startup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+166
to
+170
| alive_processes.remove(process) | ||
| if process.exitcode != 0: | ||
| logger.error(f'Server process {process.pid} exited with code {process.exitcode}') | ||
| terminate_processes(alive_processes) | ||
| raise RuntimeError(f'Server process {process.pid} exited with code {process.exitcode}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tests
python -m py_compile lmdeploy/serve/parsers/response_parser.py lmdeploy/serve/parsers/__init__.py lmdeploy/serve/openai/api_server.py lmdeploy/serve/openai/launch_server.py tests/test_lmdeploy/serve/parsers/test_parser_config.pypytest tests/test_lmdeploy/serve/parsers/test_parser_config.py -qAssistance
Assisted with Codex + GPT-5.5 xHigh Fast, reviewed manually