Skip to content

Same git directory gets two project IDs and /sessions only shows the latest project's sessions #36464

Closed as not planned

Description

@ilp-prog

Description

Bug description

OpenCode stopped showing previous sessions for a project. /sessions and opencode session list only showed the latest session created today, although the SQLite database still contained all previous sessions.

The root cause seems to be that OpenCode created a second project identity for the same directory.

Observed behavior

The database contained two projects pointing to the same directory:

dc038e5e6b7b96820aef4f3513dfede58340144e3 -> /home/ilp/my/working/dir
b6732720cc85382bb5da9a37fd17fd8ca0b194e3 -> /home/ilp/my/working/dir

Sessions were split:

dc038... -> 47 old sessions
b673... -> 1 new session

OpenCode only displayed sessions from the newly created project.

Recovery

I recovered the sessions by merging the project IDs directly in SQLite:

  • moved all sessions from dc038... to b673...
  • removed the duplicate project entry

After that /sessions showed all previous sessions again.

But this affected both:

  • /sessions inside OpenCode
  • opencode session list from the command line

Additional information

The logs showed project refresh activity for the new project ID:

project copy refresh started projectID=b6732720...
project copy refresh done projectID=b6732720...

The directory was the same in both cases.

The issue is not data loss: sessions remain in the database, but the active project identity changes and makes them invisible.

Plugins

No plugins

OpenCode version

1.17.18

Steps to reproduce

  1. Use OpenCode normally in a git repository working on different sessions.
  2. Create the first git commit for the repository.
  3. Restart OpenCode.
  4. Observe that a new project ID is created for the same directory.
  5. Previous sessions are no longer shown in /sessions.

Screenshot and/or share link

No response

Operating System

Ubuntu 26.04 LTS running on WSL

Terminal

Default WSL terminal.

Activity

  1. github-actions commented on Jul 11, 2026

    @github-actions
    Contributor

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

    Your specific trigger (creating the first git commit causing a new project ID to be generated for the same directory) is a concrete reproduction scenario for the project ID drift bug tracked in #30683.

  2. github-actions commented on Sep 10, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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