Skip to content

tool parsing: treat literal tool XML in prose/quotes/fences as text for glm5_next + qwen4_exp (ported from Enntity) - #230

Merged
AzeezIsh merged 11 commits into
port/199-on-198from
stack/literal-tool-xml
Oct 29, 2026
Merged

AzeezIsh merged 11 commits into
port/199-on-198from
stack/literal-tool-xml

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Stack: main ← #198 ← #223 ← #224 ← #226 ← #227 ← #229 ← this.

Summary

  • Ports Enntity's literal tool-XML handling (AGPL-3.0, b1b53814, fbda04d1, 69d32d3e, 1c1a8fee) with credit. Literal tool markup that the model writes as prose, in quotes or in code fences is kept as text instead of being parsed as a call or stripped. Reasoning keeps bare/split tool XML until think-end. Rejected envelopes can't be re-parsed as bare/JSON calls (LeakMarkers::for_literal_xml).
  • On by default for glm5_next and qwen4_exp; every other model type is unchanged.
  • Fixed while porting: a content arm that stopped after the first detector item, an early tool-call header emitted for unregistered tools, and a pre-existing fixture bug in spark-server: tool-call guard (atlas-tool-guard crate, --tool-guard, default off; ported from Enntity) #227's tests (the guard defaulted on in a non-guard test).

Test plan (vs parent #229)

  • literal_xml 24/24, glm_tool_boundary 38/38, tool_security 9/9 (reiner)
  • tool probe, greedy C1 vs serial refs, BFCL ST-995 on the pair (job J35)

Tracking: #220.

Generated with Devin

@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Pair check vs parent (binary d0a68e2f, two GB10s, rc16 resident, qwen4_exp, where this PR is on by default):

Single run, different binaries from those receipts, so it's an observation: no tool-calling regression from the literal-XML parsing change on this draw.

@AzeezIsh
AzeezIsh force-pushed the stack/literal-tool-xml branch from 325a307 to 3d6af57 Compare October 29, 2026 04:44
@AzeezIsh
AzeezIsh force-pushed the stack/strict-mode branch 5 times, most recently from 2aed61a to 590c18d Compare October 29, 2026 07:30
@AzeezIsh
AzeezIsh force-pushed the stack/literal-tool-xml branch from 3d6af57 to 17b1638 Compare October 29, 2026 07:42
@AzeezIsh
AzeezIsh changed the base branch from stack/strict-mode to port/199-on-198 October 29, 2026 07:42
@AzeezIsh
AzeezIsh force-pushed the stack/literal-tool-xml branch 5 times, most recently from 9bfbf0a to be8d15a Compare October 29, 2026 08:54
…es and streams as text

Enntity's literal tool-XML mechanism (b1b5381, 69d32d3, 1c1a8fe,
AGPL-3.0-only): models whose tokenizers register tool-envelope XML as
added tokens (glm5_next, qwen4_exp) get a tagged sentinel family so
quoted <tool_call> markup in incoming message prose encodes as text,
reasoning preserves bare/split markup until the think-end token, and
detector-rejected envelopes stay content instead of being reparsed as
bare/JSON calls. LeakMarkers.for_literal_xml preserves parseable-
looking envelopes in the same models; bare-role literal filtering
stays for all other families. Off for every other model type:
glm_tool_markup_as_text only switches on for the two carriers.
Enntity/atlas fbda04d (AGPL-3.0-only): shared LiteralXmlState scanner
plus _with_literal_state sanitizer/detector/grammar hooks so parseable-
looking tool XML spelled as ordinary text stays prose end-to-end.
@AzeezIsh

AzeezIsh commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

GitHub closed this PR automatically during a restack: its base branch was briefly pushed to a commit containing its head, an accident reverted within minutes, and nothing reached main. Continued in #245, on the same branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant