Skip to content

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

Closed
AzeezIsh wants to merge 11 commits into
port/199-on-198from
stack/literal-tool-xml
Closed

AzeezIsh wants to merge 11 commits into
port/199-on-198from
stack/literal-tool-xml

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Replaces #245. GitHub closed #245 automatically during a restack: its branch briefly pointed at a commit its base already contained. It's the same branch (stack/literal-tool-xml), now corrected; the history and receipts are on #245.

Replaces #230. GitHub marked #230 as merged automatically: during a restack, its base branch was briefly pushed to a commit containing its head (an accident, reverted within minutes). A merged PR can't be reopened. Nothing reached main. The branch is the same (stack/literal-tool-xml); #230 has the history and receipts.

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

…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

Copy link
Copy Markdown
Contributor Author

Re-cut onto main without the GLM dependency: port/literal-tool-xml-main (b0df9c209, on main 48f73b27c).

  • Kept: the qwen4_exp literal-XML path (scanner, tool-parser literal machinery, sanitizer and strip changes).
  • Dropped: the glm5_next grammar hooks that need glm: add native prefill and FP4-Local support for dual DGX Spark #199 (native_opener and its relatives, role_literal_leaks).
  • Tests: literal_xml 11, tool_security 10 and glm_tool_boundary 24 all pass.
  • Gating now on the pair (job 1033): main vs this branch, both on the rc16 profile, comparing C1/C8 greedy, tools 21/21 and BFCL ST-995. A PR from that branch follows once it passes, and this one closes in its favour.

@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Superseded by #279: the same port, re-cut onto main without the GLM (#199) dependency. Pair-gated: C1/C8 identical to main, tools 21/21, BFCL ST-995 87.54 / 86.85 on both arms.

@AzeezIsh AzeezIsh closed this Oct 31, 2026
AzeezIsh added a commit that referenced this pull request Oct 31, 2026
…es as text for qwen4_exp (ported from Enntity; replaces #253)

Pair-gated (#220): C1/C8 identical to main, tools 21/21, BFCL ST-995 87.54 / 86.85 on both arms. CI green except the PR benchmark gate.
AzeezIsh pushed a commit that referenced this pull request Nov 1, 2026
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