Repository navigation
fix(parsers): accept whitespace between glm47 arg_key and arg_value - #472
Merged
rmccorm4 merged 1 commit intoOct 24, 2026
Merged
Conversation
GLM-4.5, GLM-4.6 and GLM-4.6V chat templates put a newline between
</arg_key> and <arg_value>. The v1 argument regex required the tags to
be adjacent, so every argument was skipped and each call came back with
"{}". The v2 copy of this parser already allows whitespace there.
Signed-off-by: Avinash Varma <avinash@rafay.co>
Contributor
|
/ok to test 03e819c |
|
📊 Conformance matrix rendered — view in CI summary |
rmccorm4
approved these changes
Oct 24, 2026
rmccorm4
left a comment
Contributor
There was a problem hiding this comment.
Both vllm and sglang support this whitespace between </arg_key> and <arg_value> in their glm47 parsers as well, LGTM
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.
Overview
The v1
glm47tool parser (dynamo-parsers) drops every argument when a newline separates</arg_key>and<arg_value>. GLM-4.5, GLM-4.6 and GLM-4.6V chat templates use that layout. GLM-4.7writes the tags with nothing between them. Each call is returned with
"arguments": "{}".glm47is the only GLM tool parser registered in v1, so Dynamo deployments of these models(
--dyn-tool-call-parser glm47, batch and jail paths) return empty arguments for every tool call.Details
This changes one regex in
parse_tool_call_blockfrom</arg_key><arg_value>to</arg_key>\s*<arg_value>.The v2 copy of this parser (
parsers/v2/src/tool_calling/v1core/xml/glm47_parser.rs) has allowed thiswhitespace since #189. This brings v1 in line. A unit test covers two newline-separated calls.
Bug Fix Evidence
1. Minimal Sample Input
dynamo-parsers10.1.0 (latest release),glm47parser, batch parse(
tools::try_tool_call_parse_aggregate(text, Some("glm47"), Some(&tools))). Tools:get_weatherandget_time, each with one string parametercity. The text is one chunk:Regression test:
cargo test -p dynamo-parsers --lib test_parse_newline_between_arg_tags2. Buggy Output (Before)
dynamo-parsers10.1.0:3. Expected/Fixed Output (After)
Expected and observed with this branch:
4. Unified Regression Cases
Not added yet. Guidance from maintainers would help here:
fixtures-unified-v2/families/glm47/inputs_and_golden.yaml), so no recorded output changes.unified/glm47.rsat every split point; each split produced the expected call.dynamo_v1column needs a capture of the fixed release.capture_dynamo_unified_batch.pycaptures only published crates.io releases, so the green capturecan be recorded only after this fix is released.
A glm47-family case for newline-separated arguments could be added in this PR, with a
dynamo_v1-10.1.0capture (red) and a current
dynamo_v2capture (green), and the fixeddynamo_v1capture added afterrelease. Or it could follow as a separate conformance PR. Which do you prefer?
5. Visual Conformance Verification
Not done yet; this depends on section 4.
Validation
Run on macOS (arm64) against
mainat2c39c26:cargo fmt -- --checkandcargo clippy -p dynamo-parsers --all-targets -- -D warnings: clean.cargo test -p dynamo-parsers: all pass (962 unit tests plus the integration suites), including the new test.conformance_toolcalling,conformance_toolcalling_batch_via_streamandconformance_toolcalling_streamagainst the manifest-pinned fixtures: 9, 15 and 11 pass. No recorded v1 output changes.
dynamo-multimodalneedsturbojpeg-sys, which does not build on this host).unified_paritytests, which fail identically on unmodifiedmainhere: no XGrammar verifier,no
flock.dynamo-parsers7.0.1. Single and multi-turn tool-call checks went from empty arguments to correct ones.Where should the reviewer start?
parsers/v1/src/tool_calling/xml/glm47_parser.rs: the regex inparse_tool_call_blockandtest_parse_newline_between_arg_tags.