Skip to content

fix(muse-glimmer): parse required/named tool calls natively - #34781

Merged
Jiminator merged 2 commits into
sgl-project:mainfrom
sid-rp:muse-glimmer-required-native-toolcall
Aug 14, 2026
Merged

Jiminator merged 2 commits into
sgl-project:mainfrom
sid-rp:muse-glimmer-required-native-toolcall

Conversation

@sid-rp

@sid-rp sid-rp commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Motivation

Muse Glimmer only ever emits ATEM (<atem:function_calls>) tool calls. With tool_choice="required" or a named tool, the current path routes to JsonArrayParser and constrains generation with a JSON-array grammar. The model
does not emit that JSON format for tool calls, so when it produces its native ATEM block instead, JsonArrayParser cannot parse it - the call leaks to the client as content with finish_reason="stop" and zero tool_calls.

This reproduces on main. It is deterministic on a turn whose message history already contains a prior assistant tool_calls turn (both streaming and non-streaming, at the default --stream-interval): the model opens a tool channel and writes native ATEM, which the JSON path drops. tool_choice="auto" is unaffected - it already parses the native ATEM through MuseGlimmerDetector.

Modifications

MuseGlimmerDetector.parses_required_natively() now returns True. This routesrequired/named tool_choice through the detector's native ATEM parsing - the same path tool_choice="auto" already uses - instead of the JSON-array grammar. Single-file change; no other behavior is altered.

Accuracy Tests

Verified before/after on main serving Muse-Glimmer-30B (BF16, single GPU), --tool-call-parser muse --reasoning-parser muse, default --stream-interval:

tool_choice before after
auto (single + multi-turn) tool call returned tool call returned (unchanged)
required / named, single-turn tool call returned tool call returned
required / named, multi-turn (prior tool_calls turn) 0 tool calls, ATEM leaked as content tool call returned

Existing test/registered/unit/function_call/ suite passes with the change.

Speed Tests and Profiling

No inference-speed impact - the change only selects which parser handles the already-generated output for required/named tool_choice.

Checklist

  • Format your code according to the Format code with pre-commit.
  • Add unit tests (recommend a regression case for the multi-turn required/named path).
  • Update documentation - n/a.
  • Provide accuracy and speed benchmark results - see above; no speed impact.
  • Follow the SGLang code style guidance.

CI States

Latest PR Test (Base): ❌ Run #31792190115
Latest PR Test (Extra): ✅ Run #31792189989

Muse Glimmer only ever emits ATEM tool calls. With tool_choice=required
or a named tool, the default path forces a JSON-array grammar (via
JsonArrayParser) that the model does not emit for tool calls; when it
produces its native ATEM block instead, the JSON parser cannot read it
and the call leaks to the client as content with zero tool calls.

Return True from parses_required_natively() so required/named decode
through the native ATEM parser, the same path tool_choice=auto uses.
@sid-rp
sid-rp requested a review from JustinTong0323 as a code owner August 13, 2026 22:19
@Jiminator

Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@Jiminator Jiminator self-assigned this Aug 14, 2026

@JustinTong0323 JustinTong0323 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JustinTong0323

Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci extra

@Jiminator
Jiminator enabled auto-merge (squash) August 14, 2026 10:28
@JustinTong0323

Copy link
Copy Markdown
Collaborator

/rerun-failed-ci

@Jiminator
Jiminator merged commit 42e8718 into sgl-project:main Aug 14, 2026
243 of 262 checks passed
saturn-acc pushed a commit to saturn-acc/sglang that referenced this pull request Aug 16, 2026
Atituiset pushed a commit to Atituiset/sglang that referenced this pull request Sep 10, 2026
…ect#34781)

Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants