[BugFix] Update KV block hash type from BlockHash to ExternalBlockHash in kv_events_subscriber - #26264 #26265
+4
−4
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.
Purpose
Fix type inconsistency in
kv_events_subscriber.py
example by updating block hash type fromBlockHash
toExternalBlockHash
to match the main KV events implementation.The example file was using
BlockHash
(which isNewType("BlockHash", bytes)
) instead ofExternalBlockHash
(which isUnion[bytes, int]
) in the event class definitions. This type mismatch could cause serialization/deserialization issues when the subscriber tries to decode events published by the main vLLM engine, which usesExternalBlockHash
for backward compatibility with both byte and integer hash representations.Test Plan
Run the KV events subscriber example to ensure it can properly decode events:
Test with a vLLM server that has KV cache events enabled to verify end-to-end functionality:
Verify that the subscriber can properly decode both
BlockStored
andBlockRemoved
events without type errors.Test Result
The fix ensures type consistency between the main KV events implementation (
vllm/distributed/kv_events.py
) and the example subscriber. TheExternalBlockHash
type is designed to handle bothbytes
andint
representations for backward compatibility, which is essential for proper event serialization/deserialization across the KV events system.Before:
After
Essential Elements of an Effective PR Description Checklist
BlockHash
but receivesExternalBlockHash
#26264)".supported_models.md
andexamples
for a new model.