Repository navigation
Conversation
qimcis
force-pushed
the
fix/glm47-literal-entities
branch
from
September 24, 2026 22:50
a2ddb44 to
59c50ab
Compare
qimcis
force-pushed
the
fix/glm47-literal-entities
branch
from
September 24, 2026 22:51
59c50ab to
01e004a
Compare
Contributor
Author
|
PR redundant now, as change is now in #290 |
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.
Description
The v1 GLM-4.7 parser decodes
< > & " 'in every tool-call argument value, so when the model writes an entity on purpose, the client gets the raw character instead. Found this to be an issue when we were serving glm-5.3 and seeing agents writing python and html, e.g. cleaning up scraped HTML:and attributes like
title="He said "hi" & waved 'bye'."come through astitle="He said "hi" & waved 'bye'.". In this case, the decoded value is still a valid string, so nothing errors on the serving side and it only shows up downstreamthe main cause is
decode_xml_entitiesinparse_tool_call_block, where the glm chat template writes string arguments into<arg_value>raw (only non-strings go throughtojson), so there is no escaping layer to undo: the text between the markers already is the value.This removes the decode, passes
raw_valuestraight tocoerce_value, and flips the existingtest_xml_entity_decodingintotest_xml_entities_kept_verbatim. This matches the v2 parser after #249 as well as vLLM's and SGLang's GLM-4.7 parsers, which also keep entities verbatim