Skip to content

Conversation

andyxning
Copy link
Contributor

@andyxning andyxning commented Jun 26, 2025

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.

Purpose

Currently, mookcache kv transfer config parsing does not support ipv6. Adjust the prefill_url and decode_url parser logic .

Test Plan

Add ut for newly added function.

Test Result

Passed

(Optional) Documentation Update

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 can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

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.

🚀

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.

Summary of Changes

Hello @andyxning, 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 introduces comprehensive IPv6 support for URL parsing within the mooncake_pipe module, specifically for prefill_url and decode_url configurations. It refactors existing IP and port handling logic by introducing new utility functions that correctly parse and construct network addresses, ensuring compatibility with both IPv4 and IPv6 formats.

Highlights

  • Enhanced IP/Port Parsing: Implemented new utility functions (split_ip_port, join_ip_port) in vllm/utils.py to robustly parse and format IP addresses and ports, including proper handling of IPv6 bracket notation.
  • IPv6 Compatibility for Mooncake KV Transfer: Updated the mooncake_pipe module to leverage these new utility functions, enabling prefill_url and decode_url configurations to correctly interpret and construct URLs for IPv6 addresses.
  • Improved ZMQ URI Construction: Modified the _setup_metadata_sockets method to use the make_zmq_path utility, ensuring consistent and correct ZeroMQ URI formatting for both IPv4 and IPv6.
  • Comprehensive Unit Tests: Added new unit tests in tests/test_utils.py to validate the correctness and robustness of the newly introduced IP/port parsing and joining utilities across various IPv4 and IPv6 scenarios, including error cases.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize 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 is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

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

The code changes introduce IPv6 support for mookcache URL parsing. The changes include adding new functions for splitting and joining IP addresses and ports, and updating the mooncake pipe to use these functions. The test suite is also updated to include tests for the new functions. The changes look good, but there are a few minor issues that should be addressed.

# valid ipv6
assert split_ip_port("[::1]:5555") == ("::1", 5555)
# invalid ipv6
with pytest.raises(AssertionError):
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This assertion error will not provide any useful information to the user. Consider raising a ValueError instead.

Suggested change
with pytest.raises(AssertionError):
with pytest.raises(ValueError):

with pytest.raises(AssertionError):
# multi colon
assert split_ip_port("[::1]::5555")
with pytest.raises(AssertionError):
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This assertion error will not provide any useful information to the user. Consider raising a ValueError instead.

Suggested change
with pytest.raises(AssertionError):
with pytest.raises(ValueError):

with pytest.raises(AssertionError):
# tailing colon
assert split_ip_port("[::1]:5555:")
with pytest.raises(AssertionError):
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This assertion error will not provide any useful information to the user. Consider raising a ValueError instead.

Suggested change
with pytest.raises(AssertionError):
with pytest.raises(ValueError):

