[PR #10198] feat: add offset parameter for message pagination #13364

Open
opened 2026-02-16 18:18:13 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10198

State: open
Merged: No


Summary

  • Add offset query parameter to GET /session/:id/message endpoint for efficient pagination
  • Update desktop app's loadMore to use offset-based loading instead of re-fetching all messages
  • Only fetches additional messages needed, then merges them into existing state

Problem

Previously, loading more messages in long sessions required re-fetching all messages from the start with an increased limit. For example, to load 100 more messages when you already have 400, the client would fetch all 500 messages again.

Solution

With the new offset parameter, clients can skip already-loaded messages:

  • Initial load: GET /session/:id/message?limit=400 (400 messages)
  • Load more: GET /session/:id/message?limit=100&offset=400 (only 100 new messages)

This reduces bandwidth and improves performance for long sessions.

Test plan

  • Verify initial message loading still works
  • Verify loading more messages appends correctly
  • Verify complete flag is set when no more messages exist
  • Test with sessions of varying lengths

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10198 **State:** open **Merged:** No --- ## Summary - Add `offset` query parameter to `GET /session/:id/message` endpoint for efficient pagination - Update desktop app's `loadMore` to use offset-based loading instead of re-fetching all messages - Only fetches additional messages needed, then merges them into existing state ## Problem Previously, loading more messages in long sessions required re-fetching all messages from the start with an increased limit. For example, to load 100 more messages when you already have 400, the client would fetch all 500 messages again. ## Solution With the new `offset` parameter, clients can skip already-loaded messages: - Initial load: `GET /session/:id/message?limit=400` (400 messages) - Load more: `GET /session/:id/message?limit=100&offset=400` (only 100 new messages) This reduces bandwidth and improves performance for long sessions. ## Test plan - [ ] Verify initial message loading still works - [ ] Verify loading more messages appends correctly - [ ] Verify `complete` flag is set when no more messages exist - [ ] Test with sessions of varying lengths 🤖 Generated with [Claude Code](https://claude.ai/code)
yindo added the pull-request label 2026-02-16 18:18:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13364