Repository navigation
fix: match Muse Glimmer parsing to vLLM - #197
Conversation
(cherry picked from commit d477c7c83abf11c4570366fae03ac8c8e21f1bf9)
(cherry picked from commit d6d6fa6853a84bfe3bfd44c4696089ae908748fc)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 49ada0e. Configure here.
| if "<atem:invoke" in remainder or "<atem:function_calls>" in remainder: | ||
| content = remainder | ||
| elif not content: | ||
| content = "" if "to=self<|message|>" in text else text |
There was a problem hiding this comment.
Reasoning hides malformed tool text
Medium Severity
When a tool channel cannot be dispatched and has no ATEM tags, parse_response sets content to an empty string if the completion also contains a reasoning span. That discards the reasoning-stripped leftover instead of keeping it, so the model’s tool-channel words vanish from the assistant message.
Reviewed by Cursor Bugbot for commit 49ada0e. Configure here.
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — This PR changes production Muse Glimmer parsing semantics for whitespace, tool names, argument decoding, and malformed tool output. An unresolved review finding identifies a case where malformed tool-channel text following reasoning may be discarded, requiring human review. Notes:
You can add or adjust custom eligibility rules. Learn more. |


Muse Glimmer response parsing differs from stock vLLM for tool arguments, duplicated tool names, malformed invocations, and trailing answer newlines. For example, an ATEM value of
123currently stays a string when the tool schema declares a string; vLLM decodes it to the integer123.Decode ATEM parameter values as JSON with a raw-text fallback, normalize duplicated registered bare tool names such as
get_weather.get_weather, and preserve malformed tool markup as content without synthesizing dispatchable call names. Match vLLM's non-streaming handling of one final newline in an open answer while retaining newlines in closed answers and answers accompanying tool calls.Add focused regression cases and update the shared argument tests to assert Glimmer's schema-independent decoding, retaining coverage for booleans, integers, null, arrays, and objects.
Validation:
uv run --frozen pytest tests/ -k 'muse or Muse' -q: 598 passed, 4 skipped.uv run --frozen ruff check .anduv run --frozen ruff format --check .: passed.uv run --frozen ty check renderers: exited successfully with 62 warning diagnostics.git diff --check origin/main...HEAD: passed.Note
Match Muse Glimmer response parsing to vLLM behavior
MuseGlimmerRenderer.parse_responsein muse_glimmer.py now works from a set of registered tool names instead of a schema index, matching the vLLM reference parserjson.loadswhen possible and kept as text otherwise, without consulting tool schemas; scalar JSON values declared as strings are decodedtool.toolNone, and callers relying on that name will see the changeMacroscope summarized 49ada0e.
Note
Medium Risk
Parsing behavior changes for tool arguments, malformed tool channels, and trailing newlines; clients that assumed schema-preserved strings or recipient-filled error tool names may see different
contentandtool_calls.Overview
Aligns Muse Glimmer
parse_responsewith stock vLLM instead of schema-driven ATEM parsing.Tool calls: Parameter bodies are decoded with
json.loadswhen possible and left as text otherwise—no tool-schema coercion—so values like123orfalsebecome JSON scalars even when the schema saysstring. Invocation names are validated against registered tools, with normalization for doubled bare names (tool.tool→tool). Malformed or unclosed invocations no longer borrow the channel recipient asname(nameisNone); when nothing dispatchable parses, reasoning is stripped and leftover ATEM markup is kept incontent.Answers: Drops one trailing newline from an open
to=useranswer (no tools), while closed answers and post-tool answers keep their trailing newlines.Tests add vLLM parity cases and teach the shared tool-arg suite that Glimmer expects schema-independent JSON decoding.
Reviewed by Cursor Bugbot for commit 49ada0e. Bugbot is set up for automated code reviews on this repo. Configure here.