fix: skip function_call items with empty/missing name to prevent Codex 400 error (closes #444) (#487)

This commit is contained in:
Anurag Saxena
2026-04-03 21:51:00 -04:00
committed by GitHub
parent 38eabae2e7
commit 5fe2c81cf9
2 changed files with 4 additions and 0 deletions

View File

@@ -87,6 +87,8 @@ export function convertResponsesApiFormat(body) {
tool_calls: []
};
}
// Skip items with empty/missing name — upstream APIs reject nameless tool calls (#444)
if (!item.name || typeof item.name !== "string" || item.name.trim() === "") continue;
currentAssistantMsg.tool_calls.push({
id: item.call_id,
type: "function",

View File

@@ -75,6 +75,8 @@ export function openaiResponsesToOpenAIRequest(model, body, stream, credentials)
tool_calls: []
};
}
// Skip items with empty/missing name — Codex/OpenAI reject nameless tool calls (#444)
if (!item.name || typeof item.name !== "string" || item.name.trim() === "") continue;
currentAssistantMsg.tool_calls.push({
id: item.call_id,
type: "function",