Skip to content

fix (core): Multiple clones of same repo are different projects - #35311

Open
belisoful wants to merge 27 commits into
anomalyco:devfrom
belisoful:dev
Open

fix (core): Multiple clones of same repo are different projects#35311
belisoful wants to merge 27 commits into
anomalyco:devfrom
belisoful:dev

Conversation

@belisoful

@belisoful belisoful commented Jul 4, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #17940 #19348 #29869 #29871 #29962 #29936 #29977 #30302 #31593 #31686 #31890 #32785 #32801 #33313 #33615 #42040

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR changes .git/opencode from the hash of the repo name to json; with a version and UUID. This UUID per repo-clone (locally) satisfies work trees being keyed to their respective repo-clones and separating repo-clones from each other (locally).

The file is automatically upgraded if the file is not json/UUID format. The upgrade path is automatic.

The GUI touches the project on open to ensure consistency.

Changing the path (or folder name) of a repo-clone keeps the same UUID. The project stops working in the GUI... when the new moved project is opened then the session and work trees are updated. The old project (and session data) is updated to the new path; with the old project sessions updated to the new project path-location.

How did you verify your code works?

  • New unit tests to verify behavior.
  • GUI test for Open Project on already open project, regression passed.
  • GUI test for Open Project on the same repo cloned in two different locations do open in separate projects.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Hey! Your PR title Multiple clones of same repo are different projects - Fixes: #29869 doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search results, I found a related PR:

Potential Related PR:

  • PR fix(project): repair split project IDs across worktrees #14287 - fix(project): repair split project IDs across worktrees
    • This PR appears to address a similar concern about worktrees and project ID separation, which is related to the core issue of distinguishing multiple clones of the same repository as different projects.

Note: PR #29977 (fix(core): include git store hash in project ID to distinguish indepe…) also appeared in results but may be an older or related attempt at solving a similar problem.

The current PR (#35311) appears to be focused specifically on changing .git/opencode to store JSON with a version and UUID to uniquely identify repo clones, which is a different approach to solving the worktree/project separation problem that PR #14287 addresses.

@belisoful belisoful changed the title Multiple clones of same repo are different projects - Fixes: #29869 fix: Multiple clones of same repo are different projects - #29869 Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@belisoful

belisoful commented Jul 6, 2026

Copy link
Copy Markdown
Author

I did a GUI test to check that different clones of the same repo are separate "projects".
"Open Project" on an existing repo-clone brings up that repo-clone, like before.

I wanted to actually do a real test myself before submitting this PR. (Ed: Done; checked and confirmed working)

We are seeing this issue re-listed over and over.

@belisoful
belisoful marked this pull request as ready for review July 6, 2026 04:32
@belisoful belisoful changed the title fix: Multiple clones of same repo are different projects - #29869 fix (projects): Multiple clones of same repo are different projects - #29869 Jul 6, 2026
@belisoful belisoful changed the title fix (projects): Multiple clones of same repo are different projects - #29869 fix (core): Multiple clones of same repo are different projects - #29869 Jul 6, 2026
@belisoful
belisoful marked this pull request as draft July 6, 2026 08:43
@belisoful

Copy link
Copy Markdown
Author

The GUI side is now updated because it was keying from the repo-clone path.
Also, when a directory is moved, then re-opened, the internal session and work trees are updated to the new location.

@belisoful
belisoful marked this pull request as ready for review July 6, 2026 21:58
@belisoful
belisoful requested a review from Hona as a code owner July 6, 2026 21:58
@lovesdo79

Copy link
Copy Markdown

这个一个严重的BUG,为什么一个多月没有修复合并,你们脑子瓦特了吗?

@belisoful

Copy link
Copy Markdown
Author

@lovesdo79 我完全同意!

English: I couldn't agree more!

@lidaqi001

lidaqi001 commented Aug 5, 2026

Copy link
Copy Markdown

到底什么时候能够修复这个大bug啊!!!
还要拖到什么时候

@rifqi2320

Copy link
Copy Markdown

i basically stopped using opencode desktop app because of this, would really love to go back if you guys is going to fix this bug

@belisoful

belisoful commented Aug 5, 2026

Copy link
Copy Markdown
Author

@rifqi2320 Yesterday, when you posted, I had also just cancelled my $10/mo subscription to "OpenCode.ai Go" because of this bug! Synchronicity is awesome. Just wanted to add this... they are losing real money over this bug.

The outrageous thing is that the Devs can click "merge" on this PR and the bug goes away... people start using OpenCode again.

Let me "Update Branch" yet again.

@lidaqi001 如果 OpenCode 不合并修复关键错误的重大 PR,它还能算得上是真正“开放”的吗?这个漏洞让他们蒙受了切实的经济损失。(如果翻译得很糟糕,还请见谅)

English: Is OpenCode really open if they don't merge important PRs to fix critical bugs? They are losing real money from this bug.

@lidaqi001

Copy link
Copy Markdown

@rifqi2320 Yesterday, when you posted, I had also just cancelled my $10/mo subscription to "OpenCode.ai Go" because of this bug! Synchronicity is awesome. Just wanted to add this... they are losing real money over this bug.

The outrageous thing is that the Devs can click "merge" on this PR and the bug goes away... people start using OpenCode again.

Let me "Update Branch" yet again.

@lidaqi001 如果 OpenCode 不合并修复关键错误的重大 PR,它还能算得上是真正“开放”的吗?这个漏洞让他们蒙受了切实的经济损失。(如果翻译得很糟糕,还请见谅)

English: Is OpenCode really open if they don't merge important PRs to fix critical bugs? They are losing real money from this bug.

我完全同意你的说法, 并且感谢你的pr
I totally agree with you and thank you for your pr.

Add repoHash to the .git/opencode identity file, project table, and Project.Info: 
the legacy identity derivation (normalized remote hash, falling back to root commit), byte-identical to pre-UUID project ids. Migrated files reuse their existing legacy hash.
Informational only — never used as identity — so UIs can group distinct clones of the same repository.
No UI changes; the field reaches clients via the regenerated SDK types.
@belisoful

Copy link
Copy Markdown
Author

The repo hash is now included in the project json so the UI can sort and filter by repo, with projects for the repo (in different folders) listed separately. The DB is updated, and property linked into the UI.

NO USER INTERFACE WORK. This PR is only the back end.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants