Description
opencode export <session_id> outputs messages in wrong order for long sessions. The first part of the conversation appears in the middle or end of the export.
Root cause: Session.messages() uses result.reverse() which only reverses the alphabetical order from Storage.list(). Message IDs are random strings (e.g., msg_19b9ed* vs msg_b9946c*), so alphabetical order ≠ chronological order.
Plugins
None
OpenCode version
1.1.8
Steps to reproduce
- Create a long session with 100+ messages over multiple hours/days
- Run
opencode export <session_id>
- Check the message order — early messages appear in the middle or end instead of the beginning
Screenshot and/or share link
N/A
Operating System
macOS
Terminal
Ghostty