Skip to content

Lower Python-style Qwen booleans when the tool schema says boolean - #1363

Open
markus7h wants to merge 1 commit into
antirez:mainfrom
markus7h:qwen-python-bool-args
Open

markus7h wants to merge 1 commit into
antirez:mainfrom
markus7h:qwen-python-bool-args

Conversation

@markus7h

Copy link
Copy Markdown

Qwen3.8 writes boolean tool arguments Python-style:

<tool_call>
<function=set_light>
<parameter=on>
True
</parameter>
...

True is not valid JSON, so parse_qwen_generated_message_ex emitted "on": "True" (a string). Clients that validate arguments against the tool schema (opencode, openHAB-style function calling) reject or mishandle the call.

Fix: when the tool schema declares the parameter as boolean, lower True/False to true/false. qwen_param_declared_string is generalised to qwen_param_declared_type(..., want); parameters declared as string still keep the literal text (covered by the new test).

Tests

  • make ds4_test && ./ds4_test --server → server: OK (new test_qwen_python_bool_with_boolean_schema)
  • Mac Studio M5 Max 128 GB, Metal, Qwen3.8 Flash Next Q4: a set_light probe ({"room": enum, "on": boolean}) went from 0/3 to 3/3 correct {"on":true,...}; opencode edit with replaceAll=true now receives a JSON boolean.
  • No backend or kernel code touched, so no speed impact.

🤖 Generated with Claude Code

Qwen3.8 emits <parameter=on>True</parameter>. True is not JSON, so the
parser passed it on as the string "True" and clients validating against
a boolean schema rejected the call. Lower True/False to true/false when the
declared type is boolean; string parameters keep the literal text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant