add a shared Qwen tool/reasoning parser table so runtimes stop copying the wrong spelling - #4812
Merged
Conversation
…g the wrong spelling (#4778) Every local engine that serves a Qwen3-family model to a coding agent needs a runtime-specific tool-call parser, and on engines that split reasoning, a reasoning parser. The spellings differ per runtime and the failure is silent: the server starts, the model answers, tool markup comes back as ordinary assistant text with tool_calls: null, and the agent never touches a file. Those spellings lived only in prose — vLLM's qwen3_xml in the 3090 feature doc, SGLang's qwen3_coder + qwen3 in a research note — so the next runtime would copy whichever doc ranked first. server/lib/qwenAgentParsers.js is now the one table: parserFlagsFor(runtime) builds the argv fragment, vllmExtraArgs() the .env string form, and an unknown runtime throws rather than launching parser-less. llama's all-null row is a decision (llama-server has no equivalent flag today), not a placeholder. A guard test fails if any other tracked source file hard-codes a qwen3_* parser spelling, and a snapshot test pins the 3090 doc's EXTRA_ARGS line to the table so the two cannot drift. The SGLang runtime (#4776) and the vLLM guided install (#4767) consume this instead of retyping the string.
5 tasks
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
server/lib/qwenAgentParsers.js— the one table of tool-call / reasoning parser launch flags each local runtime needs to serve a Qwen3-family model to a coding agent. vLLMqwen3_xml(plus--enable-auto-tool-choice, without which vLLM 400s every tool request), SGLangqwen3_coder+--reasoning-parser qwen3, llama bothnull— a positive "no equivalent flag today", not a placeholder.parserFlagsFor(runtime)returns the argv fragment (always an array, so no caller type-checks the return),vllmExtraArgs()its string form for the compose project's.envEXTRA_ARGS. An unknown runtime throws — the failure this prevents is silent: a parser-less server answers fluently and returns tool markup as ordinary text withtool_calls: null, so the agent never touches a file.qwen3_*spelling, and a snapshot test pins thedocs/features/qwen38-rtx3090.mdEXTRA_ARGSline to the table so doc and code cannot drift. Doc gets a pointer at the table.server/lib/README.mdrow per the module-organization rule.Two implementation calls made in the issue's spirit rather than re-litigated:
parserFlagsForreturns an array for every runtime (vLLM's string transport isvllmExtraArgs(), so no caller does atypeofcheck), and the row carries a thirdenableAutoToolChoicekey because the parser flag alone still kills a vLLM session on the agent's first turn.Out of scope, untouched: the SGLang runtime (#4776) and the vLLM guided install (#4767). Both are told to import this table instead of retyping the string.
Test plan
cd server && npm test— 1566 files / 32825 tests pass, including the newlib/qwenAgentParsers.test.js(spelling pins for both runtimes, throw-on-unknown, prototype-key probe, doc snapshot, cross-repo grep guard) andlib/index.test.jsbarrel + README parity.gemini-3.7-flash, effort medium) on the branch diff: no findings.Closes #4778