Empty tool_calls array still triggers Tool Call handling
What version of Codex is running?
0.0.0-dev
Which model were you using?
Qwen3-235B-A22B or custom models with vllm v0.9.0.1
What platform is your computer?
Darwin 24.5.0 arm64 arm
What steps can reproduce the bug?
- Serve Qwen3 with vLLM: Set up and run Qwen3 using vLLM for serving.
- Provide "hello" as input via codex message.
What is the expected behavior?
it should recognize "hello" as a standard conversational input and provide a simple, appropriate textual response as a greeting.
What do you see instead?
Instead of a greeting, the system incorrectly interprets "hello" as a tool call. Consequently, it executes no further action and produces no output whatsoever.
Additional information
Here's a suggested change to address this issue:
diff --git a/codex-cli/src/utils/responses.ts b/codex-cli/src/utils/responses.ts
index f0586ba..31ea847 100644
--- a/codex-cli/src/utils/responses.ts
+++ b/codex-cli/src/utils/responses.ts
@@ -493,7 +493,7 @@ async function* streamResponses(
}
if (
!isToolCall &&
- (("tool_calls" in choice.delta && choice.delta.tool_calls) ||
+ (("tool_calls" in choice.delta && choice.delta.tool_calls && choice.delta.tool_calls.length > 0) ||
choice.finish_reason === "tool_calls")
) {
isToolCall = true;
Explanation of the Change
The provided git diff shows a modification to the streamResponses asynchronous generator function within codex-cli/src/utils/responses.ts.
Specifically, the change refines the condition that determines if a tool_calls event is being processed. Previously, isToolCall would become true if choice.delta contained a tool_calls property, even if that tool_calls array was empty.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