[PR #8535] feat(session): bi-directional cursor-based pagination (#6548) #12782

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

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

State: open
Merged: No


Problem

Session message pagination lacked robust cursor-based navigation and reliable boundary behavior in the TUI, making long sessions harder to traverse and risking unbounded in-memory growth.

Solution

  • Implement bi-directional cursor pagination (before / after / oldest) in session + API layers with RFC 8288 Link headers and regenerated SDK types.
  • Wire boundary-aware TUI loading for mouse and command-path scrolling (PgUp/PgDn/line/half-page/Home/End), including edge-aware hints.
  • Normalize pagination errors so non-Error throws do not render as [object Object] and preserve revert markers on oldest/latest jumps while keeping a 500-message memory cap.
  • Add regression coverage across session/API/link-header logic and TUI pagination helper/edge-state flows.

Notes

  • Testing: bun --cwd packages/opencode test test/session/messages-pagination.test.ts test/server/session-messages.test.ts test/cli/tui/pagination-helpers.test.ts test/util/parse-link-header.test.ts (32 pass)
  • Typecheck: bun turbo typecheck (pass)
  • AI Assistance: OpenCode 4abf8049c + openai/gpt-5.3-codex (xhigh)
  • Review: Human operator reviewed

Related

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8535 **State:** open **Merged:** No --- ## Problem Session message pagination lacked robust cursor-based navigation and reliable boundary behavior in the TUI, making long sessions harder to traverse and risking unbounded in-memory growth. ## Solution - Implement bi-directional cursor pagination (`before` / `after` / `oldest`) in session + API layers with RFC 8288 Link headers and regenerated SDK types. - Wire boundary-aware TUI loading for mouse and command-path scrolling (PgUp/PgDn/line/half-page/Home/End), including edge-aware hints. - Normalize pagination errors so non-Error throws do not render as `[object Object]` and preserve revert markers on oldest/latest jumps while keeping a 500-message memory cap. - Add regression coverage across session/API/link-header logic and TUI pagination helper/edge-state flows. ## Notes - Testing: `bun --cwd packages/opencode test test/session/messages-pagination.test.ts test/server/session-messages.test.ts test/cli/tui/pagination-helpers.test.ts test/util/parse-link-header.test.ts` (32 pass) - Typecheck: `bun turbo typecheck` (pass) - AI Assistance: OpenCode 4abf8049c + openai/gpt-5.3-codex (xhigh) - Review: Human operator reviewed ## Related - Closes #6548 - Supersedes #6656 - Related to #6137, #6138
yindo added the pull-request label 2026-02-16 18:17:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12782