Repository navigation
Description
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
- 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.
- Open the TUI in project A and open the session list.
- The old session of project A does not appear.
Instrumentation (all verified on my machine):
- Server log shows the TUI issues
GET /api/sessionwith 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, andGET /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
- Workaround:
opencode -s <session-id>andopencode session listwork correctly per project; alsoopencode api get "/api/session?directory=$PWD&search=..."can locate old session IDs. - Discovered while investigating a V1→V2 migration report of "disappearing sessions": the data was intact in
opencode.dband correctly migrated; the picker was simply never requesting it. - Related reports (same user-visible symptom, different angles): Missing sessions after update #39064 (after update,
/sessionsonly shows today's sessions), Desktop session search excludes older sessions outside the loaded list #46832 (Desktop search only covers the loaded subset), [FEATURE] Option to show all sessions in the session list without repeated 'Load more' #46123 (feature request: configurable list limit / show all).
Happy to provide additional log excerpts if useful.
Activity
github-actions commentedon Sep 14, 2026
This issue might be a duplicate of existing issues. Please check:
wsaaaqqq commentedon Sep 18, 2026
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.opencode -s <id>)!keywordto excludehttps://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.
jensenojs commentedon Sep 18, 2026
opencode session list could be another workaround
silvansievers commentedon Sep 29, 2026
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.