opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feature request: pagination for messages & sessions

Open ariane-emory opened this issue 1 month ago • 7 comments

Description

I used to be able to scroll allllll the way back to the start of sessions, even after hundreds (or thousands) of pages of interactions with the model.

This seems to have broken some time in the past week, and I can no longer scroll back to the start of long sessions, hitting home to go to the start instead seems to scroll back to some random point in the session, from which it will not let me scroll further.

I regularly have the need to scroll back by several hundred pages, and this has been making it extremely difficult to get anything done in opencode for the past day, this bug has made the program nigh unusable.

Please implement some solution to this problem. Probably, it should be configurable in opencode.jsonc with a tui.messages_limit setting that can be either a positive integer denoting how many message parts to display or "none" to display all messages.

OpenCode version

1.0.122

Steps to reproduce

  1. Launch opencode and produce a lengthy session (for example engage in several hundred turns of interaction with the model involving many tool calls).
  2. Hit home.
  3. Observe that the viewport is moved to some random point part ways through the session instead of to the beginning of the session.

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

ariane-emory avatar Nov 30 '25 10:11 ariane-emory

This issue might be a duplicate of existing issues. Please check:

  • #4196: Reading chat history during LLM responses re-snaps the history (likely related scroll/position management issue)
  • #3746: Long prompt history stalls the app, long load time (related to long session handling)
  • #3652: opentui: ctrl+alt+u/d to scroll up or down does not work (related keyboard navigation)
  • #3422: opentui: doesn't 'auto scroll' as stuff streams in (related scroll position issue)

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Nov 30 '25 10:11 github-actions[bot]

The /sessions menu also no longer shows all my sessions: sessions from a week or two back that I was still working with have vanished from the list available for selection in the /selections modal window. They look like they're still in ~/.local/share/opencode/storage/ (I can see several hundred files in the relavant folder there), but are no longer available for selection in the menu.

This should probably be configurable with a tui.sessions_list_limit setting that can be either a positive integer or "none" to display all sessions.

Probably, adding both the tui.messages_limit in my original Issue description and tui.sessions_list_limit is the way to go.

ariane-emory avatar Nov 30 '25 14:11 ariane-emory

We just need to add pagination for both right? I think that'd be better?

rekram1-node avatar Nov 30 '25 20:11 rekram1-node

I'm not too picky about the how, I just want the same pleasant UX that opencode had previously back, really. Last week, opencode used to have this wonderful behaviour:

  • <home> would always instantly take me instantly to the beginning of the session.
  • <end>would always instantly take me to the current end of the session.
  • In /sessions, I always had access to all of my sessions, including ones from 2 or 3 months back.

I'm quite open minded about how we get that UX back, I just want to find some resolution to this impactful regression. I'm perfectly happy to do some configuration, if this is no longer the default behaviour I have no complaints so long as I can do some configuration to restore it.

ariane-emory avatar Nov 30 '25 22:11 ariane-emory

@ariane-emory hm the behavior you're describing tho, that "bug" should only be existing in really long sessions and this has been around for at least a few weeks maybe a month or longer

rekram1-node avatar Dec 01 '25 02:12 rekram1-node

Unless I misunderstand you?

rekram1-node avatar Dec 01 '25 02:12 rekram1-node

@rekram1-node It's possible you're correct here: what I can say for sure is that I didn't notice the problem until earlier this week. Maybe my recent sessions have been shorter than usual, and I haven/t had one long enough to notice in a few weeks? That's totally possible - the "bug" could have been introduced earlier and it may have just took me a while to run into the issue and observe it.

The bots seem to concur, I asked Pickle and it says the limit was introduced here: Commit e45e94634f6202426070949a17bfb6a3d3b0b081 by Dax Raad, titled "only display last 100 messages in TUI"

ariane-emory avatar Dec 01 '25 09:12 ariane-emory