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
Title: /sessions lists all sessions globally — no project scoping #33113
Problem
The /sessions command lists all sessions across every project without any filtering by the current project/workspace. This makes it hard to find sessions relevant to the project you're currently working in.
Root Cause
Looking at the SQLite database (opencode.db), almost all sessions are assigned project_id = 'global' even when they were created from different project directories:
Sessions per project:
global (worktree=/): 60 sessions
ca926cea... (worktree=/path/to/viis-iot-web-v2): 1 session
Sessions were created from multiple distinct directories (/home/user/ravid, /home/user/demeter, /home/user/viis/fe-be) but the project_id was not resolved from the working directory at session creation time.
The directory field does correctly reflect where each session was run from, so the data exists — it's just not being linked to the proper project.
Expected Behavior
When opening /sessions from a project directory, only show sessions belonging to that project (matched by worktree/directory)
At minimum, group or label sessions by project so users can distinguish them
Sessions created from ~/ravid should have project_id pointing to the ravid project, not global
Environment
Both issues describe the same root cause: Session.list() is called without scoping to the current directory, causing sessions from unrelated projects to appear together under the global project bucket.
Project identity should be resolved at session creation, then kept as durable metadata. Store cwd, git root or workspace root, project id source, and fallback reason when the session lands in global.
/sessions from a project directory can default to that project while offering an explicit all-projects view. For existing rows, a migration can backfill likely project ids from the recorded directory, with collision/unknown cases labeled instead of hidden.
In the OpenCode v2 TUI, the /sessions dialog can be scoped to the current project. Press ctrl+a in the dialog to switch between current-directory sessions and all projects; the choice is remembered. tabs.scope ("cwd" or "global") in tui.json sets the default.
Activity
github-actions commentedon Jun 20, 2026
This issue might be a duplicate of existing issues. Please check:
Both issues describe the same root cause:
Session.list()is called without scoping to the current directory, causing sessions from unrelated projects to appear together under the global project bucket.Necmttn commentedon Jun 21, 2026
Project identity should be resolved at session creation, then kept as durable metadata. Store cwd, git root or workspace root, project id source, and fallback reason when the session lands in
global./sessionsfrom a project directory can default to that project while offering an explicit all-projects view. For existing rows, a migration can backfill likely project ids from the recorded directory, with collision/unknown cases labeled instead of hidden.Generated with ax.
fix(ui): remove scope=project from session list requests (#572)
elxecutor commentedon Jul 24, 2026
I am still having this issue with opencode, sessions in a specific project folder suddenly disappear but is available in ~
neriousy commentedon Oct 1, 2026
In the OpenCode v2 TUI, the
/sessionsdialog can be scoped to the current project. Pressctrl+ain the dialog to switch between current-directory sessions and all projects; the choice is remembered.tabs.scope("cwd"or"global") intui.jsonsets the default.Added in 488445a.
Closing as completed. If something doesn't work on v2, please open a new issue.