Skip to content

migration: v1 sessions imported into "global" project, hidden from TUI session lists #55069

Closed as duplicate

Description

@lordhash

Summary

After upgrading from V1 to V2, all migrated V1 sessions were assigned to the synthetic
global project (worktree /) instead of the project for each session's original
directory. Because the V2 TUI session list is scoped to the current project, a user's
entire session history appears lost after the upgrade. The data itself is intact — only
the session→project association is wrong.

Environment

  • opencode version: v2.0.27 (upgraded from V1 via curl installer, latest channel)
  • OS: Linux (x64)
  • Active plugins: none

Reproduction

  1. On V1, create sessions in several working directories (e.g. ~/project-a,
    ~/project-b, ~/project-c).

  2. Upgrade to V2. On first run, V2 migrates V1 storage into
    ~/.local/share/opencode/opencode.db.

  3. Launch the V2 TUI in one of those original session directories.

  4. Open the session list: only newly created sessions appear; all migrated sessions are
    missing.

  5. Confirm via the API/DB:

    • GET /api/session?project=global → returns every migrated session, all with
      project_id = 'global', even though their directory values point to the original
      paths.
    • GET /api/session?project=<project id> for the current directory → returns only
      sessions created after that project registered itself (which happens on the first
      launch after the upgrade).

Expected Behavior

Migrated V1 sessions should be associated with the project for their original directory
(or that project should be created during migration), so they appear in that directory's
TUI session list.

Actual Behavior

All migrated sessions — and any session created in a directory before its project was
registered — are attached to the catch-all global project (worktree /). They are
invisible to per-directory project session lists, making session history look completely
lost after the V1→V2 upgrade.

Additional Context

  • Message/part data migrated correctly; sessions are not archived (time_archived is
    null for all).
  • Workaround: reassigning sessions with POST /api/session/{id}/move
    ({"directory": "..."}) restores visibility, but it permanently changes each session's
    working directory as a side effect.
  • Filed by @lordhash

Activity

  1. opencode-agent commented on Oct 13, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report! I think this is a duplicate of #50999, which describes the same problem: after the v1→v2 import, migrated sessions keep project_id = 'global' even though their directory is correct, so they don't show up in the per-directory session list.

    Possible duplicates and closely related issues, ordered by likelihood:

    If any of your data adds something new (for example, git-project sessions also ending up under global), please add it to #49827 or #50999.

    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 14, 2026

    @opencode-agent
    Contributor

    We haven't heard back in the past day, so I'm closing this as a duplicate of #50999. That issue covers the same problem: migrated v1 sessions keep project_id = 'global' and are hidden from per-directory session lists. You can follow progress there and in #49827. Open PR #51935 targets the same cause by assigning migrated sessions to the project for their original directory. If your case turns out to be different, please comment here or open a new issue with the details. Thanks for the clear report!

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