Skip to content

Conversation

@ryanwyler
Copy link
Contributor

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. feat(session): add ts_before and breakpoint params to Session.messages API #8996 (API foundation) - Adds ts_before and breakpoint params to Session.messages(). This is a foundational capability that benefits:

  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

…s API

Add optional parameters to Session.messages() for loading older messages:
- ts_before: filter to messages created before this timestamp
- breakpoint: stop at first compaction summary when true

This is a foundational API enhancement that enables clients to implement
pagination and history loading without breaking existing functionality.
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one highly related PR that appears to be the original version of the current PR:

Related PR

PR #8627 - feat(tui): load conversation and session history

Additional Context

The search also found:

However, #8627 is the most directly related as it represents the original work that was intentionally refactored and split into the current PR (#8999).

Adds UI for loading older messages in long-running sessions:
- 'Load more messages' banner appears when 100+ messages present
- Two loading modes: conversation history (stops at compaction) and full session
- Toast notifications show count of messages loaded

Depends on: PR anomalyco#8996 (ts_before and breakpoint API params)
@ryanwyler ryanwyler force-pushed the feature/tui-load-history-ui branch from b630fd4 to fdd508a Compare January 17, 2026 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant