Repository navigation
fix: preserve GLM string arguments and stream Inkling tool calls - #3653
Merged
Merged
Conversation
Restrict Chat Completions EOF buffering in `ChatToolCallStream` to the Inkling family so Hermes, Qwen3-Coder, Mistral, Llama 3, and DeepSeek-V4 DSML retain live incremental streaming (lablup#2396), and restore the DSML live-streaming route test. Preserve wire spelling in `plan_buffered` when semantically identical Inkling JSON arguments differ only in formatting (such as `{"city": "Paris"}`), preventing spurious reconciliation warnings and single-chunk fallback on Chat Completions and Anthropic Messages. Validated with 599 `tool_calls`/`tool_call_stream`/`streaming_anthropic` unit tests, `cargo fmt --check`, and a real Metal `mlxcel-server` check on `models/glm-4.7-flash-4bit` preserving `' return x\n'` in a `write_file` tool call. Refs lablup#3629, lablup#3653
Member
Implementation Hardening SummaryAudited PR #3653 against issue #3629 across Findings & Fixes
Validation
|
inureyes
force-pushed
the
fix/3629-glm-inkling
branch
from
December 1, 2026 23:56
d07f256 to
789c38a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3629.
GLM-4.7 and LongCat now preserve indentation and trailing newlines for string arguments. Padded numbers and other JSON values still coerce, and quoted JSON strings decode normally. The shell-style fallback is unchanged.
Chat Completions and Anthropic Messages buffer tool fragments until the non-streaming parser confirms the call. Valid Inkling calls retain argument deltas; malformed or length-truncated calls emit no tool frame. Responses still streams tentative items and marks unfinished ones incomplete without replaying them as completed calls. Private frame offsets keep same-name siblings distinct without changing public Rust struct literals.
Both published Inkling 2 Mini and Small declare an empty join for repeated content and reasoning. With two explicit text messages, mlxcel classified the first as prompt-opened reasoning and dropped it. The parser now keeps both without adding a separator.
Verification: CPU-only, Metal disabled. Compared the GLM parser with the upstream Python implementation and Inkling with Neywa-Labs/mlx-vlm#2810 and the published response templates. Ran the filtered library suite, wire-event tests, independent regression review,
cargo fmt --checkandmake verify-used-by. The Metal-enabledmake verify-testgate and a real GLM-4.7 checkpoint generation were not run locally.The follow-up passed 910 filtered library tests (4 ignored), including route, wire-event and public struct-literal regressions, with Metal disabled and a 32 MiB test-thread stack.