server: preserve custom tool kind in Responses output - #764
Open
carlitose wants to merge 1 commit into
Open
Conversation
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.
What changed
custom_tool_callinstead of changing it intofunction_call.input, while keeping ordinary functions on JSONarguments.Why
DS4 previously forgot the registered tool kind after building the model prompt. A free-form tool such as
apply_patchtherefore came back in the wrong response shape, and clients rejected it before executing the tool. The request already contains the missing kind, so this change carries that small piece of metadata to the shared response builder.Before and after
Before: Every generated non-hosted call defaulted to
function_callwitharguments, even when the request registered a custom free-form tool.After: Registered custom tools become
custom_tool_callitems with stringinput; ordinary functions, hostedtool_search, namespaces, and unknown-tool fallback retain their declared behavior.flowchart LR A[Registered request tool] --> B[Request tool metadata] B --> C{Registered kind} C -->|custom| D[custom_tool_call and input events] C -->|function| E[function_call and argument events] C -->|hosted search| F[tool_search_call]Code map
ds4_server.c— records the custom discriminator, unwraps one generic string property into free-form input, shares kind recovery across final/SSE output, and adds server regressions.How it works
custom.custom_tool_call,input, and custom-input SSE delta/done events.Verification
make cpuin Docker Linux x86_64 with GCC 14.4.0 — exit 0; all CPU binaries linked.make ds4_testoverride plus./ds4_test --server— build exit 0; test exit 0;ds4 tests: ok,server: OK.git diff --check— exit 0, with only Git's Windows LF-to-CRLF warning.make ds4_test— exit 2 because CUDAnvccis absent; the subsequent binary command was unavailable (127).make test— not run because Darwin/Metal andds4flash.ggufare unavailable./v1/responsesmodel/client round trip — not run because a suitable live model/server/client environment is unavailable.Risks and limits
Reviewer checklist
patch.