Skip to content

v2: V1 sessions in non-git directories invisible after migration (legacy catch-all project) #50800

Closed as duplicate

Description

@naiheSH

Summary

After upgrading from V1 to V2, the V1→V2 session migration imports all sessions but leaves sessions created in non-git directories (e.g. $HOME) attached to V1's legacy catch-all project. V2 resolves a different project for the same directory, so these migrated sessions never appear in the project-scoped session list (opencode session list, TUI /sessions).

Environment

  • opencode version: 2.0.14
  • OS: Darwin 27.0.0 (darwin arm64)
  • Terminal: Hyper (TERM=xterm-256color, COLORTERM=truecolor)
  • Shell: /bin/zsh
  • Install/channel: latest
  • Active plugins: None found in config

Reproduction

  1. With OpenCode V1 (observed with 1.18.29–1.18.31), create sessions in a directory that is not a git repository (e.g. $HOME).
  2. Install V2 and run it in the same directory. Let the V1→V2 session migration run to completion (kv row migration.v1-v2 = {"phase":"completed"}).
  3. Run opencode session list or open /sessions in the TUI in that directory.

Expected Behavior

Migrated V1 sessions appear in the session list for the directory they were created in.

Actual Behavior

Only natively-created V2 sessions are listed. The imported V1 sessions are still returned by GET /api/session?directory=<dir>, but not by the project-scoped session list.

Evidence from ~/.local/share/opencode/opencode.db:

  • All 33 V1 sessions created in non-git directories ($HOME, a subfolder of $HOME, /private/tmp, …) share one legacy project_id, whose project.worktree points to a stale, unrelated path.
  • V2 created a new project row for $HOME on first launch; the session list is scoped to that project, so the imported sessions (correct directory, legacy project_id) are invisible.
  • Git-repository directories are unaffected, because V1 and V2 derive the same project from the git worktree.

Additional Context

Workaround that restored full visibility: moving each orphaned session to its own recorded directory (the session-move operation re-resolves the V2 project). After moving all 33 sessions, opencode session list in $HOME shows all 28 expected sessions.

Suggestion: the V1→V2 migration (tracked under migration.v1-v2) should re-home sessions from the legacy catch-all project into the per-directory project that V2 computes, or the session list should match imported sessions by directory as a fallback.

Activity

  1. github-actions commented on Sep 23, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of an existing issue. Please check:

  2. neriousy commented on Oct 20, 2026

    @neriousy
    Member

    Thanks for the report. We're tracking this same migration problem in #50551, so I'm closing this as a duplicate. Please follow that issue for updates.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions