Skip to content

SWF(bug): keep first argument in Qwen XML tool calls - #45

Merged
maplepaladin73 merged 1 commit into
mainfrom
devin/1795371416-qwen-xml-first-param
Nov 22, 2026
Merged

maplepaladin73 merged 1 commit into
mainfrom
devin/1795371416-qwen-xml-first-param

Conversation

@maplepaladin73

@maplepaladin73 maplepaladin73 commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

Qwen3-Coder XML tool calls keep their first parameter when <function=NAME has no closing > and the first <parameter=…> tag follows the name directly.

parse_qwen3_coder_call ends the function name at >, newline or <, then always skipped one byte past that point. When the name ended at < (the start of <parameter=), that skip ate the <, so rest.find("<parameter=") never saw the first parameter. It now strips only > / newline delimiters, which leaves the first parameter tag intact.

Example input: <tool_call><function=get_weather<parameter=city>Paris</parameter>\n<parameter=unit>c</parameter></function></tool_call> → before: {"unit":"c"}, after: {"city":"Paris","unit":"c"}.

Test plan

Regression test parse_qwen3_coder_missing_function_delimiter (in tool_parser/tests/group_a_formats.rs) covers the name followed by <parameter= both directly and after a newline.

Before the fix (fails):

test tool_parser::tail::tests::group_a_formats::parse_qwen3_coder_missing_function_delimiter ... FAILED
panicked at crates/spark-server/src/tool_parser/tests/group_a_formats.rs:167:9:
assertion `left == right` failed
  left: Object {"unit": String("c")}
 right: Object {"city": String("Paris"), "unit": String("c")}
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 3212 filtered out

After the fix (rebased on main):

# tool_parser module
test tool_parser::tail::tests::group_a_formats::parse_qwen3_coder_missing_function_delimiter ... ok
test result: ok. 193 passed; 0 failed; 1 ignored; 0 measured; 3020 filtered out
# full spark binary
test result: ok. 3200 passed; 0 failed; 14 ignored; 0 measured; 0 filtered out

Try it: ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo test -p spark-server --bin spark tool_parser

Lint (blueprint lint steps):

  • cargo fmt --all -- --check: clean
  • ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --tests: passes
  • bash scripts/check-license-headers.sh: valid: 4261, invalid: 0
  • typos: exit 0
  • Added a regression test

Notes for reviewers


Software Factory opened this PR for Robert
Implemented in session Keep first argument in Qwen XML tool calls
Review with Devin · Open in Devin Desktop


@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1795371416-qwen-xml-first-param branch from 471ced8 to 99d14a9 Compare November 22, 2026 18:30
@maplepaladin73
maplepaladin73 merged commit 2e40c15 into main Nov 22, 2026
1 check passed
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