Repository navigation
feat(codex): append loaded deferred tools incrementally (ToolSearch) - #6
Merged
Merged
Conversation
With tool search enabled in Claude Code, a ToolSearch result carries tool_reference blocks and the loaded tools arrive with defer_loading. The Lite lane previously put every tool in the leading additional_tools item, so each load rewrote the request prefix, and tool_reference reached the model as an unsupported-block placeholder. Now a deferred tool loaded by a tool_reference is appended as its own additional_tools item right after the matching function_call_output, so each request's input is an exact prefix of the next. The Anthropic-only DeferredToolPlaceholder is dropped (only when also defer_loading) on both lanes, and tool_reference renders as "Tool loaded: <name>". Full lane tools and parallel_tool_calls are unchanged. Adds a 3-request sequence test on both lanes (fails on the prior code: the second request rewrote the prefix) and a byte-identity test whose goldens were captured before this change. Based on raine#184 (commit 8f326c0, request.rs only). Refs raine#182 Co-Authored-By: Clement Dumas <dumasclement2002@gmail.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…odex Documents the opt-in ENABLE_TOOL_SEARCH setting and how the Codex Responses Lite lane now appends loaded deferred tools where they were loaded. Describes the mechanism only; no cost or cache-hit claim, and the proxy does not enable the setting itself. Adapted from raine#184 (commit 40515bd). Refs raine#182 Co-Authored-By: Clement Dumas <dumasclement2002@gmail.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Nov 12, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When Claude Code's tool search is on, loading a deferred tool through
ToolSearchno longer rewrites the already-sent request prefix on the Codex Responses Lite lane. The loaded tool is appended as its ownadditional_toolsitem right after the result that loaded it,tool_referenceblocks render asTool loaded: <name>, and Claude Code'sDeferredToolPlaceholderstub is no longer forwarded as a callable tool. Requests that carry nodefer_loadingtools ortool_referenceblocks translate byte-identically to before; the full Responses lane (including parallel tool calls) andprompt_cache_keyrouting are unchanged. No token or quota effect was measured; this describes the mechanism only.Port of upstream raine#184 (author credited in the commit). The proxy does not enable
ENABLE_TOOL_SEARCH; the docs describe it only as an opt-in.Refs raine#182
Changes
src/providers/codex/translate/request.rs: Lite-lane split of loaded deferred tools, placeholder filter (only when alsodefer_loading),tool_referencerendering.Tests
tool_search_sequence_is_cache_stable_and_placeholder_free_on_both_lanes: 3-request sequence on Lite (gpt-6.1-sol) and full (gpt-6.1-terra); fails on main, passes here.requests_without_deferred_tools_translate_byte_identically: goldens captured on main for a Lite request and a full-lane parallel-tool-call request.Review (medium) and design choices
debug_assertinappend_loaded_toolscould drop a tool if its output item were not emitted. Dismissed: everytool_resultemits an output item, so it is unreachable; matches upstream.toolsonly after load. Kept: this is the shape the placeholder design implies; the docs state the assumption as upstream's.🤖 Generated with Claude Code