[PR #14656] [MERGED] parsers: repair unclosed arg_value tags in GLM tool calls #14770

Closed
opened 2026-04-13 01:02:20 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14656
Author: @BruceMacD
Created: 3/6/2026
Status: Merged
Merged: 3/6/2026
Merged by: @BruceMacD

Base: mainHead: brucemacd/glm-tag-recover


📝 Commits (1)

  • 77f0736 parsers: repair unclosed arg_value tags in GLM tool calls

📊 Changes

3 files changed (+175 additions, -4 deletions)

View changed files

📝 model/parsers/glm46.go (+47 -2)
📝 model/parsers/glm46_test.go (+83 -0)
📝 x/models/glm4_moe_lite/parser.go (+45 -2)

📄 Description

GLM models sometimes omits </arg_value> closing tags in tool call XML, causing xml.Unmarshal to fail with "element <arg_value> closed by </tool_call>".

This is a known issue across the GLM family.

Sanitize the input to fix closing arg_key values so encoding/xml can handle it.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/14656 **Author:** [@BruceMacD](https://github.com/BruceMacD) **Created:** 3/6/2026 **Status:** ✅ Merged **Merged:** 3/6/2026 **Merged by:** [@BruceMacD](https://github.com/BruceMacD) **Base:** `main` ← **Head:** `brucemacd/glm-tag-recover` --- ### 📝 Commits (1) - [`77f0736`](https://github.com/ollama/ollama/commit/77f0736d7e61ddde1ecab7eb73bdb2d7598f51d9) parsers: repair unclosed arg_value tags in GLM tool calls ### 📊 Changes **3 files changed** (+175 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `model/parsers/glm46.go` (+47 -2) 📝 `model/parsers/glm46_test.go` (+83 -0) 📝 `x/models/glm4_moe_lite/parser.go` (+45 -2) </details> ### 📄 Description GLM models sometimes omits </arg_value> closing tags in tool call XML, causing xml.Unmarshal to fail with "element <arg_value> closed by </tool_call>". This is a known issue across the GLM family. Sanitize the input to fix closing arg_key values so encoding/xml can handle it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 01:02:20 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#14770