Skip to content

Conversation

@RadonX
Copy link
Contributor

@RadonX RadonX commented Jan 15, 2026

Summary

  • Fix crash when resuming sessions by restoring toolUseResult field from JSONL
  • Fix empty 2xESC undo menu by persisting user text messages to JSONL
  • Fix missing messages in undo menu by correctly filtering mixed content messages

Test plan

  • Added unit tests for filterUserTextMessagesForUndo function
  • Added integration tests for toolUseResult restoration from session files
  • Manual test: Resume a session and verify no crash occurs
  • Manual test: Resume a session and verify 2xESC undo menu shows user messages

Fixes #161

🤖 Generated with Claude Code

This PR fixes three issues with session resume:

1. toolUseResult was not restored when loading sessions from JSONL,
   causing crashes in FileEditToolUpdatedMessage and OutputLine components

2. User text messages were never persisted to JSONL, causing the 2xESC
   undo menu to be empty after resume

3. Messages with mixed content (tool_result + text) were incorrectly
   filtered from the undo menu

Changes:
- Restore toolUseResult field in normalizeLoadedUser()
- Persist user text messages in query() before the query loop
- Extract filterUserTextMessagesForUndo() as a pure function
- Fix filtering to check if ALL blocks are tool_result, not just first

Fixes shareAI-lab#161

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant