Skip to content

tui: session picker only shows sessions from the 50 most recently updated across all projects #48974

Closed

Description

@jensenojs

Summary

The TUI session picker requests the 50 most recently updated sessions across all projects (GET /api/session with no parameters) and then filters them client-side by the current directory. In an active multi-project setup, any session older than the newest ~50 sessions globally becomes unreachable from the picker — the session exists, the server can return it, but the TUI never asks for it and offers no server-side search. This makes old sessions look "lost" (a frequent report in this repo), especially after upgrading or migrating sessions.

Environment

  • opencode version: 2.0.1
  • OS: macOS (Darwin 27.0.0, arm64)
  • Terminal: WezTerm (xterm-256color, truecolor)
  • Shell: /bin/zsh
  • Install/channel: local, v2 line
  • Active plugins: none (plugins: [])

Reproduction

  1. Have a project with a session last updated 2+ days ago (project A), and work in other projects so that 50+ sessions across all projects get updated more recently.
  2. Open the TUI in project A and open the session list.
  3. The old session of project A does not appear.

Instrumentation (all verified on my machine):

  • Server log shows the TUI issues GET /api/session with no query parameters.
  • The bare endpoint returns the 50 most recently updated sessions globally (time range of the response was "today only", while the DB contains 1000+ sessions).
  • The TUI then filters that response client-side by directory: only the single session created today in the current project remains visible.
  • The server API itself is correct — GET /api/session?directory=<cwd> returns all sessions of the project including old ones, and GET /api/session?directory=<cwd>&search=<term> finds old sessions by title.
  • The picker's filter is client-side only: the server log contains no ?search= or ?cursor= requests from the TUI, so typing in the picker cannot reach sessions outside the loaded 50.

Concretely: a session updated 2 days ago was the 51st+ newest globally (96 sessions updated after it), so it was invisible in the TUI of its own project, while opencode session list (per-project, default 100) and the directory-scoped API both returned it immediately.

Expected Behavior

The session picker should list sessions scoped to the current project/directory (matching opencode session list behavior), and/or perform server-side search across all sessions of the project instead of filtering only the already-loaded 50.

Actual Behavior

The picker shows only the intersection of (globally 50 most recently updated sessions) × (current directory). In active multi-project usage this quickly becomes just "today's sessions", and older sessions are unreachable through the TUI.

Additional Context

Happy to provide additional log excerpts if useful.

Activity

  1. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

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

  2. wsaaaqqq commented on Sep 18, 2026

    @wsaaaqqq

    Same root cause bit me — the picker only ever sees the newest 50 sessions globally, so anything older is invisible no matter what you type.

    I worked around it with oos: instead of going through the capped list, it reads opencode.db (SQLite) directly and loads ALL sessions, then filters in memory on every keystroke. No 50-item window, no per-project scoping — one query searches every session from every project, Enter resumes it.

    oos demo

    • Type keywords → real-time filter across all projects
    • Up/Down to pick, Enter to resume (opencode -s <id>)
    • Multi-keyword AND, !keyword to exclude
    • Zero config, single binary, MIT

    https://github.com/wsaaaqqq/oos

    Not a fix for the picker itself, but a working way to reach those "lost" sessions today. Your instrumentation here (data intact in opencode.db, API correct) is exactly why the direct-DB approach works.

  3. jensenojs commented on Sep 18, 2026

    @jensenojs
    ContributorAuthor

    opencode session list could be another workaround

  4. silvansievers commented on Sep 29, 2026

    @silvansievers

    I encountered the same problem after updating. I think that being able to choose sessions from the full list (and being able to search them!) is a core feature.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions