opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(tui): add session_list_limit for session picker (#6137)

Open CasualDeveloper opened this issue 3 weeks ago • 13 comments

Summary

  • Add configurable session_list_limit for the session picker (default 150)
  • Apply limit only when not searching (search continues to use server-side limit 30)
  • Regenerate SDK types and openapi.json

Notes

  • message_limit has been removed; cursor-based pagination (#8535) now covers message history
  • No changes to sync.tsx to avoid pagination conflicts

Testing

  • bun run --cwd packages/opencode typecheck

Closes #6137 and maybe also #4918

CasualDeveloper avatar Dec 24 '25 23:12 CasualDeveloper

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

CasualDeveloper avatar Dec 24 '25 23:12 CasualDeveloper

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 avatar Dec 24 '25 23:12 CasualDeveloper

I have a working implementation ready - typechecks pass.

CasualDeveloper avatar Dec 25 '25 00:12 CasualDeveloper

@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: https://github.com/ariane-emory/opencode/pull/43

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

ariane-emory avatar Dec 25 '25 02:12 ariane-emory

@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.

CasualDeveloper avatar Dec 25 '25 03:12 CasualDeveloper

Re-committed with valid GPG signature. PR ready.

CasualDeveloper avatar Dec 25 '25 03:12 CasualDeveloper

Will continue rebasing on top of release tags as they're set.

CasualDeveloper avatar Dec 30 '25 19:12 CasualDeveloper

Rebased onto v1.1.3. Merged with the new session search functionality - the configurable session_list_limit now only applies when not searching (search results use server limit).

CasualDeveloper avatar Jan 06 '26 11:01 CasualDeveloper