Skip to content

sessions: V1 sessions under "global" project hidden after upgrading to 2.0 #56030

Closed as duplicate

Description

@diegofco99

Summary

After upgrading from OpenCode 1.x to 2.0.30, sessions created in V1 from the home directory no longer appear in the session list. The data is intact in the database, but it is filtered out because the home directory became its own project in V2.

Environment

  • opencode version: 2.0.30
  • OS: Linux 7.2.5-100.fc43.x86_64 (Fedora 43, x64)
  • Terminal: TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /bin/bash
  • Install/channel: latest
  • Active plugins: None found in config

Reproduction

  1. Use OpenCode 1.x from ~ (not a git repo) and create several sessions. They are stored under project global.
  2. Upgrade to OpenCode 2.0.30.
  3. Run opencode (or opencode session list) from ~.

Expected Behavior

Previous sessions remain visible, as the migration guide states that supported V1 functionality should stay compatible.

Actual Behavior

Only sessions created after the upgrade are listed (2 in this case). opencode session list -n 500 from ~ returns just those.

Inspecting a copy of opencode.db:

  • session (V1 table): 100 rows; session_v2: 102 rows; no V1 session is missing in V2.
  • 54 sessions with directory='/home/admdiegofco' (Aug 7 to Oct 16) have project_id='global' (project worktree /).
  • Sessions created with V2 in the same directory have project_id='a23da999...' (project worktree /home/admdiegofco).
  • Sessions from real git projects (e.g. iac-crlnxend) keep their own project and are unaffected.

The list is scoped by project, so the 54 older sessions are hidden.

Additional Context

  • Frequency: consistent.
  • Workaround: manually UPDATE session/session_v2 SET project_id=<new project> WHERE project_id='global' AND directory='/home/admdiegofco' with the service stopped and a DB backup.
  • Suggested fix: on migration, reassign legacy global sessions to the project that now owns their directory, or include global sessions when listing for a directory that was previously global.

Activity

  1. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report and the DB analysis. I think this is a duplicate of #49827. After the V1→V2 migration, sessions that V1 created in non-git directories (like ~) stay on the legacy global project. V2 creates a separate project for that directory, and since the session list only shows the current project's sessions, those older sessions are hidden.

    Possible duplicates and closely related issues, ordered by likelihood:

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different. Feel free to add your numbers to #49827.

  2. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    We haven't heard back, so I'm closing this as a duplicate of #49827. After the V1→V2 migration, sessions that V1 created in non-git directories (here ~) stay on the legacy global project, and V2 creates a new project for that directory, so the session list hides them. Your data is still in the database. Please follow #49827 for updates. #51935 is the open PR that would reassign those sessions to their directory's project. If your case turns out to be different, reply here and we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions