Skip to content

tui: /sessions omits older roots when child sessions fill first page #37772

Description

@magoz

Summary

In OpenCode 2 beta, /sessions omits resumable root sessions when recent child/subagent
sessions fill the first session-list page. The sessions remain available through the API
and can be resumed directly with opencode2 --session.

Environment

  • opencode version: opencode2 v0.0.0-next-15828
  • OS: Darwin 25.4.0, arm64
  • Terminal: tmux, TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /bin/zsh
  • Install/channel: OpenCode 2 next/beta
  • Active plugins: opencode-anthropic-auth.mjs

Reproduction

  1. Use a project containing older root sessions and many newer child/subagent sessions.
  2. Start OpenCode 2 in that project.
  3. Open /sessions.
  4. Compare the picker with:
    opencode2 api get '/api/session?order=desc&limit=100'
  5. Query roots server-side with:
    opencode2 api get '/api/session?order=desc&limit=100&parentID=null'

Expected Behavior

/sessions requests root sessions server-side and shows all matching resumable roots,
with pagination as needed.

Actual Behavior

The picker shows only two recent roots. In the same project:

  • The unfiltered 100-item page contains 2 roots and 98 children.
  • parentID=null returns 3 roots for the current directory.
  • The omitted root opens successfully using opencode2 --session <session-id>.

This suggests the TUI still fetches an unfiltered page and removes children client-side,
causing children to consume the page limit before root filtering.

Additional Context

The issue is consistently reproducible after restarting the computer, though restart
does not appear causal. Session persistence and service health are normal.

Workaround:

opencode2 --session <session-id>

Related:

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions