fix (core): Multiple clones of same repo are different projects#35311
fix (core): Multiple clones of same repo are different projects#35311belisoful wants to merge 13 commits into
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
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:
Note: PR #29977 ( The current PR (#35311) appears to be focused specifically on changing |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
…n a project unique keying from the repo.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
I did a GUI test to check that different clones of the same repo are separate "projects". 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. |
|
The GUI side is now updated because it was keying from the repo-clone path. |
|
I looked through this because it is the core/server side of the repeated Desktop clone-collision reports (#29869/#32785/#33615). The UUID-in-git-common-dir approach looks like the right shape to me: separate clones get separate durable IDs, linked worktrees still share a common identity, and path moves avoid the git-store-path hash problem from #29977. One migration edge case I think is still worth checking before merge: in Maybe the same exact-directory/under-directory repair used for sessions should also apply to Local verification I could run here:
I could not run the Git-backed backend tests locally because this environment uses Snap Bun, which cannot spawn host |
|
I think you are correct about the migration edge case. The fix for the specified migration edge case will be up some time later today. OpenCode really needs this refactor, the bug is preventing real work from being completed |
|
In the bug-era merged state, UpdatedWorkspace reclaim. The exact-directory adoption in Fixed as suggested. Two related issues your scenario surfaced:
The Agent suggests:
If you find the cosmetic and transient issue an issue, I'll fix that too. The trade off is between a git resolution per workspace row and the "cosmetic/transient" managed-worktree workspace being listed in the wrong repo-clone until first use (where it then moves to the correct project). This is a very rare condition because workspaces are currently gated behind OPENCODE_EXPERIMENTAL_WORKSPACES and not many are using it(? right?). Thanks also for flagging the Snap Bun / posix_spawn limitation — for the record, the git-backed suites pass here: 96 tests / 0 fail across test/project/ (one platform-conditional skip), plus typecheck on packages/opencode and packages/app. |
|
@rifqi2320 The PR for "Multiple clones of same repo are different projects #35311" is updated.
|
Issue for this PR
Closes #17940 #19348 #29869 #29871 #29962 #29936 #29977 #30302 #31593 #31686 #31890 #32785 #32801 #33313 #33615
Type of change
What does this PR do?
This PR changes
.git/opencodefrom 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?
Screenshots / recordings
N/A
Checklist