MoonshotAI / MoonshotAI/kimi-code
[BUG] Web UI:多轮会话发送消息后用户消息气泡丢失、AI 回复错位(疑似乐观回显对账失配)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
你运行的 Kimi Code 版本是?
0.41.0 首次确认(已导出诊断包);0.42.0 停用全部浏览器扩展后仍复现
你使用的是哪个开放平台/订阅?
Kimi Code 订阅
你使用的是哪个模型?
kimi-code/k3
你的电脑平台是?
Darwin arm64(macOS,Apple Silicon)
你遇到了什么问题?
kimi web 本地 Web UI 的多轮会话中,发送消息后间歇出现:
- 刚发出的用户消息气泡消失(输入框已清空、prompt 已被接受,但聊天记录里看不到这条用户消息);
- AI 回复与问题错位——回复挂到了不是它回答的那条消息位置上。
关键佐证:
- 停用所有浏览器扩展后问题依旧,排除第三方扩展干扰;
- 通过会话导出诊断包核对 wire.jsonl:用户消息与 AI 回复在后端事件流中完整、按序落盘(prompt.accepted → context.append_message → turn.ended → prompt.completed 链路齐全),LLM 请求日志全部正常——数据没有丢失,丢失的是「显示」;
- 问题只出现在流式增量渲染过程中;按源码分析,刷新页面走全量重建路径后显示可恢复正常。
复现步骤?
- 配置任一 UserPromptSubmit hook(每次发送会向上下文注入一条或多条
origin.kind = hook_result / injection、无 message id 的 user 角色消息); kimi web打开一个会话,连续进行多轮对话,期间重复发送相同的短文本(如「继续」);- 观察:某次发送后用户气泡消失、后续回复错位。
期望的行为是什么?
用户消息气泡发送后稳定显示,AI 回复始终与它所回答的问题正确对应。
补充信息
源码层面的定位线索(供维护者参考,基于 0.42.0 前端 bundle 阅读):
- 前端发送消息后先挂乐观气泡(optimistic message),等服务端回显后由对账逻辑(
consumedEchoPromptIds/consumedBundledEchoIds及相关的文本/floor/promptIds 匹配器)将乐观气泡替换为真实 turn; - 该对账疑似在两个因素叠加时失配:
- hook 注入的无 id user 消息打乱了增量帧序列——全量重建路径有
origin.kind过滤(hook_result/injection 不渲染),但增量对账路径疑似不按 origin 过滤; - 多轮重复发送相同文本时,按文本相等的回显匹配存在歧义,可能对到历史 prompt 上;
- hook 注入的无 id user 消息打乱了增量帧序列——全量重建路径有
- 失配的最终表现与症状吻合:乐观气泡被清理而真实回显未挂载(用户消息「丢失」),回复锚定到错误位置(「错位」)。
疑似相关的已知 issue:#3464(client 端渲染缺陷的 wire 级取证)、#3617(Web UI 中断 turn 后回复渲染错位)。本 issue 场景不涉及手动中断,触发条件不同,单独跟踪。
诊断导出包含有会话内容,不便直接公开;如需要,可私下提供脱敏版本。
Contribution
- 我愿意自己提交修复此 bug 的 PR(请先等待维护者在本 issue 中批准)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in kimi web with a UserPromptSubmit hook and repeated short prompts, then compare incremental rendering with the full rebuild path using the exported wire.jsonl evidence. Inspect the optimistic-message reconciliation around consumedEchoPromptIds, consumedBundledEchoIds, and the text/floor/promptIds matchers, including origin.kind filtering. Done means injected messages are not rendered, each user bubble remains visible, and every AI reply stays attached to its corresponding prompt.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100