From 33cc22eda217a6f8745a201a31ca4da9c8a6d49c Mon Sep 17 00:00:00 2001 From: kyt Date: Sat, 13 Sep 2025 02:50:01 +0900 Subject: [PATCH] [Bug] Fix missing tool usage check Fixed a bug where the commentary value was missing in Invalid Channel due to the absence of with_custom_tools value when fetching the system message. Signed-off-by: kyt --- .../openai/test_response_api_with_harmony.py | 16 ++++++++++++++++ vllm/entrypoints/openai/serving_chat.py | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/entrypoints/openai/test_response_api_with_harmony.py b/tests/entrypoints/openai/test_response_api_with_harmony.py index 88b3795abe73..5b46e3e447e0 100644 --- a/tests/entrypoints/openai/test_response_api_with_harmony.py +++ b/tests/entrypoints/openai/test_response_api_with_harmony.py @@ -602,6 +602,22 @@ async def test_function_calling_required(client: OpenAI, model_name: str): ) +@pytest.mark.asyncio +@pytest.mark.parametrize("model_name", [MODEL_NAME]) +async def test_system_message_with_tools(client: OpenAI, model_name: str): + from vllm.entrypoints.harmony_utils import get_system_message + + # Test with custom tools enabled - commentary channel should be available + sys_msg = get_system_message(with_custom_tools=True) + valid_channels = sys_msg.content[0].channel_config.valid_channels + assert "commentary" in valid_channels + + # Test with custom tools disabled - commentary channel should be removed + sys_msg = get_system_message(with_custom_tools=False) + valid_channels = sys_msg.content[0].channel_config.valid_channels + assert "commentary" not in valid_channels + + @pytest.mark.asyncio @pytest.mark.parametrize("model_name", [MODEL_NAME]) async def test_function_calling_full_history(client: OpenAI, model_name: str): diff --git a/vllm/entrypoints/openai/serving_chat.py b/vllm/entrypoints/openai/serving_chat.py index 6c9c1ae85f57..381e8ddb5b3e 100644 --- a/vllm/entrypoints/openai/serving_chat.py +++ b/vllm/entrypoints/openai/serving_chat.py @@ -1566,7 +1566,9 @@ def _make_request_with_harmony( sys_msg = get_system_message( reasoning_effort=request.reasoning_effort, browser_description=None, - python_description=None) + python_description=None, + with_custom_tools=request.tools is not None + ) messages.append(sys_msg) # Add developer message.