Skip to content

[FEATURE]: add cursor/offset pagination to GET /session/:id/message #20111

Closed as not planned

Description

@hmSchuller

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

GET /session/:id/message only supports a limit query parameter. There is no way to page backwards through history — you can fetch the last N messages, but you cannot fetch messages before a given message ID or offset.

For clients that want to show a paginated conversation view (e.g. load the last 10 messages on open, then let the user load earlier history), this means the only option is to fetch everything or accept a fixed truncation.

Long sessions with heavy tool use can produce very large payloads — easily hundreds of MB for a single session fetch. Without pagination, clients are forced to either transfer all of it or show incomplete history with no way to load more in a controlled way.

Proposed solution:

Add a before cursor parameter (message ID) to the endpoint:

GET /session/:id/message?limit=20&before=<messageID>

This would return the 20 messages immediately preceding <messageID>, enabling incremental backwards pagination.

A before cursor is preferable over a simple integer offset since message counts can change (e.g. after compaction), but either would be a meaningful improvement over the current state.

Activity

  1. changed the title [-]feat: add cursor/offset pagination to GET /session/:id/message[/-] [+][FEATURE] add cursor/offset pagination to GET /session/:id/message[/+] on Mar 30, 2026
  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 30, 2026
  3. changed the title [-][FEATURE] add cursor/offset pagination to GET /session/:id/message[/-] [+][FEATURE]: add cursor/offset pagination to GET /session/:id/message[/+] on Mar 30, 2026
  4. added
    needs:complianceThis means the issue will auto-close after 2 hours.
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Mar 30, 2026
  5. github-actions commented on Mar 30, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now meets the contributing guidelines. We appreciate the clear description of the problem and the proposed solution.

  6. assigned and unassigned on Apr 26, 2026
  7. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  8. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 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