fix(opencode): recover projects moved to a new path - #38584
Open
1hirak wants to merge 2 commits into
Open
Conversation
This was referenced Jul 24, 2026
|
#35311 is a much better solution than this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #38578
Type of change
What does this PR do?
When a Git repository moved, the stored project kept the missing original path
as its primary worktree and tracked the live path as a sandbox. Desktop startup
could therefore request the deleted path first, causing Git discovery to fail
in
FileSystem.realPathbefore the existing project record could be repaired.This change recovers the project at both boundaries:
surviving sandbox;
context, so the stale and current requests share one valid instance;
database migration;
directory, including their relative
path, without changingtime_updated; andRecovery is intentionally conservative: it only redirects a missing primary
worktree when exactly one recorded sandbox still exists. Existing behavior is
unchanged when the primary worktree exists or multiple live sandboxes make the
replacement ambiguous.
How did you verify your code works?
The regression tests create a Git repository, seed project and legacy-global
sessions plus a workspace, move the repository, and then request the deleted
path. They verify:
Executed:
Screenshots / recordings
Not applicable; this is a project/session persistence and instance-routing fix
with no UI changes.
Checklist