From 2c353da28b2b9f0c65fa1f9bb3938e599e89d680 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Aug 2026 07:12:35 +0000 Subject: [PATCH] =?UTF-8?q?fix(protocol):=20reduce=20HTTP=20400=20errors?= =?UTF-8?q?=20for=20replay=20=E2=80=94=20accept=20tool=5Fchoice=3Dnone=20+?= =?UTF-8?q?=20extra=20fields?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. tool_choice='none' now accepted per OpenAI spec (strip and continue). Previously raised ValueError, causing 400 on replay requests. 2. Pydantic extra='forbid' → extra='ignore'. Real-world replay requests from Tencent API contain fields like service_tier, store, metadata, reasoning_effort etc. that our model doesn't declare. forbid rejects them all; ignore silently drops them. Sub 168 had 77 http_400 errors in replay — these two fixes should eliminate most of them, improving successful request count and score. CCCL tuning_transform.cuh pattern: accept all valid input configurations gracefully (policy_selector handles unknown cc values with fallback). --- qwen3_6_scripts/protocol.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/qwen3_6_scripts/protocol.py b/qwen3_6_scripts/protocol.py index befb5cad..ca7bc5ae 100644 --- a/qwen3_6_scripts/protocol.py +++ b/qwen3_6_scripts/protocol.py @@ -57,7 +57,10 @@ class CustomChatCompletionMessageParam(TypedDict, total=False): class OpenAIBaseModel(BaseModel): # OpenAI API does not allow extra fields - model_config = ConfigDict(extra="forbid") + # Real-world clients (replay, third-party SDKs) may send extra fields + # like service_tier, store, metadata, reasoning_effort, etc. + # "ignore" accepts the request and silently drops unknown fields. + model_config = ConfigDict(extra="ignore") class ErrorResponse(OpenAIBaseModel): @@ -517,6 +520,12 @@ class ChatCompletionRequest(OpenAIBaseModel): # if "tool_choice" is specified -- validation if "tool_choice" in data: + # "none" means don't use any tools — valid per OpenAI spec, + # just strip tool_choice and let vLLM ignore tools. + if data["tool_choice"] == "none": + del data["tool_choice"] + return data + # ensure that if "tool choice" is specified, tools are present if "tools" not in data or data["tools"] is None: raise ValueError(