Skip to content

kimi web: history re-render inserts newlines between stream chunks (third-party OpenAI-compatible providers only) #2323

Description

@00007-ym

English

Environment

  • Kimi Code 0.29.2, Windows 11 (win32-x64, native binary installed via install script)
  • Browser: Chrome, kimi web UI

Bug description
In kimi web, assistant messages from sessions using a third-party OpenAI-compatible provider render fine during initial streaming, but after leaving the session and coming back (or reloading the page), the re-rendered message has a newline inserted after every streaming chunk. Long replies render as vertical text with words split mid-token (e.g. grad\nlew, 1152\nm). Copying the message preserves these spurious newlines, so they exist as real \n characters in the DOM text nodes.

Steps to reproduce

  1. Configure a custom provider in ~/.kimi-code/config.toml with type = "openai" (e.g. Alibaba Qwen Token Plan or MiniMax), plus a model alias.
  2. Start kimi web, create a session, select that model, and ask for a long markdown reply.
  3. Observe the reply renders normally while streaming.
  4. Switch to another session (or reload the page), then return to this session.
  5. The assistant message now renders with a line break every ~4-8 characters.

What I verified

  • The session's wire.jsonl stores the assistant text cleanly — the assembled message has no spurious newlines. The streaming text parts are stored as small chunks (~4-8 chars each), which exactly match the broken "lines" seen in the UI.
  • The re-rendered DOM contains real \n characters inside span.text-node text nodes (with white-space: normal), so the frontend joins stream chunks with newlines when rebuilding history.
  • Sessions using the managed provider (managed:kimi-code, model k3) do NOT show this bug — checked 24 text-node spans, zero spurious newlines. Only third-party openai-provider sessions are affected.

Suspected cause
The history re-render path joins streaming text parts with \n instead of concatenating them, for sessions on third-party OpenAI-compatible providers.

Session with reproduction

  • Session ID: session_808a0a04-2322-432b-a59f-0980c5d4f268
  • I can provide the kimi export debug ZIP of this session privately on request (it contains personal content, so I'd rather not attach it publicly).

中文

环境

  • Kimi Code 0.29.2,Windows 11(win32-x64,安装脚本装的原生二进制)
  • 浏览器:Chrome,kimi web 界面

问题描述
kimi web 中,使用第三方 OpenAI 兼容 provider 的会话,assistant 消息在流式输出时显示正常;但离开会话再返回(或刷新页面)后,重新渲染的消息在每个流式分片之间被插入了换行。长回复变成竖排文字,单词从中间断开(如 grad\nlew1152\nm)。复制该消息会带出这些多余换行,说明 DOM 文本节点里存在真实的 \n

复现步骤

  1. ~/.kimi-code/config.toml 中配置 type = "openai" 的自定义 provider(如阿里千问 Token Plan、MiniMax)及模型别名。
  2. 启动 kimi web,新建会话,选择该模型,让其输出较长的 markdown 回复。
  3. 流式输出时渲染正常。
  4. 切换到其他会话(或刷新页面)后再返回。
  5. assistant 消息变成每 4~8 个字符一行。

已验证

  • 会话的 wire.jsonl 中存储的文本是干净的——组装后的完整消息没有多余换行。流式 text 分片以每段约 4~8 字符存储,与界面上断裂的"行"一一对应。
  • 重渲染后的 DOM 中,span.text-node 文本节点内存在真实 \nwhite-space: normal),即前端在重建历史消息时用换行拼接了流式分片。
  • 使用官方托管 provider(managed:kimi-code,模型 k3)的会话没有此问题——检查 24 个文本节点,0 个异常换行。仅第三方 openai provider 的会话受影响。

疑似原因
第三方 OpenAI 兼容 provider 会话的历史消息重渲染路径,把流式文本分片用 \n 拼接而非直接连接。

可复现的会话

  • Session ID:session_808a0a04-2322-432b-a59f-0980c5d4f268
  • 该会话的 kimi export 调试 ZIP 可应要求私下提供(含个人内容,不便公开附件)。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions