Skip to content

[Bug] DeepSeek DSML tool-call markers leak into assistant content and streamlit UI #804

Description

@ZhulongNT

Summary

When using DeepSeek with tool calls, raw DSML markers such as <‖DSML‖tool_calls> and <‖DSML‖invoke ...> are leaking into the assistant content field. Downstream consumers (UI/TUI) then display or speak these internal markers.

Suggested fix

  • Add DSML marker detection before emitting content.
  • Strip / normalize Unicode variants (‖, |, etc.).
  • Keep tool-call data only in structured tool_calls.
  • Add regression tests with streaming chunks split across markers.

Reference

Activity

  1. ZhulongNT commented on Sep 22, 2026

    @ZhulongNT
    ContributorAuthor

    补充一组实际 model_responses 扫描结果(2026-09-22):

    • 排除执行本次检索的当前会话文件,历史响应中仍有 911 处(28 个文件)不区分大小写的 DSML 命中。
    • 高频真实泄漏形式不是只有 <‖DSML‖...>,还包括双全角竖线形式,例如:
      • <||DSML||parameter ...>
      • </||DSML||parameter>
      • <||DSML||tool...>
    • 另外需要处理 SSE chunk 恰好从标记中间切开的情况。例如两个 chunk:
      • hello<‖DS
      • ML‖tool_calls>world

    如果过滤器逐 chunk 检查完整字符串 DSML,上述分块会原样泄漏。建议修复时使用跨 chunk 的小型状态机/尾部缓冲,并覆盖 ‖...‖、||...||、|...| 的开闭标签及分块边界回归测试。

  2. lsdefine commented on Sep 29, 2026

    @lsdefine
    Owner

    Closing as won't fix, see the discussion in #805: DSML leaking into content is a serving/parser-side issue, and we keep model output faithful on the agent side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions