Skip to content

The agent that grows with you

fix(transport): scope empty tool_calls comment to transport-layer coverage

Turgut Kural4e60771ab7e2
diff --git a/agent/transports/chat_completions.py b/agent/transports/chat_completions.py
index 694b074d38a..88a5d2ea178 100644
--- a/agent/transports/chat_completions.py
+++ b/agent/transports/chat_completions.py
@@ -277,10 +277,13 @@ class ChatCompletionsTransport(ProviderTransport):
# message carrying ``tool_calls: []`` (empty array) with
# HTTP 400 "Empty tool_calls is not supported in message."
# The pre-API sanitizer in agent_runtime_helpers drops these,
- # but only on the conversation_loop path — auxiliary / custom
- # provider routes can reach the wire without it. Normalize here
- # so any empty/invalid tool_calls array is stripped at the
- # transport layer on every call. (#58755 follow-up)
+ # but only on the conversation_loop path — other routes can
+ # reach the wire without it. For every request that
+ # serializes through this transport (conversation loop and
+ # any caller using it), this is the last boundary, so
+ # normalize here. Requests built by fully separate payload
+ # paths (e.g. some auxiliary clients) never pass through
+ # this layer and are out of scope for it. (#58755 follow-up)
if (
msg.get("role") == "assistant"
and "tool_calls" in msg