Skip to content

Fix Qwen3 Coder argument parsing when the top-level type is missing - #1910

Open
zmylol wants to merge 2 commits into
ml-explore:mainfrom
zmylol:fix/qwen3-coder-1907
Open

zmylol wants to merge 2 commits into
ml-explore:mainfrom
zmylol:fix/qwen3-coder-1907

Conversation

@zmylol

@zmylol zmylol commented Sep 21, 2026

Copy link
Copy Markdown

This change updates Qwen3 Coder’s tool-call argument parser, which converts argument text generated by the model into Python values such as strings, dictionaries, and lists. When the top-level type is missing, the parser first attempts to parse the text as JSON.

  • If the parsed value is an object or array, it returns a dictionary or list.
  • If parsing fails, or the parsed value is a number, boolean, or string, it preserves the original text.

Only objects and arrays are converted to avoid accidentally turning text such as "123" into a number. The handling of explicitly specified types is unchanged, and the existing null handling is preserved.

  • ☑️ I understand it is strictly prohibited to use AI to write PR description
  • AI usage disclosure:

I reviewed the root cause and chose to limit automatic JSON conversion to objects and arrays to avoid unintended conversion of string values.I wrote the description myself and used Codex only to polish the English wording. Codex assisted with implementation, regression tests, code review. I also ran the tool-parsing tests locally to verify the changes.

This change updates Qwen3 Coder’s tool-call argument parser, which converts argument text generated by the model into Python values such as strings, dictionaries, and lists. When the top-level `type` is missing, the parser first attempts to parse the text as JSON.

- If the parsed value is an object or array, it returns a dictionary or list.
- If parsing fails, or the parsed value is a number, boolean, or string, it preserves the original text.

Only objects and arrays are converted to avoid accidentally turning text such as `"123"` into a number. The handling of explicitly specified types is unchanged, and the existing `null` handling is preserved.
@zmylol
zmylol marked this pull request as ready for review September 21, 2026 16:49

This branch has not been deployed

No deployments
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.

1 participant