Stop sending strict:null in Codex/Responses tool defs
The gpt-account (Codex) turn built its function tools with strict:null. The Responses API expects strict to be a boolean or omitted; null is malformed, so the endpoint dropped the whole tool list — leaving the model with nothing to call. That is exactly the "model returned no tool calls" failure on the GPT-account path. Omit strict when null; keep the boolean otherwise. Locked with a test, alongside the Bedrock/Gemini forced-tool-choice encoding. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f7543e506d
commit
74422da4f8
2 files changed
+31
-2
No files matched your search
@@ -7,7 +7,16 @@ import { isRecord, type JsonRecord, type ProviderEventStreamMessage } from "../p
|
||||
import { parseArguments, type AgentTurnMessage, type AgentTurnResult, type ToolCall, type ToolDefinition } from "../provider-tool-turn";
|
||||
|
||||
export function responsesToolDefs(tools: ToolDefinition[], strict: boolean | null = false): unknown[] {
|
||||
return tools.map((tool) => ({ type: "function", name: tool.name, description: tool.description, parameters: tool.parameters, strict }));
|
||||
// `strict` must be a boolean or omitted. Passing `strict: null` (the Codex
|
||||
// path) is malformed and makes the endpoint drop the whole tool list, so the
|
||||
// model has nothing to call. Omit the field instead of sending null.
|
||||
return tools.map((tool) => ({
|
||||
type: "function",
|
||||
name: tool.name,
|
||||
description: tool.description,
|
||||
parameters: tool.parameters,
|
||||
...(strict === null ? {} : { strict }),
|
||||
}));
|
||||
}
|
||||
|
||||
export function toResponsesInput(messages: AgentTurnMessage[]): unknown[] {
|
||||
|
||||
Reference in new issue
Block a user