fix(core): treat ask_user_question multiSelect as optional#3699
Merged
Conversation
The schema advertised `default: false` but also listed the field as required, and the validator hard-rejected calls where the model omitted it. Models read the default annotation and reasonably skipped the field, then got the error `Question 1: "multiSelect" must be a boolean.` and could not recover. Make multiSelect optional in the schema and the input types, and only error when the field is present with a non-boolean value. Existing UI consumers already coalesce a missing value to false. Fixes #3218
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
4 tasks
mabry1985
pushed a commit
to protoLabsAI/protoCLI
that referenced
this pull request
May 2, 2026
Cherry-picked from QwenLM/qwen-code: 784b3ce Make `multiSelect` field optional in the askUserQuestion tool schema. Older / smaller models often omit the field entirely; treating it as required forced a validation failure when the model otherwise produced a well-formed question. Also refactors a pre-existing conditional expect that lint-staged now flags (no behavior change). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mabry1985
added a commit
to protoLabsAI/protoCLI
that referenced
this pull request
May 2, 2026
…LM#3699) (#181) * fix(cli): guard gradient rendering without colors (QwenLM#3640) * fix(cli): auto-submit on number key press in AskUserQuestionDialog (QwenLM#3407) Fixes QwenLM#500. Number keys in AskUserQuestionDialog previously only moved the highlight cursor without submitting, inconsistent with RadioButtonSelect and the standard tool approval dialog. Users pressed a number, saw the option highlight, and assumed it was selected, but the dialog was still waiting for Enter. - For single-select predefined options, pressing a number key now auto-submits immediately. - Multi-select, "Other" custom input, and the Submit tab remain highlight-only (unchanged). - Extracted a shared selectAndAdvance helper to deduplicate the select-and-submit/advance logic across 4 code paths (number key, Enter, multi-select submit, custom input submit). - Removed redundant isFocused guard inside the useKeypress callback; it is already handled via the isActive parameter. Tests cover all four behavioral branches: single-select auto-submits, multi-select does not, "Other" custom input does not, and the Submit tab does not. * fix(core): treat ask_user_question multiSelect as optional (QwenLM#3699) Cherry-picked from QwenLM/qwen-code: 784b3ce Make `multiSelect` field optional in the askUserQuestion tool schema. Older / smaller models often omit the field entirely; treating it as required forced a validation failure when the model otherwise produced a well-formed question. Also refactors a pre-existing conditional expect that lint-staged now flags (no behavior change). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: trigger PR mergeability recompute * ci: force CI re-trigger --------- Co-authored-by: 易良 <1204183885@qq.com> Co-authored-by: jinye <djy1989418@126.com> Co-authored-by: Automaker <automaker@localhost> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
xaelistic
pushed a commit
to xaelistic/qwen-code
that referenced
this pull request
Jun 7, 2026
The schema advertised `default: false` but also listed the field as required, and the validator hard-rejected calls where the model omitted it. Models read the default annotation and reasonably skipped the field, then got the error `Question 1: "multiSelect" must be a boolean.` and could not recover. Make multiSelect optional in the schema and the input types, and only error when the field is present with a non-boolean value. Existing UI consumers already coalesce a missing value to false. Fixes QwenLM#3218
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.
Summary
ask_user_questionnow accepts tool calls where the model omitsmultiSelectfor a question. Calls that include the field with a non-boolean value are still rejected with the original error.default: false(signalling "optional, falls back to false"), but the same schema also listed it inrequired, and the validator hard-rejected anything that wasn't a boolean. Frontier models read the default annotation and reasonably omitted the field; they then hitQuestion 1: "multiSelect" must be a boolean.and got stuck looping on the same malformed call. This made the tool effectively unusable in some sessions and was the bug reported in AskUserQuestion errors #3218.false— keep rendering the dialog correctly.Validation
Before: the user saw
Question 1: "multiSelect" must be a boolean.instead of a question dialog whenever the model's tool call omittedmultiSelect, and the model usually retried the same malformed call (per the screenshot in #3218).After: the same call renders the question dialog. The user picks an option and the conversation continues normally.
Verified end-to-end against a mock model server returning three payload shapes —
multiSelectomitted, explicitfalse, and a non-boolean string. The first two reach the dialog; the third still surfaces the validator error so genuinely malformed input is still caught. Unit tests for the affected core and CLI surfaces all pass.Scope / Risk
multiSelectas optional. Any downstream code that read it as a guaranteed boolean would have to handleundefined. Both rendering call sites already coalesce a missing value tofalse, and a typecheck ofcore,cli, andwebuipasses after the change.rawInputpayload — which forwards the model's raw arguments to the IDE companion — has always carried whatever the model actually sent. That's unchanged here; the runtime consumers of that payload already defend against a missing field.Testing Matrix
Testing matrix notes:
Linked Issues / Bugs
Fixes #3218