Skip to content

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

Merged
AzeezIsh merged 15 commits into
mainfrom
port/literal-tool-xml-main
Oct 31, 2026
Merged

AzeezIsh merged 15 commits into
mainfrom
port/literal-tool-xml-main

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Summary

Replaces #253. Same port, re-cut onto main without the GLM (#199) dependency.

  • Ports Enntity's literal tool-XML handling (AGPL-3.0, data-angel: b1b53814, fbda04d1, 69d32d3e, 1c1a8fee), plus the fixes we made while porting, with credit in each commit.
    • Tool markup that the model writes as prose, inside quotes or inside code fences now stays text instead of being parsed as a tool call.
    • On by default for qwen4_exp; other model types are unchanged.
  • Dropped: the glm5_next grammar hooks that need glm: add native prefill and FP4-Local support for dual DGX Spark #199's infrastructure (native_opener/with_native_opener/opens_output, role_literal_leaks). glm5_next behaviour on main is unchanged.
  • CI config change (flagging for review):
    • handle_token/inner.rs (544 LoC) is the single function extracted from handle_token.rs, which is already on the file-size allow-list. It gets the same exemption, listed next to its parent in .github/workflows/file-size-cap.yml.
    • It can't be split by moving items, because it's one function.

Test plan

  • literal_xml 11, tool_security 10 and glm_tool_boundary 24 all pass (reiner). clippy and fmt are clean.
  • Pair check on reiner + spark2, TP=EP=2, rc16 profile. Both binaries were built fresh: main 48f73b27c vs this branch b0df9c209. Receipts are in reiner's ~/code/night1027/out/litxml-b0df9c209/.
    • C1 and C8 greedy text: 8/8 identical to main.
    • Tools: 21/21 on both arms.
    • BFCL ST-995 (the MLPerf ST leg, no overrides): this branch scores overall 87.54 / normalized 86.85 (run-1793435783103906797). Main scores the same, 87.54 / 86.85 (run-1793428757486602038). One run per arm.

Part of bringing SparkQwen 0.4.0 onto main (#220). The tool and grammar follow-ups (the tool-call-or-JSON union and the 10-22 literal-XML fixes) are stacked on this branch as the next PR.

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.

(cherry picked from commit 6d43eca)
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.

(cherry picked from commit 40e464d)
…00-LoC cap, no logic edits)

(cherry picked from commit 52d5ca2)
…eral_leaks, native_opener grammar arms, set_complete_poolside_calls)
devin-ai-integration Bot and others added 3 commits October 31, 2026 04:44
The LoC split left the doc comment above the `mod omni_pads`
declaration, which clippy rejects (`empty_line_after_doc_comments`).
The text is unchanged.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…hen -> map

The path-sibling splits moved `finalize_response`, `advance_name_run` and
`marker_prefix_hold_start` but left their doc comments above the `mod`
lines (clippy `empty_line_after_doc_comments`). The text is unchanged.
`inner.rs` takes 0.4.0's `.map` form (clippy `bind_instead_of_map`).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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