Skip to content

feat(codex): append loaded deferred tools incrementally (ToolSearch) - #6

Merged
gongx030 merged 2 commits into
mainfrom
ccp-182-toolsearch
Nov 12, 2026
Merged

gongx030 merged 2 commits into
mainfrom
ccp-182-toolsearch

Conversation

@gongx030

Copy link
Copy Markdown
Owner

Summary

When Claude Code's tool search is on, loading a deferred tool through ToolSearch no longer rewrites the already-sent request prefix on the Codex Responses Lite lane. The loaded tool is appended as its own additional_tools item right after the result that loaded it, tool_reference blocks render as Tool loaded: <name>, and Claude Code's DeferredToolPlaceholder stub is no longer forwarded as a callable tool. Requests that carry no defer_loading tools or tool_reference blocks translate byte-identically to before; the full Responses lane (including parallel tool calls) and prompt_cache_key routing 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 also defer_loading), tool_reference rendering.
  • Docs: Codex provider page and Claude Code configuration page.

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.
  • Plus upstream's four unit tests.
  • Full suite: 924 lib tests plus integration binaries, 0 failures; clippy and fmt clean.

Review (medium) and design choices

  • Finding: debug_assert in append_loaded_tools could drop a tool if its output item were not emitted. Dismissed: every tool_result emits an output item, so it is unreachable; matches upstream.
  • Finding: test fixtures add the deferred tool to tools only after load. Kept: this is the shape the placeholder design implies; the docs state the assumption as upstream's.
  • Docs reworded to drop unmeasured token/cache claims.

🤖 Generated with Claude Code

gongw13-arch and others added 2 commits November 11, 2026 21:03
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>
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.

2 participants