Skip to content

fix(parsers): accept whitespace between glm47 arg_key and arg_value - #472

Merged
rmccorm4 merged 1 commit into
ai-dynamo:mainfrom
RafaySystems:fix/glm47-v1-arg-whitespace
Oct 24, 2026
Merged

rmccorm4 merged 1 commit into
ai-dynamo:mainfrom
RafaySystems:fix/glm47-v1-arg-whitespace

Conversation

@avinash-rafay

Copy link
Copy Markdown
Contributor

Overview

The v1 glm47 tool 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.7
writes the tags with nothing between them. Each call is returned with "arguments": "{}".

glm47 is 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_block from </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 this
whitespace since #189. This brings v1 in line. A unit test covers two newline-separated calls.

Bug Fix Evidence

1. Minimal Sample Input

dynamo-parsers 10.1.0 (latest release), glm47 parser, batch parse
(tools::try_tool_call_parse_aggregate(text, Some("glm47"), Some(&tools))). Tools: get_weather and
get_time, each with one string parameter city. The text is one chunk:

<tool_call>get_weather
<arg_key>city</arg_key>
<arg_value>Paris</arg_value>
</tool_call>
<tool_call>get_time
<arg_key>city</arg_key>
<arg_value>London</arg_value>
</tool_call>

Regression test: cargo test -p dynamo-parsers --lib test_parse_newline_between_arg_tags

2. Buggy Output (Before)

dynamo-parsers 10.1.0:

2 call(s) ["get_weather({})", "get_time({})"]

3. Expected/Fixed Output (After)

Expected and observed with this branch:

2 call(s) ["get_weather({\"city\":\"Paris\"})", "get_time({\"city\":\"London\"})"]

4. Unified Regression Cases

Not added yet. Guidance from maintainers would help here:

  • No existing Unified glm47 case puts whitespace between the argument tags (0 of 245 in
    fixtures-unified-v2/families/glm47/inputs_and_golden.yaml), so no recorded output changes.
  • The v2 Unified glm47 parser already handles this layout. A local test fed the input above through
    unified/glm47.rs at every split point; each split produced the expected call.
  • A red-before/green-after dynamo_v1 column needs a capture of the fixed release.
    capture_dynamo_unified_batch.py captures only published crates.io releases, so the green capture
    can 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.0
capture (red) and a current dynamo_v2 capture (green), and the fixed dynamo_v1 capture added after
release. 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 main at 2c39c26:

  • cargo fmt -- --check and cargo 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_stream and conformance_toolcalling_stream
    against the manifest-pinned fixtures: 9, 15 and 11 pass. No recorded v1 output changes.
  • Not verified locally:
    • The full workspace (dynamo-multimodal needs turbojpeg-sys, which does not build on this host).
    • Four unified_parity tests, which fail identically on unmodified main here: no XGrammar verifier,
      no flock.
  • The fix was also tested in a Dynamo 1.4.2 deployment of GLM-4.6V-FP8, with this regex backported to
    dynamo-parsers 7.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 in parse_tool_call_block and
test_parse_newline_between_arg_tags.

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>
@copy-pr-bot

copy-pr-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added fix external-contribution PR originates from a fork labels Oct 23, 2026
@avinash-rafay
avinash-rafay marked this pull request as ready for review October 23, 2026 19:11
@avinash-rafay
avinash-rafay requested a review from a team as a code owner October 23, 2026 19:11
@rmccorm4

Copy link
Copy Markdown
Contributor

/ok to test 03e819c

@github-actions

Copy link
Copy Markdown

📊 Conformance matrix rendered — view in CI summary

@rmccorm4 rmccorm4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both vllm and sglang support this whitespace between </arg_key> and <arg_value> in their glm47 parsers as well, LGTM

@rmccorm4
rmccorm4 enabled auto-merge (squash) October 24, 2026 03:44
@rmccorm4
rmccorm4 merged commit 90d815d into ai-dynamo:main Oct 24, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contribution PR originates from a fork fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants