Repository navigation
Closed as duplicate
Closed as duplicate
Copy link
Labels
Description
Summary
After upgrading from OpenCode v1.19.0 to v2.0.28, sessions created in V1 under the fallback "global" project no longer appear in the V2 session list (/sessions picker and opencode session list), even when opencode is opened in the exact directory where those sessions were created. The v1→v2 data migration reports completed, but those sessions remain attached to the global project instead of being re-associated with the per-directory project that V2 resolves.
Environment
- opencode version: 2.0.28 (upgraded from 1.19.0)
- OS: Linux 7.0.0-38-generic (linux x64)
- Terminal: TERM=xterm
- Shell: /bin/bash
- Install/channel: npm global
@opencode/cli@2.0.28(latest) - Active plugins: a local path plugin (loads fine), oh-my-openagent (fails to load — V1 plugin API, unrelated to this issue)
Reproduction
- On V1 (1.19.0), start opencode in a directory that is NOT a git worktree root — in my case a
repo-tool multi-repo checkout (~/workspace/openharmony, has.repo/but no.gitat the root). Create sessions there. In the V1 database these sessions getproject_id = "global"(theglobalproject row hasworktree = "/"). - Upgrade to OpenCode v2.0.28. The v1→v2 migration runs and
kv["migration.v1-v2"]reports{"phase":"completed"}. - Start opencode in the same directory. V2 creates a NEW project row for that directory (e.g.
project 225ebdf…,worktree = <that directory>). - Open
/sessionsor runopencode session list. The list is empty.
Expected Behavior
The v1→v2 migration re-associates V1 "global"-project sessions with the project V2 resolves for their directory (or the session list falls back to matching by directory), so history created in V1 stays visible in the same directory after upgrading.
Actual Behavior
opencode session listin the original directory returns nothing ("List top-level sessions in the current project").- The sessions still exist in
opencode.db(session_v2table) withproject_id = "global"and the correctdirectory; total counts are unchanged (437 sessions / ~17k messages in my case — no data loss). GET /api/session?directory=<dir>andGET /api/session?project=globalboth return the "missing" sessions, so only the project scoping hides them.- Sessions created in V1 inside git worktrees (which already had real project IDs in V1) display correctly in V2. Only
"global"-project sessions are affected.
Additional Context
- Workaround:
POST /api/session/{id}/movewith{"directory": "<original directory>"}re-associates a session with the project V2 resolves for that directory. I moved all 392 affected sessions this way and they reappeared in/sessionsimmediately. - Caveats of the workaround:
moveupdatestime_updated(affects list ordering), and child sessions (subagent runs) do NOT follow their parent, so every session must be moved individually. - Suggested fix: during the v1→v2 migration, re-resolve
project_idfor"global"sessions from theirdirectoryfield so upgraded history stays visible.
Activity
opencode-agent commentedon Oct 14, 2026
Thanks for the detailed report, the
moveworkaround and the notes on its caveats (child sessions not following their parent,time_updatedchanging).I think this is a duplicate of #49827. Sessions V1 created in directories with no git repo (your
repo-tool checkout has.repo/but no.git) stay on theglobalproject after the V1→V2 migration. V2's session list only shows the current directory's project, so those sessions are hidden even though the data is intact.Possible duplicates and related issues, ordered by likelihood:
project_id='global'for non-git directoriesglobalare invisible in project session listsglobalsessions stay unattributed after migrationopencode session listand the sidebarThe bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different. Your details about child sessions and
time_updatedwould also be useful as a comment on #49827.opencode-agent commentedon Oct 15, 2026
Closing this as a duplicate of #49827. No reply came in the day after I flagged the overlap, so I'm treating it as the same problem: V1 sessions from non-git directories stay on the
globalproject after the V1→V2 migration and drop out of V2's per-directory session list. Please follow #49827 for updates. Open PRs #51935 and #54048 propose fixes.Your notes on the
POST /api/session/{id}/moveworkaround (child sessions don't follow their parent, andtime_updatedchanges) would be useful as a comment on #49827. If your case turns out to be different, reply here and we can reopen.