Skip to content

feat: support codex custom tool type#101

Open
haoshan98 wants to merge 12 commits into
vllm-project:mainfrom
EmbeddedLLM:codex-custom-tool
Open

feat: support codex custom tool type#101
haoshan98 wants to merge 12 commits into
vllm-project:mainfrom
EmbeddedLLM:codex-custom-tool

Conversation

@haoshan98

@haoshan98 haoshan98 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Codex declares freeform tools such as apply_patch with type: "custom". Unlike function tools, these declarations can
include an opaque grammar, and their calls carry raw text in input rather than JSON in arguments. The typed Responses
path previously could not preserve that protocol through upstream inference, streaming, storage, and continuation.

  • Add typed request, response, and input models for custom tool declarations, custom_tool_call items, and custom_tool_call_output results while preserving unknown format fields.
  • Forward custom tool declarations to the upstream Responses endpoint without converting them to function tools.
  • Accept and forward named custom tool_choice objects such as
    {"type":"custom","name":"apply_patch"} alongside existing function choices.
  • Normalize and accumulate custom-tool streaming input events, return custom calls to the client for execution, and retain the call/output pair during stateful continuation.
  • Keep custom calls client-owned in the shared tool loop while gateway-owned MCP and web-search calls continue to execute through their registered handlers.
  • Persist terminal WebSocket responses before emitting completion so Codex can immediately continue a client-owned tool call without losing stored state when it closes the socket.
  • Add custom-context coverage for the existing local WebSocket generate: false prewarm path, confirming that prompt
    and custom-tool declarations are preserved without upstream inference.
  • Preserve and log structured upstream streaming failure details to make rejected tool requests diagnosable.
  • Add an isolated catalog/cache seed helper that writes both Codex catalog files so freeform apply_patch remains
    available after the ordinary model cache expires, with canonical-path checks that keep writes inside /tmp.
  • Extend the cassette recorder with custom-call continuation support and add direct-vLLM HTTP, gateway HTTP/SSE,
    gateway WebSocket, OpenAI HTTPS/SSE, and OpenAI WebSocket recordings that preserve raw input and
    custom_tool_call_output.
  • Document direct gateway, codex exec, and interactive Codex verification workflows.

Signed-off-by: haoshan98 <haoshanw@gmail.com>
Signed-off-by: haoshan98 <haoshanw@gmail.com>
Signed-off-by: haoshan98 <haoshanw@gmail.com>
Signed-off-by: haoshan98 <haoshanw@gmail.com>
Signed-off-by: haoshan98 <haoshanw@gmail.com>
Signed-off-by: haoshan98 <haoshanw@gmail.com>

# Conflicts:
#	crates/agentic-server/src/handler/websocket/responses.rs
#	crates/agentic-server/tests/responses_websocket_test.rs
Comment thread crates/agentic-server-core/src/types/io/output.rs Outdated
Comment thread crates/agentic-server-core/src/types/request_response.rs Outdated
Comment thread crates/agentic-server-core/src/executor/accumulator.rs Outdated
haoshan98 and others added 5 commits July 16, 2026 08:17
Signed-off-by: haoshan98 <haoshanw@gmail.com>
Signed-off-by: haoshan98 <haoshanw@gmail.com>
Signed-off-by: haoshan98 <haoshanw@gmail.com>
Signed-off-by: Hao Shan <53949959+haoshan98@users.noreply.github.com>
This reverts commit 81b6e8e.

Signed-off-by: haoshan98 <haoshanw@gmail.com>
@haoshan98
haoshan98 requested a review from maralbahari July 16, 2026 10:14
@haoshan98
haoshan98 marked this pull request as ready for review July 16, 2026 10:31
Comment thread crates/agentic-server-core/src/tool/normalize.rs
Signed-off-by: haoshan98 <haoshanw@gmail.com>
@haoshan98
haoshan98 requested a review from maralbahari July 17, 2026 08:10
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