Skip to content

fix(core): coerce string boolean values in schema validation#1284

Merged
Mingholy merged 3 commits into
QwenLM:mainfrom
tt-a1i:fix/boolean-string-coercion
Dec 29, 2025
Merged

fix(core): coerce string boolean values in schema validation#1284
Mingholy merged 3 commits into
QwenLM:mainfrom
tt-a1i:fix/boolean-string-coercion

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

TLDR

When using self-hosted LLMs (like Ollama), the shell tool sometimes fails because the model returns "true" instead of true for is_background. This PR makes the schema validator smarter about handling that.

Dive Deeper

The existing code already had a fixBooleanCasing function that handled "True""true" case normalization, but it didn't actually convert strings to booleans.

I renamed it to fixBooleanValues and made it convert:

  • "true"/"True"/"TRUE"true
  • "false"/"False"/"FALSE"false

This is a global fix so any tool with boolean params benefits, not just ShellTool.

Added tests for both the schema validator and shell tool to cover the new behavior.

Linked issues / bugs

Fixes #1267

Self-hosted LLMs sometimes return "true"/"false" strings instead of
actual boolean values for tool parameters like `is_background`. This
causes schema validation to fail with type errors.

Fixes #1267
@tt-a1i tt-a1i marked this pull request as ready for review December 17, 2025 08:28
@Mingholy

Copy link
Copy Markdown
Collaborator

LGTM!

@Mingholy Mingholy merged commit 105ad74 into QwenLM:main Dec 29, 2025
13 checks passed
xaelistic pushed a commit to xaelistic/qwen-code that referenced this pull request Jun 7, 2026
xaelistic pushed a commit to xaelistic/qwen-code that referenced this pull request Jun 7, 2026
fix(core): coerce string boolean values in schema validation
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.

Background task management

2 participants