-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Description
What version of Codex is running?
v0.61.0
What subscription do you have?
BYOM
Which model were you using?
gpt-5.1-codex-mini, gpt-5.1-codex
What platform is your computer?
MacOS
What issue are you seeing?
We have the setup: Codex CLI --> LiteLLM --> Azure OpenAI Models
The request towards Azure got rejected because the function name is an empty string "". Below is the example messages in the rejected request. It worked before but maybe since yetserday Azure may changed the content policy to reject such requests. So now all such requests fails.
"messages": [
{
"role": "system",
"content": "You are Codex, based on GPT-5. ...."
},
{
"role": "user",
"content": "# AGENTS.md instructions for /....."
},
{
"role": "user",
"content": "<environment_context>\...."
},
{
"role": "user",
"content": "# Context from my IDE setup:...."
},
{
"role": "assistant",
"content": "Hey there! Let me know what you’d like to dig into."
},
{
"role": "user",
"content": "# Context from my IDE setup....n"
},
{
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_NTEBXqjyLLvYusbiGf1fXZv2",
"type": "function",
"function": {
"name": "", <---- !!!!THE EMPTY Function Name!!!!!
"arguments": "{\"command\":[\"bash\",\"-lc\",\"echo\"],\".........}"
}
}
]
},
{
"role": "tool",
"content": "unsupported call: ",
"tool_call_id": "call_NTEBXqjyLLvYusbiGf1fXZv2"
}
]
The function name is actually included in the previous response
"output": [
{
"id": "rs_0b20df85b294bee50069203508bab481959ac8ba55246426eb",
"type": "reasoning",
"status": null,
"content": null,
"summary": [],
"encrypted_content": null
},
{
"id": "fc_0b20df85b294bee5006920350ac7e48195bb74bb3610bd4480",
"name": "shell",
"type": "function_call",
"status": "completed",
"call_id": "call_NTEBXqjyLLvYusbiGf1fXZv2",
"arguments": "{\"command\":[\"bash\",\"-lc\",\"echo\"],\"..."}"
}
],
I have tried to fix it and made it work by hacking codex-rs/core/src/chat_completions.rs:692 to make it to be "shell_command" instead of empty string.
name: fn_call_state.name.clone().unwrap_or_else(|| "".to_string()),
==>
name: fn_call_state.name.clone().unwrap_or_else(|| "shell_command".to_string()),
What should be the proper fix? Got some suggestion from codex itself. just print below for your reference.
This should make for a concise GitHub issue describing the source of the empty-name bug and how to resolve it.
- The Chat Completions SSE parser only captures function.name from the incremental delta.tool_calls chunks (codex-rs/core/src/chat_completions.rs:657-694). Azure’s updated
policy now omits that name from the deltas and only provides it in the final choices[0]["message"]["tool_calls"][0]["function"] payload. - Because the parser never sees the name while aggregating, FunctionCallState.name stays None, we emit a function call with an empty string, and Azure immediately rejects the
request (policy forbids empty function names). - The fix is to inspect the completed choice["message"]["tool_calls"] block when finish_reason == "tool_calls" and populate fn_call_state.name before emitting the
ResponseItem::FunctionCall, so the actual tool name is forwarded instead of an empty string.
What steps can reproduce the bug?
- Setup Codex CLI --> LiteLLM --> Azure OpenAI Models
config.toml
[model_providers.openai-chat-completions]
name = "name"
base_url = "<litellm-url>"
env_key = "CODING_AGENT_KEY"
wire_api = "chat"
query_params = {}
- start codex and ask "hello, just echo"
What is the expected behavior?
it will call a function to echo the text
Additional information
No response