Repository navigation
Description
Summary
After upgrading a V1 install (1.18.x–1.19.x) to V2, legacy sessions are not shown in the TUI /sessions view for their project. V1 stored session.path relative to $HOME (e.g. home/user/Projects/foo) and project_id under the legacy global/git-repo projects; V2's project-scoped session list requires path relative to the project root ('' for root sessions), so exact-match lookups return zero rows and the view shows "No sessions available". Data is intact but effectively orphaned until project_id and path are migrated.
Environment
- opencode version: 2.0.27 (latest channel, curl install)
- OS: Linux (CachyOS 7.2.9-2-cachyos, x86_64)
- Terminal: xterm-256color (kitty), COLORTERM=truecolor
- Shell: /bin/fish
- Install/channel: latest
- Active plugins: @dietrichgebert/ponytail
Reproduction
- Install V1 (1.18.x/1.19.x); open opencode in a directory that is not a git repo, e.g.
~/Projects/foo(or any dir), and create sessions. V1 stores these withproject_id='global'(or the git repo project) andpathrelative to $HOME, e.g.home/user/Projects/foo. - Upgrade to V2 2.0.27. Migrations run (last:
20261010180456). V2 additionally registers one project per launch directory with new project IDs and project-root-relativepathsemantics. - Open the V2 TUI from
~/Projects/fooand run/sessions.
Expected Behavior
Legacy sessions created from that directory in V1 appear in the /sessions view (migration rebinds project_id/path to the V2 project model).
Actual Behavior
Sessions for foo → No sessions available. The sessions still exist: opencode api get '/api/session?limit=1000' lists them, and ?directory=<dir> also finds them, but the project-scoped query the TUI uses returns nothing.
Root cause (from the 2.0.27 binary, SessionStore.list):
if ("project" in e) where project_id = e.project
if ("project" in e && e.subpath !== undefined) where path = e.subpath // exact matchThe TUI sends project=<v2-project-id>&subpath= for root sessions, while legacy rows keep path='home/<user>/...' (and project_id='global' or a V1 project ID), so path = '' never matches.
Verified: with a legacy row for /home/user/Projects/foo, ?project=<v2-id> → 0 rows, ?project=<v2-id>&subpath=home/user/Projects/foo → the row; after rewriting the row to project_id=<v2-id>, path='' the same TUI-style query returns it.
Affects every V1→V2 install with legacy sessions, including sessions that were already bound to V1 git-repo projects (root-level rows keep the old home-relative path while new V2 rows use '', so a project mixes visible and invisible sessions — e.g. only sub-directory sessions appear).
Workaround (manual SQL, after backing up the DB): for each legacy row set project_id to the V2 project owning its directory and path to the path relative to that project root ('' when the directory is the root), in both session and session_v2.
Additional Context
- Migrations include
20260601010001_normalize_storage_paths, but it does not normalizesession.pathagainst the V2 per-directory project model. - No in-API path migrates/binds legacy sessions to their V2 project (session.list is the only session query endpoint; session.import is for JSON exports).
- Consistent 100%: every legacy root-level session is affected; search and "all projects" still work as a stopgap.
Activity
opencode-agent commentedon Oct 12, 2026
Thanks for the very detailed report and the verified SQL workaround. I think this is a duplicate of #49827. Sessions created in V1 keep their old project (
globalor a V1 project) and/or apathrelative to the old root. The default folder-scoped/sessionslist matches on both project and exact subpath, so those sessions are hidden even though they're still in the database.Possible duplicates and closely related issues, ordered by likelihood:
pathon sessions that already belong to a real git project, soproject + subpath=""returns 0 rowsproject_idwithout recomputingpathleaves sessions hidden, plus caveats about thePOST /api/session/{id}/moveworkaroundglobalsessions to their folder's project and recomputes the subpathpathhad to be recomputed along withproject_idThe case where
project_idis already correct butpathis still the old home-relative value may not be fully covered by PR #51935. A short comment on #49827 or that PR with your verified query results would help.Until a fix lands,
Ctrl+Ain the session list (or"tabs": { "scope": "global" }) shows all sessions, and your SQL workaround works too.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
opencode-agent commentedon Oct 13, 2026
Closing this as a duplicate of #49827, since there was no reply saying how it differs. Both are about legacy V1 sessions being hidden from the folder-scoped
/sessionslist because theirproject_idandpathwere never updated for V2.Please follow #49827 and the open PRs #51935 and #54048 for progress. The case where
project_idis already correct butpathis still the old home-relative value may not be fully covered by #51935, so your verified query results would be useful as a comment there or on #49827. Until a fix lands,Ctrl+Ain the session list (or"tabs": { "scope": "global" }) shows all sessions.If your problem turns out to be different, reply here and we can reopen it. Thanks again for the detailed report.