Repository navigation
fix: apply the chat stream filter to disaggregated router output - #212
Merged
Merged
Conversation
be-free-snowboy
pushed a commit
to freestylejs/snowbrain-mlxcel
that referenced
this pull request
Oct 27, 2026
…lup#212) * fix: apply the chat stream filter to disaggregated router output * refactor: import FilterOutput alongside StreamFilter
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.
Closes #198
Problem
The disaggregated router (
src/server/router_front.rs) forwarded the decode node's raw detokenized text directly into the SSEdelta.content. For reasoning models or tool-calling prompts, model-specific structural markers (<think>,<|channel>, tool-call delimiters, stray turn tokens) leaked to the client, and thinking content was never routed toreasoning_content. This is whytests/disaggregated_router_e2e.rsonly coveredenable_thinking=false.Implementation
StreamFilterthe single-node chat route uses, including the primed-open-thinking start state when the rendered prompt ends inside an open thinking block (is_prompt_primed_open_thinking, nowpub(crate)).delta.content, thinking content todelta.reasoning_content(newchat_chunk_reasoninghelper). The filter is flushed after the handoff completes so buffered partial-delimiter text is not lost.message.reasoning_contentwhen the filter routed any thinking text.tool_calls) is deferred and documented in the module docs: the router emitscontentandreasoning_contentonly; tool-call delimiter markers are suppressed by the filter.Verification (M1 Ultra, qwen3-0.6b-4bit, real 3-process E2E)
disaggregated_router_filters_thinking_output: runs a thinking-enabled request against a single-node hybrid reference first, then through the 3-process router (prefill + decode + router). The router'sreasoning_contentandcontentare byte-identical to the single-node chat route's split (96 reasoning chars on the test prompt), and no<think>markers appear in either field.disaggregated_router_streams_correct_output(thinking disabled) still pins the byte-exact "2 + 2 = 4." output, confirming the filter is transparent for plain content.-D warnings, both feature sets),cargo fmt.