Skip to content

Web UI session list shows only New session + Load more for a directory with existing sessions #30801

@rexdotsh

Description

@rexdotsh

Description

In the web UI, a project/worktree can have existing sessions returned by the API, but the sidebar renders only New session and Load more. Clicking Load more makes a request, but no session rows appear. The list endpoint was returning session records for the project, but the sidebar stayed empty.

Root cause appears to be Session.list() / listByProject() ignoring the explicit directory filter when experimental workspaces are enabled:

} else if (input.scope !== "project" && !input.experimentalWorkspaces) {
  if (input.directory) {
    conditions.push(eq(SessionTable.directory, input.directory))
  }
}

With experimental workspaces on, GET /session?directory=...&roots=true&limit=... can return project-wide sessions instead of sessions for the requested directory. The web sidebar then client-filters by exact session.directory, so if the loaded page contains sessions from other worktrees/directories, the visible list is empty while sessionTotal still makes Load more appear.

Plugins

None

OpenCode version

1.15.13

Steps to reproduce

  1. Use a git project with multiple worktrees/directories that have historical sessions in the database.
  2. Enable/use the web UI with experimental workspaces behavior.
  3. Open one worktree/directory in the web UI.
  4. Observe the left session sidebar.

Screenshot and/or share link

chrome_t6ztZ0DWtg.mp4

Operating System

Ubuntu 22.04

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
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