Replies: 1 comment
[Bug] Chat history fails to load with providers that reuse tool-call ids ("received more than one start Match")SummaryThe Web GUI's conversation assembler keys each Depending on which path hits it, the user sees:
Records look "lost", but the durable session log is intact — it is purely a client-side rendering crash. It reproduces every time the duplicated callId falls inside the loaded window. Root cause
match: (event) => {
if (event.type === 'tool/call') return { id: String(event.data.callId), role: 'start' }
...
}The Definition assumes Reproduction
Minimal logic check over any such log: collect Suggested fixScope the Context identity by the coordinates that are unique per executed call. A step executes at most one assistant message, so if (event.type === 'tool/call')
return { id: `${event.data.turn}:${event.data.step}:${String(event.data.callId)}`, role: 'start' }
if (event.type === 'tool/result' && isAppendSurfaceEvent(event))
return { id: `${event.data.turn}:${event.data.step}:${String(event.data.message.source.callId)}`, role: 'update' }
I verified this locally against a real failing session log (1226 events, 54 tool calls with heavy id reuse): the original matcher crashes immediately; the scoped matcher loads the full window and paginates all pages with zero invariant violations, and every result/dispatch still correlates onto its call (deterministic ids also let a prepended call heal a previously orphaned result). Happy to share the full patch and the test scripts if useful. Environment
|
Uh oh!
There was an error while loading. Please reload this page.
标题:[Bug] Chat history fails to load with providers that reuse tool-call ids ("received more than one start Match")
要点:
现象:用 kimi-k3 等 id 按消息编号的模型时,打开历史/加载更早/直播中都会因 conversation Context 9:tool-calljob_output_0 received more than one start Match 崩溃,整窗只剩 Deep diving;数据未丢,纯客户端渲染崩溃
根因:tool.ts 的 match 用裸 callId 做 Context 键,假设了会话级唯一,但协议只保证单条消息内唯一(dsh-llm 自己的 call-${index} 兜底也同样如此)
复现:同一会话多个 step 调用同一工具 → 重新打开会话或点"加载更早" → 100% 复现
建议修复:Context 键改为 ::(tool/call 和 tool/result 都带 turn/step);code-dispatch 事件无 turn/step,用按 seq 的最近调用索引归属;审批面板的 rootToolCall 反查改为扫描最新匹配节点
验证:真实崩溃日志 1226 条事件回放,旧逻辑立即崩溃,新逻辑全窗口+分页均零冲突、54 对调用/结果全配对
环境:dsh 0.1.0-rc.8 / macOS / kimi-k3,master 分支仍存在
All reactions