Skip to content

Conversation

@CasualDeveloper
Copy link

@CasualDeveloper CasualDeveloper commented Dec 24, 2025

Summary

  • Add tui.message_limit config option to control how many messages are loaded per session (default: 100)
  • Add tui.session_list_limit config option to control how many sessions are shown in the session picker (default: 150)

Closes #6137
May also resolve #4918

Usage

{
  "tui": {
    "message_limit": 500,
    "session_list_limit": 200
  }
}

Changes

File Change
packages/opencode/src/config/config.ts Add message_limit and session_list_limit to TUI schema
packages/opencode/src/cli/cmd/tui/context/sync.tsx Use message_limit config
packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx Use session_list_limit config
packages/sdk/* Generated types

Copilot AI review requested due to automatic review settings December 24, 2025 23:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a configurable message_limit option to control the number of messages loaded per session in the TUI. The default value remains 100, but users can now configure it up to 10,000 messages through the config file.

  • Add message_limit configuration field to TUI schema with validation constraints (1-10,000)
  • Update implementation to use the configured value with fallback to 100
  • Generate corresponding TypeScript type definitions

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/sdk/openapi.json Adds message_limit field to the schema with integer constraints (1-10,000) and description
packages/sdk/js/src/v2/gen/types.gen.ts Generated TypeScript types for the new message_limit config option
packages/sdk/js/src/gen/types.gen.ts Generated TypeScript types with incorrect default value in documentation
packages/opencode/src/config/config.ts Adds Zod schema validation for message_limit with proper constraints
packages/opencode/src/cli/cmd/tui/context/sync.tsx Updates message loading to use configured limit with fallback to 100

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CasualDeveloper
Copy link
Author

Fixed the inconsistent default value in the SDK types (was 500, now correctly 100). Thanks Copilot!

@CasualDeveloper
Copy link
Author

Fixed second hardcoded 100 in the message.updated event handler at line 191. Without this, new messages arriving during active sessions would trim the array back to 100, defeating the configurable limit.

@CasualDeveloper
Copy link
Author

CasualDeveloper commented Dec 25, 2025

I have a working implementation ready - typechecks pass.

@ariane-emory
Copy link
Contributor

ariane-emory commented Dec 25, 2025

@CasualDeveloper I also want to see this feature. I've had a half-finished PR in my pocket for a while that addresses this (and also makes the length of session_list similarly configurable) I haven't found the time to finish it and yours looks like it may be cleaner than mine.

I cordially invite you to steal anything you think might be useful from my unfinished PR: ariane-emory#43

The team may (or may not) conclude that this also resolves my original Issue on the topic, #4918.

@CasualDeveloper
Copy link
Author

@ariane-emory Thanks for linking your PR! I've incorporated session_list_limit from your work. Kept the implementation simpler (no "none" option, proper types instead of as any casts). Added a reference to #4918 in the PR description.

Allow users to configure maximum messages loaded per session via
tui.message_limit config option (default: 100, max: 10000).

Previously hardcoded to 100, which prevented scrolling to earlier
messages in long conversations.
@CasualDeveloper
Copy link
Author

Re-committed with valid GPG signature. PR ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot scroll to beginning of long conversations (message limit hardcoded to 100) feature request: pagination for messages & sessions

2 participants