Skip to content

Multiple local clones of same repo share one project identity, breaking file change tracking #17940

Closed as not planned

Description

@oddvalue

Summary

When you have multiple local clones of the same git repository (same remote origin URL), OpenCode treats them all as a single project. This breaks file change tracking and causes visual issues in the project selector.

Environment

  • OpenCode version: 1.1.53
  • OS: Linux (Ubuntu)
  • Three local clones of the same repo in separate directories:
    • /home/user/Projects/project
    • /home/user/Projects/project-8000
    • /home/user/Projects/project-8080
  • All three have the same git remote: [email protected]:org/repo.git

Problem

OpenCode generates the project ID from the git remote origin URL rather than the local directory path. This means all three clones resolve to the same project ID (e.g. 5ca09febb1b87758aeeb2c8949774a8bbafc6c8f), sharing a single project record and a single snapshot directory.

Consequences

  1. File change tracking breaks — The snapshot git config's worktree can only point to one directory at a time. Whichever clone was opened last overwrites the worktree path, so file changes are not detected in the other clones. In my case, the snapshot pointed to project-8080 while I was working in project-8000, so session file diffs were always empty.

  2. Project selector shows wrong colors — On the project selection screen, each clone initially has a distinct icon color. But once you select any one of them, all three switch to the same color because they share the same project record and icon.color value.

  3. Only one project record exists — There is a single JSON file in ~/.local/share/opencode/storage/project/ for all three directories, with only one worktree value.

Expected Behavior

Each local directory should be treated as a separate project, even if they share the same git remote URL. The project ID should incorporate the local worktree path (or some other disambiguator) so that:

  • Each clone gets its own snapshot directory with the correct worktree path
  • File change tracking works independently in each clone
  • Each clone can have its own icon color and name in the project selector

Workaround

Manually deleting the snapshot directory (~/.local/share/opencode/snapshot/<project_id>) and restarting OpenCode causes it to recreate the snapshot with the correct worktree for the currently active clone — but this only fixes one clone at a time and the underlying identity collision remains.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 17, 2026
  2. github-actions commented on Mar 17, 2026

    @github-actions
    Contributor

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

  3. added a commit that references this issue on Mar 17, 2026
    75c1d6f
  4. ariane-emory commented on Mar 17, 2026

    @ariane-emory
    Contributor

    Session history being shared between multiple copies of the same git repository is a crucial fixture on which many people rely. I hope that this does not interfere with that.

  5. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  6. orium commented on May 29, 2026

    @orium

    +1 for this. I've multiple clones of the same crate to let agents work on different things in parallel. (I know git worktree exists, there are reasons not to like it).

  7. xlht4106 commented on May 29, 2026

    @xlht4106

    希望能加一个选项能让用户自主选择是否合并会话记录。

  8. taina0407 commented on May 30, 2026

    @taina0407

    +1 for this as well. I'm also prefer different working directory for different features and .env rather than rely only from git worktree

  9. oliver-joos commented on Jun 14, 2026

    @oliver-joos

    As stated in the presumed duplicate #29871: the WebUI of OpenCode 1.17.6 is still affected by this bug.

    I tried the workaround of this report, but this alone did not help.
    Then I also deleted all cookies of localhost:4096, deleted every file in all /*opencode directories that contained the wrong project name, tried to manually delete all entries from the SQLite opencode.db containing the wrong project name. But creating the new session still showed the wrong path! 🤯

    Then I deleted cookies again and(!) restarted the browser. This finally made the wrong path disappear!
    So try the workaround above, while opencode and your browser do not run!

  10. github-actions commented on Aug 14, 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.

  11. Hona commented on Sep 2, 2026

    @Hona
    Member
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