Skip to content

[BUG] /resume时的多个问题:崩溃、2xESC撤销菜单为空、用户消息丢失 #161

@RadonX

Description

@RadonX

Bug Description

在使用 resume 命令恢复会话时,存在以下三个相关问题:

1. 会话恢复时崩溃

使用 kode resume 恢复会话

  • FileEditToolUpdatedMessage 组件报错:"to" property undefined
  • OutputLine 组件报错:content 为 undefined

根本原因:
src/utils/protocol/kodeAgentSessionLoad.ts 中的 normalizeLoadedUser() 函数在从 JSONL 会话文件加载用户消息时,没有恢复 toolUseResult 字段。该字段在保存时被写入文件,但加载时被忽略,导致 UI 组件访问 message.toolUseResult.data 时崩溃。

2. 恢复会话后 2xESC 撤销菜单为空

  1. resume 一个之前的会话
  2. 按两次 ESC 键打开"Jump to a previous message"菜单
  3. 菜单中没有任何历史用户消息

根本原因:
src/app/query.ts 中的 query() 函数只持久化从 queryCore() yield 出来的消息(助手响应和工具结果)。用户输入的文本消息(触发查询的消息)从未被保存到 JSONL 会话文件中。

检查实际会话文件可以发现:
file-history-snapshot
assistant (tool_use)
user (tool_result)
user (tool_result)
...
完全没有用户文本消息记录。

App and Environment Info

Kode Version: macos, WarpTerminal, v2.0.2

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