[PR #8999] feat(tui): load conversation and session history #12946

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

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

State: open
Merged: No


Summary

Adds on-demand message loading UI to the TUI, enabling users to access message history beyond the initial 100-message window.

Depends on: #8996 (adds ts_before and breakpoint API parameters)

Problem

Users cannot access message history beyond the initial 100 messages loaded on session init:

Solution

Two loading modes accessed via a "Load more messages" banner when 100+ messages are present:

  1. Load conversation history - Loads messages up to the next compaction summary, providing relevant context without overwhelming the UI
  2. Load full session history - Loads all remaining messages for complete session reconstruction

Key features:

  • Only pulls missing messages (uses ts_before timestamp anchoring)
  • Zero breaking changes - all parameters optional
  • Message roll-off maintained - works with existing 100-message pruning
  • Toast notifications show message counts

Why Two PRs?

This PR was split from the original #8627 to separate concerns:

  1. #8996 (API foundation) - Adds ts_before and breakpoint params to Session.messages(). This is a foundational capability that benefits:

    • This TUI implementation
    • Web client (currently reloads all messages)
    • SDK consumers building custom integrations
    • Other pagination approaches (#8535, #6656)
  2. This PR (TUI consumer) - Implements the user-facing feature using the API

This separation allows the API enhancement to merge independently and unblock multiple consumers.

Implementation

Client (sync.tsx):

  • loadConversationHistory() - calls API with breakpoint: true
  • loadFullSessionHistory() - calls API without breakpoint

UI (routes/session/index.tsx):

  • Synthetic __load_more__ message prepended when 100+ messages
  • Clickable options with hover states
  • Loading state prevents duplicate requests

Screenshots

From original PR #8627:

Option to load conversation or full session:
Load options

Loading conversation history:
Conversation history

Loading full session history:
Full session

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8999 **State:** open **Merged:** No --- ## Summary Adds on-demand message loading UI to the TUI, enabling users to access message history beyond the initial 100-message window. **Depends on:** #8996 (adds `ts_before` and `breakpoint` API parameters) ## Problem Users cannot access message history beyond the initial 100 messages loaded on session init: - Resolves #6137 - Cannot scroll to beginning of long conversations - Resolves #4918 - Feature request: pagination for messages & sessions - Resolves #7380 - Old messages disappear - Related to #6548 ## Solution **Two loading modes** accessed via a "Load more messages" banner when 100+ messages are present: 1. **Load conversation history** - Loads messages up to the next compaction summary, providing relevant context without overwhelming the UI 2. **Load full session history** - Loads all remaining messages for complete session reconstruction **Key features:** - Only pulls missing messages (uses `ts_before` timestamp anchoring) - Zero breaking changes - all parameters optional - Message roll-off maintained - works with existing 100-message pruning - Toast notifications show message counts ## Why Two PRs? This PR was split from the original #8627 to separate concerns: 1. **#8996 (API foundation)** - Adds `ts_before` and `breakpoint` params to `Session.messages()`. This is a foundational capability that benefits: - This TUI implementation - Web client (currently reloads all messages) - SDK consumers building custom integrations - Other pagination approaches (#8535, #6656) 2. **This PR (TUI consumer)** - Implements the user-facing feature using the API This separation allows the API enhancement to merge independently and unblock multiple consumers. ## Implementation **Client** (`sync.tsx`): - `loadConversationHistory()` - calls API with `breakpoint: true` - `loadFullSessionHistory()` - calls API without breakpoint **UI** (`routes/session/index.tsx`): - Synthetic `__load_more__` message prepended when 100+ messages - Clickable options with hover states - Loading state prevents duplicate requests ## Screenshots From original PR #8627: Option to load conversation or full session: ![Load options](https://github.com/user-attachments/assets/4adc651d-234e-4c86-b053-b915f8ad4e13) Loading conversation history: ![Conversation history](https://github.com/user-attachments/assets/0295acd6-4f65-4e0f-b3e2-138c78eee2a2) Loading full session history: ![Full session](https://github.com/user-attachments/assets/d1cc2074-724d-4edf-8dc0-e1bbd5dbdcb7)
yindo added the pull-request label 2026-02-16 18:17:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12946