Skip to content

Conversation

@tlipoca9
Copy link
Contributor

@tlipoca9 tlipoca9 commented Aug 3, 2025

Purpose

if tool id contains '-', the original regex '[\w\.]' cannot match it.

@tlipoca9 tlipoca9 requested a review from aarnphm as a code owner August 3, 2025 12:49
@github-actions
Copy link

github-actions bot commented Aug 3, 2025

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

Code Review

The code changes modify the regex used to parse tool call IDs to allow hyphens. The original regex [\w\.] did not match hyphens, which caused issues when tool IDs contained them. The new regex .+ is very broad and could potentially match more than intended, especially with the .*? in the function_arguments group. It might be beneficial to have a more specific character class or a negative character class to avoid unintended matches.

Comment on lines 40 to +41
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The regex .+ is very broad and could potentially match more than intended, especially with the .*? in the function_arguments group. It might be beneficial to have a more specific character class or a negative character class to avoid unintended matches. Consider what characters are actually expected in the tool_call_id and refine the regex accordingly. This could prevent unexpected behavior if the input string deviates from the expected format. Also, consider adding a check to ensure that the tool_call_id does not contain any whitespace characters, as this could lead to parsing errors. If whitespace is allowed, ensure that it is handled correctly in subsequent processing steps.

For example, if the tool ID is expected to be alphanumeric with hyphens and underscores, the regex could be refined to [a-zA-Z0-9\-_]+.

r"<\|tool_call_begin\|>\s*(?P<tool_call_id>[a-zA-Z0-9\-_]+:\d+)\s*<\|tool_call_argument_begin\|>\s*(?P<function_arguments>.*?)\s*<\|tool_call_end\|>"

Comment on lines 44 to +45
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Similar to the previous comment, the regex .+ in stream_tool_call_portion_regex is very broad. Refining this regex to match only expected characters in tool_call_id would improve robustness and prevent unintended matches during streaming. Consider the expected format and characters for the tool_call_id and adjust the regex accordingly. Also, consider adding a check to ensure that the tool_call_id does not contain any whitespace characters, as this could lead to parsing errors. If whitespace is allowed, ensure that it is handled correctly in subsequent processing steps.

For example, if the tool ID is expected to be alphanumeric with hyphens and underscores, the regex could be refined to [a-zA-Z0-9\-_]+.

r"(?P<tool_call_id>[a-zA-Z0-9\-_]+:\d+)\s*<\|tool_call_argument_begin\|>\s*(?P<function_arguments>.*)"

Comment on lines 48 to +49
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The regex .+ in stream_tool_call_name_regex is very broad. Refining this regex to match only expected characters in tool_call_id would improve robustness and prevent unintended matches during streaming. Consider the expected format and characters for the tool_call_id and adjust the regex accordingly. Also, consider adding a check to ensure that the tool_call_id does not contain any whitespace characters, as this could lead to parsing errors. If whitespace is allowed, ensure that it is handled correctly in subsequent processing steps.

For example, if the tool ID is expected to be alphanumeric with hyphens and underscores, the regex could be refined to [a-zA-Z0-9\-_]+.

r"(?P<tool_call_id>[a-zA-Z0-9\-_]+:\d+)\s*"

@aarnphm aarnphm enabled auto-merge (squash) August 4, 2025 16:07
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 4, 2025
auto-merge was automatically disabled August 4, 2025 16:27

Head branch was pushed to by a user without write access

@tlipoca9
Copy link
Contributor Author

tlipoca9 commented Aug 4, 2025

@aarnphm please merge, i fix the DCO checks in ci

@vllm-bot vllm-bot merged commit 8a6e108 into vllm-project:main Aug 5, 2025
38 of 41 checks passed
npanpaliya pushed a commit to odh-on-pz/vllm-upstream that referenced this pull request Aug 6, 2025
myselvess pushed a commit to myselvess/vllm that referenced this pull request Aug 7, 2025
jinzhen-lin pushed a commit to jinzhen-lin/vllm that referenced this pull request Aug 9, 2025
noamgat pushed a commit to noamgat/vllm that referenced this pull request Aug 9, 2025
paulpak58 pushed a commit to paulpak58/vllm that referenced this pull request Aug 13, 2025
diegocastanibm pushed a commit to diegocastanibm/vllm that referenced this pull request Aug 15, 2025
epwalsh pushed a commit to epwalsh/vllm that referenced this pull request Aug 28, 2025
xiao-llm pushed a commit to xiao-llm/vllm that referenced this pull request Aug 28, 2025
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Aug 28, 2025
huiqiwa pushed a commit to huiqiwa/vllm-fork that referenced this pull request Oct 21, 2025
huiqiwa pushed a commit to huiqiwa/vllm-fork that referenced this pull request Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend ready ONLY add when PR is ready to merge/full CI is needed tool-calling

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants