Repository navigation
Tools: Keep string-typed parameters verbatim in qwen3_coder - #513
Merged
turboderp merged 1 commit intoNov 3, 2026
Merged
Conversation
A <parameter> value whose text happens to be valid JSON was always run through coerce_param_value(), so a `write` tool handed the content of a package.json received an object instead of the string its own schema declares, and the call was rejected with "content: Expected string". Thread the request's tools through parse_toolcalls() so the qwen3_coder parser can skip coercion for parameters the tool schema types as "string". Parameters typed otherwise, parameters absent from the schema, and callers that pass no tools keep the previous behaviour. Co-Authored-By: Claude Opus 5 <[email protected]>
Collaborator
|
Thanks. This is superseded by the streaming tool calls (push in a moment), but merged for attribution. |
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.
Problem
coerce_param_value()runsjson.loadson every<parameter>value, so a value whose text happens to be valid JSON stops being text. Handing awritetool the contents of apackage.jsonproduces an object instead of the string the tool's own schema declares, and the call is rejected:Reproduced with Qwen3.8-27B through OpenCode: writing a
package.jsonfailed three times in a row, every time the file's first character was{.Fix
Thread the request's
toolsthroughparse_toolcalls()so theqwen3_coderparser can look up each parameter's declared type and skip coercion when the schema says"type": "string".Deliberately narrow:
"limit": {"type": "number"}still yields100, not"100");toolsget exactly the previous behaviour, so nothing outside the chat-completion path changes.Only
qwen3_coderreads the new argument; the other format handlers are untouched.Tests
tests/test_qwen3_coder_string_params.py, six cases covering both directions — the string-typed value kept verbatim, the other types still coerced, the undeclared parameter still coerced, and the no-toolsback-compat path. Run against this branch:Verified in production on ExLlamaV3 1.6.6 + Qwen3.8-27B EXL3 (tensor parallel, 2 GPUs).