You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opencode session list shows too few sessions and --max-count is not honored #14163
opencode session list only shows ~24 sessions despite having 500+ in the database (118 root sessions). The --max-count / -n flag has no effect for values above that ~24 count.
Root cause: The CLI handler calls Session.list() with no arguments, so the DB query applies a default LIMIT 100. Child/delegation sessions are then filtered out in JS (if (!session.parentID)), and --max-count is applied via Array.slice() after that. Since many of the 100 DB rows are child sessions, only ~24 root sessions survive — and -n 1000 can never return more.
The server HTTP API (/session) already handles this correctly by passing roots: true to the query, which adds WHERE parent_id IS NULL so the LIMIT applies only to root sessions.
Related: #13877 (same root cause affecting TUI /sessions picker)
Plugins
None
OpenCode version
1.2.6
Steps to reproduce
Have a project with many sessions (including delegation/subagent sessions)
Run opencode session list --format json | python3 -c "import sys,json; print(len(json.load(sys.stdin)))"
Run opencode session list -n 1000 --format json | python3 -c "import sys,json; print(len(json.load(sys.stdin)))"
Both return the same small number (~24), despite having far more root sessions in the DB
Compare with: opencode db "SELECT COUNT(*) FROM session WHERE parent_id IS NULL"
Activity
Distrust a late root-filtered session list; mark abandoned floors and…