Skip to content

[BugFix][Frontend] Load reasoning parser plugins in headless mode - #14651

Closed
QwertyJack wants to merge 1 commit into
vllm-project:mainfrom
QwertyJack:fix/headless-reasoning-parser-plugin
Closed

QwertyJack wants to merge 1 commit into
vllm-project:mainfrom
QwertyJack:fix/headless-reasoning-parser-plugin

Conversation

@QwertyJack

@QwertyJack QwertyJack commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it?

This PR adds a temporary platform monkey patch for custom reasoning parser plugins in headless mode. Upstream vLLM creates VllmConfig before importing --reasoning-parser-plugin on the headless path, so reasoning token initialization raises KeyError before workers start.

The patch imports the configured plugin before the original VllmConfig.__post_init__ only when the requested parser is not already registered. This keeps the regular API server and programmatic parser registration behavior unchanged. It also fails explicitly if the private VllmConfig.__post_init__(self) contract changes.

Fixes #14573.

Upstream issue: vllm-project/vllm#53072

Does this PR introduce any user-facing change?

Yes. Ascend headless DP ranks can start with a custom --reasoning-parser-plugin instead of failing with KeyError during engine config creation.

How was this patch tested?

  • python -m pytest -q tests/ut/patch/platform/test_patch_reasoning_parser_plugin.py tests/ut/test_platform.py: 72 passed, 1 skipped

  • bash format.sh ci: passed

  • Manual headless startup with Qwen3-0.6B, DP size 2, local DP size 1, and start rank 1 reached Launching 1 data parallel engine(s) in headless mode without the former parser KeyError. The process was then stopped because the DP head was intentionally absent.

  • vLLM main: vllm-project/vllm@ba07e4a

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.


Tip

💡 Consider Linking a Related Issue or RFC

Your PR title contains the [BugFix] tag, indicating a bug fix or new feature.

Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:

  • Fixes #<issue_number>
  • Closes #<issue_number>
  • Resolves #<issue_number>
  • Refs #<rfc_or_issue_number> (for RFCs)

🙏 Thanks for helping us keep the project well-organized!

@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 KeyError encountered during headless mode initialization in vLLM when using custom reasoning parser plugins. By intercepting the VllmConfig initialization, the patch ensures that necessary plugins are loaded before token ID resolution occurs. This fix enables Ascend headless data parallel ranks to start correctly with custom configurations.

Highlights

  • Monkey Patch Implementation: Introduced a temporary monkey patch for VllmConfig.__post_init__ to ensure reasoning parser plugins are imported before engine configuration in headless mode.
  • Registration Safety: Added logic to skip plugin imports if the parser is already registered, maintaining compatibility with standard API server and programmatic workflows.
  • Contract Validation: Implemented a runtime check to validate the VllmConfig.__post_init__ signature, ensuring the patch fails explicitly if upstream vLLM changes its internal contract.
New Features

🧠 You can now enable Memory (public preview) 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.

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 the 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 counterproductive. 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.

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. ↩

@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

Suggested PR Title:\n\nmarkdown\n[Ops][BugFix] Patch reasoning parser plugin import in VllmConfig post-init\n\n\nSuggested PR Summary:\n\nmarkdown\n### What this PR does / why we need it?\nThis PR adds a patch to `VllmConfig.__post_init__` to import the configured reasoning parser plugin before the original initialization resolves reasoning token IDs. This fixes an issue where `vllm serve --headless` fails because the custom reasoning parser is not registered in time.\n\nFeedback: A potential `AttributeError` was identified in `patch_reasoning_parser_plugin.py` where `vllm_config.structured_outputs_config` is accessed directly without checking if it is `None`. A defensive check should be added to prevent server startup crashes.\n\n### Does this PR introduce _any_ user-facing change?\nNo.\n\n### How was this patch tested?\nNew unit tests were added in `tests/ut/patch/platform/test_patch_reasoning_parser_plugin.py` to cover import behavior, skip conditions, and contract drift validation.\n

Comment thread vllm_ascend/patch/platform/patch_reasoning_parser_plugin.py Outdated
@QwertyJack QwertyJack added ready bug Something isn't working pd-disaggregation labels Aug 20, 2026
@wangxiyuan wangxiyuan removed the ready label Aug 20, 2026
@QwertyJack
QwertyJack force-pushed the fix/headless-reasoning-parser-plugin branch from e750559 to 7b987e3 Compare September 1, 2026 08:12
Import missing custom reasoning parser plugins before VllmConfig post-initialization so headless DP ranks can resolve parser token IDs.

Signed-off-by: QwertyJack <7554089+QwertyJack@users.noreply.github.com>
@QwertyJack
QwertyJack force-pushed the fix/headless-reasoning-parser-plugin branch from 7b987e3 to 284147a Compare September 1, 2026 08:32
@kunpengW-code kunpengW-code added the ready-precise run selected e2e test for pr label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@QwertyJack

Copy link
Copy Markdown
Collaborator Author

Closed by #18229

@QwertyJack QwertyJack closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working merge-conflicts module:tests pd-disaggregation ready-precise run selected e2e test for pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Salve node can not be booted when using --reasoning-parser-plugin setting up reasoning parsers

3 participants