Skip to content

fix: correct Responses API tool schema and null error classification#772

Closed
telagod wants to merge 1 commit intonullclaw:mainfrom
telagod:fix/responses-api-tool-schema-and-null-error
Closed

fix: correct Responses API tool schema and null error classification#772
telagod wants to merge 1 commit intonullclaw:mainfrom
telagod:fix/responses-api-tool-schema-and-null-error

Conversation

@telagod
Copy link
Copy Markdown
Contributor

@telagod telagod commented Apr 5, 2026

Problem

Two bugs prevented the Responses API (api_mode=responses) from working with providers that implement the OpenAI Responses endpoint (e.g. foxnio):

Fixes #773

1. Tool schema format mismatch

buildResponsesRequestBody called convertToolsOpenAI, which emits the chat completions nested format:

{"type": "function", "function": {"name": "...", "description": "...", "parameters": {...}}}

The Responses API requires a flat format:

{"type": "function", "name": "...", "description": "...", "parameters": {...}}

This caused providers to reject requests with Missing required parameter: 'tools[0].name'.

2. Null error misclassification

Responses API returns "error": null in successful responses. classifyErrorObject treated any non-string, non-object error field value as .other (an API error), causing valid completed responses to be rejected as errors.

Changes

File Change
src/providers/helpers.zig Added convertToolsResponses with flat tool schema format
src/providers/root.zig Export convertToolsResponses
src/providers/compatible.zig buildResponsesRequestBody now calls convertToolsResponses
src/providers/error_classify.zig classifyErrorObject skips "error": null instead of misclassifying it

Validation

  • zig build test --summary all: 6337 passed, 0 failures, 0 leaks
  • End-to-end verified with foxnio/gpt-5.4 via nullclaw agent --no-stream

Two bugs prevented the Responses API (api_mode=responses) from working
with providers like foxnio:

1. Tool schema format mismatch: buildResponsesRequestBody used
   convertToolsOpenAI which emits the chat completions nested format
   {"type":"function","function":{"name":...}}. The Responses API
   requires a flat format {"type":"function","name":...}. Added
   convertToolsResponses with the correct flat structure.

2. Null error misclassification: Responses API returns "error":null in
   successful responses. classifyErrorObject treated any non-string,
   non-object error field as .other (an error), causing valid completed
   responses to be rejected. Added a null check to skip classification
   when error is explicitly null.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Responses API (api_mode=responses) broken — tool schema format and null error misclassification

2 participants