Skip to content

feat: support codex custom tool type - #101

Merged
maralbahari merged 12 commits into
vllm-project:mainfrom
EmbeddedLLM:codex-custom-tool
Jul 20, 2026
Merged

maralbahari merged 12 commits into
vllm-project:mainfrom
EmbeddedLLM:codex-custom-tool

Conversation

@haoshan98

@haoshan98 haoshan98 commented Jul 14, 2026 •

Copy link
Copy Markdown
Collaborator

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 <[email protected]>
Signed-off-by: haoshan98 <[email protected]>
Signed-off-by: haoshan98 <[email protected]>
Signed-off-by: haoshan98 <[email protected]>
Signed-off-by: haoshan98 <[email protected]>

# Conflicts:
#	crates/agentic-server/src/handler/websocket/responses.rs
#	crates/agentic-server/tests/responses_websocket_test.rs
haoshan98 and others added 5 commits July 16, 2026 08:17
Signed-off-by: haoshan98 <[email protected]>
Signed-off-by: haoshan98 <[email protected]>
Signed-off-by: Hao Shan <[email protected]>
This reverts commit 81b6e8e.

Signed-off-by: haoshan98 <[email protected]>
@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
@haoshan98
haoshan98 requested a review from maralbahari July 17, 2026 08:10

@maralbahari maralbahari left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haoshan98 Thanks LGTM

@maralbahari
maralbahari merged commit 384c54c into vllm-project:main Jul 20, 2026
3 checks passed
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