vllm/utils.py Outdated
Comment on lines 636 to 637
assert len(parts) == 2
port = parts[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

It's not necessary to assert the length of parts is 2, since the code will raise an IndexError if it's not.

Suggested change
assert len(parts) == 2
port = parts[1]
if parts := port.split(':'):
port = parts[1]

@andyxning andyxning force-pushed the adjust_for_ipv6_for_mooncacke_url_parse branch 2 times, most recently from 0467750 to 0a67b70 Compare June 26, 2025 06:08
vllm/utils.py Outdated
@@ -628,14 +628,34 @@ def is_valid_ipv6_address(address: str) -> bool:
return False


def split_ip_port(ip_port: str) -> Tuple[str, int]:
Copy link
Member

Choose a reason for hiding this comment

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

using host here instead of ip would be more consistent with your variable names. The function doesn't require it to be IP addresses, so host is a little more accurate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@russellb PTAL.

@andyxning andyxning force-pushed the adjust_for_ipv6_for_mooncacke_url_parse branch from 0a67b70 to c4cdb9a Compare June 30, 2025 11:43
Copy link
Member

@russellb russellb left a comment

Choose a reason for hiding this comment

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

I left a couple other minor suggestions, but it's not a blocker.

approved, thanks!

assert get_tcp_uri("::1", 5555) == "tcp://[::1]:5555"


def test_split_ip_port():
Copy link
Member

Choose a reason for hiding this comment

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

adding invalid IPv6 here would be good, too

vllm/utils.py Outdated
Comment on lines 633 to 640
if host_port.startswith('['):
host, port = host_port.rsplit(']', 1)
host = host[1:]
port = port.split(':')[1]
return host, int(port)
else:
host, port = host_port.split(':')
return host, int(port)
Copy link
Member

Choose a reason for hiding this comment

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

This could be slightly improved to raise ValueError directly with a message explaining that the string is an invalid combination of host + port. Right now it'll be something less clear, like ValueError: too many values to unpack (expected 2), depending on how it was formatted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will refactor in a new PR later.

Copy link
Member

Choose a reason for hiding this comment

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

no big deal either way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@russellb russellb enabled auto-merge (squash) June 30, 2025 14:04
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Jun 30, 2025
auto-merge was automatically disabled June 30, 2025 15:56

Head branch was pushed to by a user without write access

@andyxning andyxning force-pushed the adjust_for_ipv6_for_mooncacke_url_parse branch 2 times, most recently from 59ff2fb to dd68223 Compare June 30, 2025 15:57
# none int port
assert split_host_port("127.0.0.1:5555a")

# valid ipv6
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@russellb there are ready invalid ipv6 tests here. Can you give more details.

Copy link
Member

Choose a reason for hiding this comment

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

you're right, i was just blind, thank you

Copy link

mergify bot commented Jul 2, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @andyxning.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Jul 2, 2025
@andyxning andyxning force-pushed the adjust_for_ipv6_for_mooncacke_url_parse branch from dd68223 to 2fbb402 Compare July 2, 2025 02:43
@mergify mergify bot removed the needs-rebase label Jul 2, 2025
@andyxning andyxning force-pushed the adjust_for_ipv6_for_mooncacke_url_parse branch 4 times, most recently from e6b55fc to 44702e4 Compare July 2, 2025 12:38
@andyxning
Copy link
Contributor Author

@russellb Can you pls take a look at the ci failures. Seems the failure has nothing to do with this PR.

@andyxning
Copy link
Contributor Author

Some other PRs are also failed with docker build image.

@andyxning
Copy link
Contributor Author

@DarkLight1337 Could you pls take a loot at this.

Signed-off-by: Andy Xie <andy.xning@gmail.com>
@andyxning andyxning force-pushed the adjust_for_ipv6_for_mooncacke_url_parse branch from 44702e4 to c465ee0 Compare July 3, 2025 15:24
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) July 3, 2025 15:26
@DarkLight1337 DarkLight1337 merged commit 1dba2c4 into vllm-project:main Jul 3, 2025
72 checks passed
@andyxning andyxning deleted the adjust_for_ipv6_for_mooncacke_url_parse branch July 4, 2025 02:06
sfeng33 pushed a commit to sfeng33/vllm that referenced this pull request Jul 6, 2025
Signed-off-by: Andy Xie <andy.xning@gmail.com>
huydhn pushed a commit to huydhn/vllm that referenced this pull request Jul 8, 2025
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Chen-zexi pushed a commit to Chen-zexi/vllm that referenced this pull request Jul 13, 2025
Signed-off-by: Andy Xie <andy.xning@gmail.com>
LyrisZhong pushed a commit to LyrisZhong/vllm that referenced this pull request Jul 23, 2025
Signed-off-by: Andy Xie <andy.xning@gmail.com>
avigny pushed a commit to avigny/vllm that referenced this pull request Jul 31, 2025
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Signed-off-by: avigny <47987522+avigny@users.noreply.github.com>
Pradyun92 pushed a commit to Pradyun92/vllm that referenced this pull request Aug 6, 2025
Signed-off-by: Andy Xie <andy.xning@gmail.com>
npanpaliya pushed a commit to odh-on-pz/vllm-upstream that referenced this pull request Aug 6, 2025
Signed-off-by: Andy Xie <andy.xning@gmail.com>
jinzhen-lin pushed a commit to jinzhen-lin/vllm that referenced this pull request Aug 9, 2025
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Signed-off-by: Jinzhen Lin <linjinzhen@hotmail.com>
googlercolin pushed a commit to googlercolin/vllm that referenced this pull request Aug 29, 2025
Signed-off-by: Andy Xie <andy.xning@gmail.com>
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.

3 participants