Skip to content

[1.x] Group OpenAI tool search's deferred tools in a namespace - #1259

Open
leonardoaugustus wants to merge 1 commit into
laravel:1.xfrom
leonardoaugustus:fix/openai-tool-search-namespace
Open

leonardoaugustus wants to merge 1 commit into
laravel:1.xfrom
leonardoaugustus:fix/openai-tool-search-namespace

Conversation

@leonardoaugustus

Copy link
Copy Markdown

Fixes #1255.

With ToolSearch on OpenAI, the request that follows a deferred tool call (previous_response_id + function_call_output) fails with a 500 server_error. The first response is fine (tool_search_call, tool_search_output, function_call).

The failure depends on how the deferred functions are declared. I sent the same two requests straight to the Responses API (no SDK) on gpt-5.6-luna, gpt-5.4 and gpt-5.4-mini:

Deferred functions Continuation
loose in tools (current SDK shape), tools resent 500
grouped in a namespace, tools resent 200

A namespace with 27 functions also passed. The function_call the model returns still carries the bare function name (plus a namespace field), so tool resolution is unchanged, and replaying a function_call item without namespace in a full-history request also passes.

This PR wraps each ToolSearch's deferred tools in a namespace (deferred_tools, then deferred_tools_2, …), placed before the tool_search entry, as in OpenAI's tool search guide. Azure keeps the loose shape through a groupsDeferredToolsInNamespace() override, since its client-executed search is not affected and I could not test namespaces there.

🤖 Generated with Claude Code

OpenAI answers the continuation that carries a deferred tool's result
(previous_response_id + function_call_output) with a 500 server_error when
the deferred functions are sent loose. Grouped in a namespace, the shape
OpenAI's tool search guide recommends, the same request passes.

Fixes laravel#1255

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot pushed a commit to pentacore/media-manager that referenced this pull request Nov 24, 2026
## [1.63.2](v1.63.1...v1.63.2) (2026-11-24)

### Bug Fixes

* **a11y:** name the template picker, its search boxes and the time window strip ([84ee7bf](84ee7bf))
* **ai:** group OpenAI tool search's deferred tools in a namespace ([cedf4b1](cedf4b1)), closes [laravel/ai#1259](laravel/ai#1259) [laravel/ai#1255](laravel/ai#1255)
* **ai:** let a human review override the cascade LLM's second-opinion outcome ([508740f](508740f))
* **chat-templates:** ignore stale list refreshes, double picks and raw network errors ([ae10188](ae10188))
* **chat-templates:** post a saved message's body instead of a ?body= query ([77f9a64](77f9a64))
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.

ToolSearch: OpenAI fails with server_error after a deferred function is loaded

1 participant