Skip to content

Conversation

@dubejf
Copy link
Contributor

@dubejf dubejf commented Aug 29, 2025

Purpose

Per --help, the argument parser for the vllm CLI and the api_server entry point both accept the --config command-line argument, but only the CLI handles it correctly. This PR ensures consistent config file handling for all entry points.

Examples:

  • vllm serve --config config.yaml
    ✅ Works as expected

  • docker run <docker_arguments> vllm/vllm-openai --config config.yaml
    api_server.py: error: argument --config: expected one argument

  • python3 -m vllm.entrypoints.openai.api_server --config config.yaml
    api_server.py: error: argument --config: expected one argument

Cause:
_pull_args_from_config expects the first argument to always be a vllm CLI subcommand (serve, chat, complete, etc.), which is not the case for api_server.

This leads to incorrect expansion:

--config config.yaml <other_cli_args>

is mistakenly expanded to:

--config --arg1 value-from-config --arg2 value-from-config ... <other_cli_args>

instead of:

--arg1 value-from-config --arg2 value-from-config ... <other_cli_args>

Test Plan

Test Result

  • The new unit tests pass.
  • Existing tests for CLI config override (in tests/utils_/test_utils.py) already cover configuration file expansion in the vllm serve context; no changes required.

Essential Elements of an Effective PR Description Checklist
  • [ x] The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • [x ] The test plan, such as providing test command.
  • [x ] The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors.

You ask your reviewers to trigger select CI tests on top of fastcheck CI.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

Copy link
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 fixes a bug where the --config command-line argument was not properly handled when using the api_server.py entrypoint directly. The root cause was correctly identified: the argument parser expected a subcommand which is not always present. The fix introduces a new conditional branch to handle this specific case by checking if the first argument is an option. This change is well-contained and effective. Additionally, new unit tests have been added to cover the fixed behavior, including argument overrides, which strengthens the codebase. The overall change is solid and well-implemented.

Copy link
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing!

@DarkLight1337 DarkLight1337 added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 29, 2025
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) August 29, 2025 15:28
Jean-Francois Dube added 2 commits August 29, 2025 12:51
Signed-off-by: Jean-Francois Dube <dubejf+gh@gmail.com>
Signed-off-by: Jean-Francois Dube <dubejf+gh@gmail.com>
auto-merge was automatically disabled August 29, 2025 16:51

Head branch was pushed to by a user without write access

@dubejf dubejf force-pushed the fix-cli-config-api-server branch from 11916bf to 2358195 Compare August 29, 2025 16:51
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) August 29, 2025 23:49
@vllm-bot vllm-bot merged commit 5b31cb1 into vllm-project:main Aug 30, 2025
34 of 38 checks passed
eicherseiji pushed a commit to eicherseiji/vllm that referenced this pull request Sep 9, 2025
…roject#23944)

Signed-off-by: Jean-Francois Dube <dubejf+gh@gmail.com>
Co-authored-by: Jean-Francois Dube <dubejf+gh@gmail.com>
Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
FeiDaLI pushed a commit to FeiDaLI/vllm that referenced this pull request Sep 25, 2025
…roject#23944)

Signed-off-by: Jean-Francois Dube <dubejf+gh@gmail.com>
Co-authored-by: Jean-Francois Dube <dubejf+gh@gmail.com>
Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants