Skip to content

[BugFix] Fix AscendStore lookup TypeError at ZMQ boundary - #13602

Open
jichaofdu wants to merge 1 commit into
vllm-project:mainfrom
jichaofdu:fix/ascendstore-zmq-hash-bytes
Open

jichaofdu wants to merge 1 commit into
vllm-project:mainfrom
jichaofdu:fix/ascendstore-zmq-hash-bytes

Conversation

@jichaofdu

@jichaofdu jichaofdu commented Aug 5, 2026 •

Copy link
Copy Markdown

What this PR does / why we need it?

LookupKeyClient serializes vLLM BlockHash values as hexadecimal strings for
the ZMQ lookup RPC. After msgpack decoding, LookupKeyServer forwarded those
strings directly to KVPoolWorker.lookup_scheduler(), although downstream
grouped-hash code expects bytes-like BlockHash elements.

In a v0.23.0rc1-based AscendStore deployment with the grouped-hash changes from
#12814 and #13110 backported, this produced:

TypeError: sequence item 0: expected a bytes-like object, str found

The lookup exception handler then returned zero external-cache hits.

This PR fixes the type mismatch at the ZMQ decode boundary, without changing
the existing RPC protocol:

  • 64-character hex strings are restored with bytes.fromhex().
  • Other strings are encoded as bytes.
  • Values that are already bytes are passed through unchanged.

As a result, all internal lookup paths receive bytes-like block hashes while
the scheduler-side serialization and wire format remain unchanged.

Does this PR introduce any user-facing change?

No public API, configuration, RPC framing, or cache-key format changes. The fix
prevents affected AscendStore lookups from failing and degrading to zero cache
hits.

How was this patch tested?

  • Added a LookupKeyServer regression test that feeds a 64-character hex hash
    through the decoded ZMQ request and verifies that lookup_scheduler()
    receives the corresponding 32-byte BlockHash.
  • Verified the regression test fails before the production change because the
    worker receives str, and passes after the boundary conversion is added.
  • Ran 50 targeted AscendStore unit tests covering the lookup client, lookup
    server, connector, and byte/string key construction paths.
  • Ran ruff check, ruff format --check, and git diff --check on the changed
    files.

No NPU hardware is required for this RPC type-conversion fix.

@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 serialization issue in the AscendStore lookup RPC where block hashes were being incorrectly converted to hexadecimal strings. By preserving the original byte representation during transmission, the change prevents potential type errors in internal hash operations and improves serialization efficiency. The update ensures that the internal contract for block hashes is maintained consistently across the client-server boundary.

Highlights

  • RPC Serialization Fix: Modified the AscendStore lookup RPC to preserve block hashes as bytes instead of converting them to hexadecimal strings, ensuring compatibility with downstream consumers that expect binary data.
  • Code Refactoring: Renamed the server-side variable 'hashes_str' to 'block_hashes' to accurately reflect the data type being processed.
  • Regression Testing: Added a new assertion in the unit tests to verify that the LookupKeyClient correctly passes raw byte hashes to the encoder.
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:

[Ops][Misc] Simplify block hash encoding in pool scheduler

Suggested PR Summary:

### What this PR does / why we need it?
This PR simplifies the block hash encoding process in the pool scheduler by directly encoding raw block hashes instead of converting them to hex strings first. It also renames variables for consistency and updates the unit tests to verify the encoding calls.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Updated unit tests in `test_pool_scheduler.py` to assert the correct arguments are passed to the encoder.

I have no additional feedback to provide as there are no review comments.

@github-actions

github-actions Bot commented Aug 5, 2026

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!

…undary)

Signed-off-by: yiyue.jc <yiyue.jc@antgroup.com>
@jichaofdu
jichaofdu force-pushed the fix/ascendstore-zmq-hash-bytes branch from ae8895f to 88e4d32 Compare August 5, 2026 08:06
@jichaofdu jichaofdu changed the title [BugFix] Preserve block hash bytes in AscendStore lookup RPC [BugFix] Fix AscendStore lookup TypeError at ZMQ boundary Aug 5, 2026
@jichaofdu

Copy link
Copy Markdown
Author

Updated the implementation to normalize decoded hex hashes at the LookupKeyServer boundary. The previous client-side serialization change has been fully removed; the existing RPC wire format is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant