Skip to content

Fix PoolingParams.skip_reading_prefix_cache type#29364

Merged
noooop merged 1 commit intovllm-project:mainfrom
kflu:main
Nov 25, 2025
Merged

Fix PoolingParams.skip_reading_prefix_cache type#29364
noooop merged 1 commit intovllm-project:mainfrom
kflu:main

Conversation

@kflu
Copy link
Copy Markdown
Contributor

@kflu kflu commented Nov 25, 2025

Summary:

It's annotated as bool but assigned default value None. This makes

msgspec doesn't like it when decoding the request:

msgspec.ValidationError: Expected bool, got None - at $[4][10]

(EngineCore_DP0 pid=494675)   File "vllm/v1/engine/core.py", line 1024, in process_input_sockets
(EngineCore_DP0 pid=494675)     request = add_request_decoder.decode(data_frames)
(EngineCore_DP0 pid=494675)               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(EngineCore_DP0 pid=494675)   File "vllm/v1/serial_utils.py", line 311, in decode
(EngineCore_DP0 pid=494675)     return self.decoder.decode(bufs[0])
(EngineCore_DP0 pid=494675)            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(EngineCore_DP0 pid=494675) msgspec.ValidationError: Expected `bool`, got `None` - at `$[4][10]`

Purpose

Fix PoolingParams.skip_reading_prefix_cache type

Test Plan

Reproducing and validating the fix:

In [16]: from vllm.pooling_params import *
In [17]: import msgspec
In [18]: params = PoolingParams()
In [19]: encoded = msgspec.msgpack.encode(params)
In [20]: encoded
Out[20]: b'\x9d\xc0\xc0\xc0\xc0\xc0\xc0\xc0\xc0\xc0\xc2\xc0\xc0\x02'

In [21]: decoded = msgspec.msgpack.decode(encoded, type=PoolingParams)
---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
Cell In[21], line 1
----> 1 decoded = msgspec.msgpack.decode(encoded, type=PoolingParams)

ValidationError: Expected `bool`, got `None` - at `$[10]`

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • 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.

@kflu kflu requested a review from noooop as a code owner November 25, 2025 02:48
Copy link
Copy Markdown
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 addresses a type annotation bug that causes a msgspec.ValidationError. The fix in vllm/pooling_params.py is correct. However, the same bug exists in vllm/sampling_params.py and was missed. I've added a comment with a suggestion to fix this as well to make the change comprehensive.

@@ -57,7 +57,7 @@ class PoolingParams(
## Internal use only
task: PoolingTask | None = None
requires_token_ids: bool = False
skip_reading_prefix_cache: bool = None
skip_reading_prefix_cache: bool | None = None
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.

high

This correctly fixes the type annotation for skip_reading_prefix_cache. However, a similar issue exists in vllm/sampling_params.py on line 257, where skip_reading_prefix_cache: bool = None will also cause a msgspec.ValidationError. To ensure a complete fix, please update the type annotation in SamplingParams as well.

@github-actions
Copy link
Copy Markdown

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

🚀

@noooop
Copy link
Copy Markdown
Collaborator

noooop commented Nov 25, 2025

Thanks for this fix.

  • Please update the type annotation in SamplingParams as well.
  • Please make DCO happy

Summary:

It's annotated as bool but assigned default value None. This makes

msgspec doesn't like it when decoding the request:

> msgspec.ValidationError: Expected `bool`, got `None` - at `$[4][10]`

```
(EngineCore_DP0 pid=494675)   File "vllm/v1/engine/core.py", line 1024, in process_input_sockets
(EngineCore_DP0 pid=494675)     request = add_request_decoder.decode(data_frames)
(EngineCore_DP0 pid=494675)               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(EngineCore_DP0 pid=494675)   File "vllm/v1/serial_utils.py", line 311, in decode
(EngineCore_DP0 pid=494675)     return self.decoder.decode(bufs[0])
(EngineCore_DP0 pid=494675)            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(EngineCore_DP0 pid=494675) msgspec.ValidationError: Expected `bool`, got `None` - at `$[4][10]`
```

Signed-off-by: KFL <kludev@gmail.com>
@noooop noooop enabled auto-merge (squash) November 25, 2025 04:19
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Nov 25, 2025
@noooop noooop merged commit ce58fdc into vllm-project:main Nov 25, 2025
44 checks passed
devpatelio pushed a commit to SumanthRH/vllm that referenced this pull request Nov 29, 2025
kitaekatt pushed a commit to kitaekatt/vllm that referenced this pull request Dec 1, 2025
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.

2 participants