Skip to content

Disaggregated router: apply the chat stream filter to output #198

Closed

Description

@inureyes

Context

Follow-up from epic #116 (#126, router front). The disaggregated router does not strip model-specific structural tokens from its output.

Problem

The single-node chat route applies a StreamFilter (src/server/tool_calls/stream_filter.rs:249) that strips <think>, <|channel>, tool-call markers, and stray turn tokens from content deltas and routes thinking content to reasoning_content. The disaggregated router (src/server/router_front.rs) forwards the decode node's raw detokenized text directly into the SSE delta.content, so for reasoning models or tool-calling prompts those markers leak to the client. This is why tests/disaggregated_router_e2e.rs currently uses enable_thinking=false.

Implementation

  • Instantiate a StreamFilter per request in the router handler, mirroring the chat route's setup (including the primed-open-thinking start state when the rendered prompt ends inside an open thinking block).
  • Feed each decode-node text piece through the filter in drive_handoff_result; emit filtered content into delta.content and thinking content into delta.reasoning_content.
  • Handle the prefill node's first token the same way (it can be the first reasoning token).
  • Decide whether tool-call parsing (accumulate-then-parse) is in scope here; if deferred, document that the router supports content + reasoning_content but not tool_calls yet.

Acceptance criteria

  • A reasoning-model request through the router (thinking enabled) returns the same content/reasoning_content split as the single-node chat route.
  • tests/disaggregated_router_e2e.rs gains a thinking-enabled case (or a new test).

Activity

  1. added
    status:ready
    type:bug
    priority:medium
    area:architecture
    on Jun 9, 2026
  2. added this to the 0.2 milestone on Jun 21, 2026
  3. self-assigned this
    on Aug 31, 2026
  4. added
    status:done
    and removed
    status:ready
    on Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:architecturepriority:mediumstatus:donetype:bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions