Skip to content

opencode export outputs messages in wrong order for long sessions #7426

Closed as not planned

Description

@jchuder

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

  1. Create a long session with 100+ messages over multiple hours/days
  2. Run opencode export <session_id>
  3. 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

Activity

  1. github-actions commented on Jan 9, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of or related to existing issues. Please check:

    These issues are related to message ordering/handling in long sessions but may have different root causes. Feel free to ignore if your specific case differs from these.

  2. thdxr commented on Mar 25, 2026

    @thdxr
    Member

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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