Repository navigation
server: GLM tool calls the model wrote with a key or an end missing still parse - #761
Merged
Merged
Conversation
… it back GLM-5.3-Flash sometimes writes the key of an argument without its <arg_key>, leaving whitespace where that token belongs: "read_file path</arg_key><arg_value>..", or "</arg_value>\nlimit</arg_key><arg_value>..". glmCall then read the first as text and lost the second argument. repairGlmKeys() puts <arg_key> back before the word ahead of each unopened </arg_key> (one after the name, or after a </arg_value>), and glmCall reads the repaired block; a block missing none, a key with no name before it, or no word at all comes back as written. The parsers that end a reply and close a call the end token left open both go through glmCall, so both read the repaired call. The second half of ashhart#285 by MiaAI-Lab (closed unmerged); the test cases are that PR's.
…hen parses
When the model's end token comes before </tool_call>, closeCall closes the call if it then
parses strictly. A GLM call ended inside its value ("run<arg_key>command</arg_key>
<arg_value>ls -la") stayed the reply's text here; ashhart#285 (by MiaAI-Lab, closed unmerged)
closed the value too, with </arg_value> ahead of </tool_call>, and sent the call when that
parsed. argumentsClose now does the same. The strict parse still decides: a key with no
value, a tool not offered, text after an argument or a think block past the call stay open.
The test that kept an open GLM value as text now closes it, and ashhart#285's cases of
close_glm_call (tests/test_glm_tool_call_end.py) are added.
Bizuayeu
force-pushed
the
pr/glm-tool-parse
branch
from
October 13, 2026 06:40
3441352 to
0cb42e4
Compare
jschmied
pushed a commit
to jschmied/TensorFold
that referenced
this pull request
Oct 13, 2026
jschmied
pushed a commit
to jschmied/TensorFold
that referenced
this pull request
Oct 13, 2026
jschmied
pushed a commit
to jschmied/TensorFold
that referenced
this pull request
Oct 13, 2026
…e repaired before they parse docs/api.md still said include is refused and that a partial value stays content; ashhart#759 and ashhart#761 changed both.
jschmied
pushed a commit
to jschmied/TensorFold
that referenced
this pull request
Oct 13, 2026
…al by name, as ashhart#759's and ashhart#761's heads now say Comment and test-name wording only, from the PRs' current heads. Co-authored-by: Bizuayeu <[email protected]>
Owner
|
Thank you, @Bizuayeu, and thank you @MiaAI-Lab, whose #285 these repairs and cases come from: both commits, as we landed them ( Your head moved after we landed it, with comments that now name #285. We took that wording as |
8 tasks done
This was referenced Oct 14, 2026
Closed
outcastofmusic
added a commit
to outcastofmusic/TensorFold
that referenced
this pull request
Oct 16, 2026
…t off, is a call
Two GLM writings left a reply's call as text, so the agent's turn carried no call. A key the model wrote as
whitespace ("read_file path</arg_key>...") gets its <arg_key> back before the word ahead of each lone </arg_key>
(server/tools.repair_glm_keys, both servers). A call the model's end token ended before </tool_call> closes with
what it lacks (</arg_value>, </function> or JSON's brackets) when the closed call then parses strictly as one call
to an offered tool (cuda/reply_text.close_call); a stop string, the length limit or ignore_eos closes nothing.
Upstream TensorFold 1.0.9 (ashhart#761) does the same, and the tests are its cases.
Tests: tests/test_glm_call_repair.py, with the server path through the CUDA app.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
…e repaired before they parse docs/api.md still said include is refused and that a partial value stays content; ashhart#759 and ashhart#761 changed both.
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
…al by name, as ashhart#759's and ashhart#761's heads now say Comment and test-name wording only, from the PRs' current heads. Co-authored-by: Bizuayeu <[email protected]>
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
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.
What this changes
Two repairs to GLM's tool-call parser, both from #285 (by @MiaAI-Lab, closed unmerged), with its test cases:
<arg_key>, leaving whitespace where that tokenbelongs (
read_file path</arg_key><arg_value>…).repairGlmKeys()puts<arg_key>back before the word ahead ofeach unopened
</arg_key>; a block missing none comes back as written.argumentsClosenow closesthe value too (
</arg_value>before</tool_call>) and sends the call when that parses. The strict parse stilldecides: a key with no value, a tool not offered, text after an argument or a think block past the call stay open.
Both paths go through
glmCall, so a reply's end and a closed call read the same repaired block.Receipt
0efbd447plus this change; one GB10 (DGX Spark, sm_121, CUDA 13.3).zig build test: 547 passed, 5 skipped, 0 failed; the three new tests (repaired keys, repaired calls in bothmodes, a call the end token left open) need this change, and the test that kept an open GLM value as text now
expects it closed.
zig build test-cuda-host: 359 passed, 0 failed.zig fmt --check: clean.lean_check: 539, as main.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.