Repository navigation
Description
Description
After updating from OpenCode 1 to OpenCode 2, sessions created with V1 are missing from the TUI session list even though the data is intact in the database.
Two related project-binding issues cause this:
-
V1 stored sessions for non-repo directories under the special
globalproject (canonical: "/") with asubpathfield (e.g.Users/cretivoxmacden). V2 treats each directory as its own project (opening~creates a brand-new project id for/Users/cretivoxmacden), so all legacyglobal+subpathsessions no longer match the V2 location filter and are silently hidden. ~73 sessions were affected for the home directory alone. -
Stale legacy
subpathon real-project sessions. A root session that already belonged to a proper (git) project could still carry a V1-erasubpathequal to its full path (e.g.Volumes/SSD 7/(ARAP) NITIP/CVE-Toolsfor project/Volumes/SSD 7/(ARAP) NITIP/CVE-Tools). The session list is scoped by location includingsubpath, so that root session is excluded (project + subpath=""returns 0) → empty list, even though the TUI auto-resumes the session.
User impact: it looks like all sessions were deleted after the V1→V2 upgrade.
Plugins
None configured.
OpenCode version
2.0.26
Steps to reproduce
- With opencode 1.x, run opencode in a directory that is not a git repo (e.g.
~) and create one or more sessions.- (variant) In a git-repo directory, create a root session so it carries a legacy
subpath.
- (variant) In a git-repo directory, create a root session so it carries a legacy
- Update to opencode 2.x and open opencode in the same directory.
- Press
Ctrl+XthenL(or run/sessions). - The old sessions are missing from the list.
Screenshot and/or share link
None available.
Operating System
macOS (Darwin 23.6.0, arm64)
Terminal
Apple Terminal (TERM=xterm-256color, SHELL=/bin/zsh)
Additional context / workaround
GET /api/experimental/migration/v1→{"status":"completed"}; all DB migrations complete without error.- Evidence of the mismatch (session query filters):
project=global&subpath=Users/cretivoxmacden→ 73 sessions (the "missing" ones).project=<the new home project id>→ 0 before re-binding.- Project for a stale-subpath root:
project=<git project>→ 15, butproject=<git project>&subpath=→ 14 (the root with stalesubpathis excluded), andproject=<git project>&parentID=null&subpath=→ 0.
- Workaround that fixes it: re-bind each affected session with
POST /api/session/{id}/moveto its own directory — this re-computesprojectID/subpath. For a stale-subpath root, a move away and back clears the field and the session reappears. - Expected: sessions created in V1 for a directory should remain visible after migrating to V2, without manual re-binding.
Activity
opencode-agent commentedon Oct 11, 2026
Thanks for the detailed report and the workaround! I think this is a duplicate of #49827: V1 sessions from non-git directories stay under the
globalproject after the V1→V2 migration, so V2's per-directory session list hides them.Possible duplicates and closely related issues, ordered from most to least likely:
globalsessions from non-git directories hidden after the V1→V2 upgrade (same root cause and symptom)project_id='global'for non-git directories, so migrated sessions never show in the per-directory pickerglobalsessions stay unattributed after migration and are hidden from V2's session list (open fix PR: fix(core): attribute migrated V1 sessions to the project of their directory #51935)subpathIf the stale-
subpathcase on git-project sessions isn't covered by these, please reply and explain how it differs, and we can track it separately. Otherwise the bot will close this issue as a duplicate in 1 day.opencode-agent commentedon Oct 12, 2026
We haven't heard back, so I'm closing this as a duplicate of #49827: V1 sessions from non-git directories stay under the
globalproject after the V1→V2 migration and are hidden from the per-directory session list. Please follow #49827 and the open fix PR #51935 for updates. Until then, yourPOST /api/session/{id}/moveworkaround should keep those sessions visible.If the stale-
subpathproblem on git-project root sessions keeps happening and isn't covered by #49827 or #51144, please reply here or open a new issue with the details.