Skip to content

session: V1 sessions in non-git directories hidden after V2 migration (project_id stays 'global') #55633

Closed as duplicate

Description

@cjnoname

Summary

After upgrading from V1 to V2, sessions created in a non-git directory (e.g. $HOME) are no longer listed by /session when launching OpenCode from that same directory. The V1 sessions were migrated into session_v2 with project_id = 'global', but V2 creates a new directory-based project for the same path, so the session list (filtered by project) only shows sessions created after the upgrade.

Environment

  • opencode version: 2.0.29
  • OS: Darwin 27.0.0 (macOS, arm64)
  • Terminal: VS Code integrated terminal (TERM=xterm-256color, COLORTERM=truecolor)
  • Shell: /bin/zsh
  • Install/channel: latest
  • Active plugins: none in config ("plugin": []); one legacy local file ~/.config/opencode/plugin/done-sound.js

Reproduction

  1. With V1, create sessions while running opencode in a non-git directory (e.g. ~). V1 stores them under project global.
  2. Upgrade to V2 and let the V1→V2 data migration complete (kv migration.v1-v2 = {"phase":"completed"}).
  3. Run opencode from the same directory (~) and open /session.

Expected Behavior

V1 sessions created in ~ appear in the session list, as they did in V1.

Actual Behavior

Only sessions created after the upgrade are listed. In the database:

  • session_v2 has 71 rows with directory = '/Users/<user>' and project_id = 'global' (all migrated from V1).
  • V2 created a new project 30b4af67… with worktree = '/Users/<user>' on first launch; new sessions in ~ use this project ID.
  • /session filters by the new project ID, so all 71 migrated sessions are hidden.

Sessions in git repositories migrated correctly (project ID matches).

Additional Context

  • Database is ~27 GB; migration otherwise completed. One unrelated warning: Skipped V1 migration row reason=invalid-part observedType=tool.
  • Workaround: manually UPDATE session_v2 SET project_id = '<new id>' WHERE project_id = 'global' AND directory = '<dir>'.
  • Suggested fix: during migration (or project resolution), map V1 global-project sessions to the V2 directory project for their directory, or have the session list include global sessions whose directory matches the current location.

Activity

  1. opencode-agent commented on Oct 15, 2026

    @opencode-agent
    Contributor

    Thanks for the clear report and the database details! I think this is a duplicate of #49827. In both, V1 sessions from non-git directories keep project_id = 'global' after the V1→V2 migration, V2 creates its own project for that directory, and /session hides the migrated sessions.

    Possible duplicates and related issues, ordered by likelihood:

    Please follow #49827 and the open PRs above for progress. The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    We haven't heard back, so I'm closing this as a duplicate of #49827. In that issue too, V1 sessions from non-git directories keep project_id = 'global' after the V1→V2 migration, so /session hides them when you run OpenCode from that directory. Please follow #49827 and the open fix PRs #51935 and #54048 for progress.

    Until a fix lands, your UPDATE workaround should work, but #50551 notes that the session path may also need to be normalized before the sessions show up in the list. If your problem 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