Skip to content

Migrated non-git sessions stay under project_id 'global', so the V2 TUI shows 0 sessions while the desktop app lists them #56760

Closed as duplicate

Description

@jimicze

Description

After upgrading to V2, the history migration ran and copied ~5,241 sessions, but sessions from non-git directories keep the V1 project_id = 'global'. V2 creates a new project id for the directory and the TUI scopes the session list to it, so the TUI shows 0 sessions while the desktop app still lists the same sessions.

Evidence for /Users/lasakondrej/Projects/opencode-test (not a git repo, DB ~/.local/share/opencode/opencode.db). The desktop app shows this project as Opencode-test, but that is only a display alias for the same lowercase project — it is a single project, not two.

  • Rows were copied: session (V1) = session_v2 (V2) = 5,241 rows.
  • Sessions for this project: 30, all with project_id = 'global'.
  • A project row c98ce85216d0... for /Users/lasakondrej/Projects/opencode-test was created at 2026-10-18 12:38:22 (first V2 run) and has 0 sessions.
  • SELECT count(*) FROM session_v2 WHERE project_id LIKE 'c98ce852%' → 0.
  • Total sessions under project_id = 'global': 1,071 (all non-git directories), so this affects more than one project.

So the rows migrated, but the project association did not: V1 sessions stay on 'global' while V2 resolves a new per-directory project id and lists by it.

TUI vs desktop app (same machine, same database):

TUI (V2) Desktop app (1.19.3)
TUI: No sessions available Desktop app: sessions listed

Opening the TUI in this project shows 0 sessions; the desktop app lists them.

Steps to reproduce

  1. Use V1 in a non-git project directory (sessions are stored with project_id = 'global').
  2. Install/open V2. Migration runs and copies the sessions into session_v2.
  3. Open the same project in the V2 TUI and list sessions → "No sessions available".
  4. Open the desktop app (1.19.3) → the same sessions are listed.

Expected behavior

Migrated sessions are visible in the V2 TUI, or the TUI falls back to sessions matching the directory when the resolved project has none.

Actual behavior

TUI shows 0 sessions; the desktop app shows them, so history looks lost in the TUI.

Suggested fix

During migration, reassign V1 sessions whose project_id = 'global' to the per-directory project created in V2 (or make the TUI fall back to directory matches when the resolved project has no sessions).

Plugins

@jimicze-opencode/opencode-tps, superpowers

OpenCode version

CLI v2.0.32 (Homebrew) · Desktop app 1.19.3

Operating System

macOS 15.2 (24C101)

Terminal

Terminal.app / opencode TUI

Activity

  1. opencode-agent commented on Oct 18, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report and the DB evidence. I think this is a duplicate of #49827. In both, the V1→V2 migration leaves sessions from non-git directories under project_id = 'global', while V2 creates a new project for the directory and lists sessions by that project, so the TUI shows none of them.

    Possible duplicates and related issues, most likely first:

    If you have new details, adding them to #49827 would help, for example that this still happens on 2.0.32.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. jimicze commented on Oct 18, 2026

    @jimicze
    Author

    @opencode-agent agreed — this is the same root cause as #49827, so I won't claim it's different. New details worth adding there:

    • Still reproduces on v2.0.32 (CLI) with desktop app 1.19.3, macOS 15.2, on 2026-10-18.
    • Both tables have the same row count (session = session_v2 = 5,241), so the rows were copied but the project link was not.
    • The per-directory project row (c98ce852…) is created on the first V2 run with 0 sessions (SELECT count(*) FROM session_v2 WHERE project_id LIKE 'c98ce852%' → 0), while 1,071 sessions remain under project_id = 'global'.
    • Cross-client symptom on the same DB: the v1 desktop app still lists those sessions, the V2 TUI shows 0.

    Happy for you to close this as a duplicate — I can move the details above into #49827 if that's helpful. A directory fallback when the resolved project has no sessions would fix the symptom without touching the migration.

  3. opencode-agent commented on Oct 18, 2026

    @opencode-agent
    Contributor

    Thanks for confirming, and for the extra details. Yes, please add them to #49827. Your data points are useful there: it still happens on v2.0.32, session and session_v2 have the same row count, the new per-directory project has 0 sessions while 1,071 stay under global, and the v1 desktop app vs V2 TUI difference on the same database. Your suggestion to fall back to directory matching fits well there too. Some of the open PRs take that kind of runtime approach (#54048), and others fix the migration itself (#56322, #51935).

    This issue will still be closed as a duplicate of #49827 at the time noted earlier.

  4. jimicze commented on Oct 18, 2026

    @jimicze
    Author

    @opencode-agent done — added the data points to #49827 (v2.0.32 confirmation, equal row counts, the new per-directory project at 0 sessions vs 1,071 under global, and the v1 desktop app vs V2 TUI difference), plus the screenshots. Fine to close this one as a duplicate.

  5. opencode-agent commented on Oct 18, 2026

    @opencode-agent
    Contributor

    Thanks for moving the details and screenshots to #49827. Follow that issue for updates. This one will be closed as its duplicate at the scheduled time.

  6. opencode-agent commented on Oct 19, 2026

    @opencode-agent
    Contributor

    Closing this as a duplicate of #49827, as agreed. Thanks for moving your v2.0.32 details and screenshots there. Please follow #49827 and the open fix PRs (#56322, #51935, #54048) for progress on migrated non-git sessions staying under global.

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