fix(desktop): handle moved projects and deleted paths - #34137
Closed
opencode-agent[bot] wants to merge 1 commit into
Closed
fix(desktop): handle moved projects and deleted paths#34137opencode-agent[bot] wants to merge 1 commit into
opencode-agent[bot] wants to merge 1 commit into
Conversation
opencode-agent
Bot
force-pushed
the
desktop-relocated
branch
from
June 27, 2026 02:34
6723592 to
c9e1aed
Compare
This was referenced Jul 24, 2026
Contributor
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
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.
Summary
Fixes #30697
Fixes #31869
Related: #25625
Context: #34073
Reproduction evidence
Pinned unmodified base:
cd56c51e2d1fabe59e88d7128bb24e546a452053Moved project
Against the base, using an isolated real
opencode serveprocess and the real app in headless Chromium:project-a.project-a/src.project-b.project-bin the app without pre-registering it.Observed:
project.current(directory=project-b)returnedworktree: project-aandsandboxes: [project-b].session.list(directory=project-b)returned[]; SQLite retained both session directories underproject-a./path,/session,/vcs, etc. requests for the deletedproject-apath.This follows directly from base
fromDirectory: a stable project ID reusesexisting.worktree, then classifies the newly opened path as a sandbox. Desktop subsequently canonicalizes sandbox entries to that stale root inlayout.tsx.During verification, the first revision still had a first-open race: the global
project.listrequest could return the missing primary while the new directory was initializing, and the app still requested the old path. The current revision therefore omits unavailable primary checkouts fromProject.list. The identical first-readd browser flow now makes zero requests toproject-a; the DB ends withworktree: project-b, no sandbox alias, and the root session atproject-b.Deleted path in Changes tree
Against the same base and real app:
src/deleted-parent/file.ts.src/deleted-parentdirectory.The Git diff contained one deleted file. The real browser requested:
GET /file?path=src→ 200GET /file?path=src/deleted-parent→ 500GET /file?path=→ 200The UI displayed
Failed to list files / Unexpected server error. The server loggedPlatformError: NotFound: FileSystem.realPath (.../src/deleted-parent).The filtered tree already synthesizes every parent and file from
alloweddiff paths infile-tree.tsx, but base auto-expands those synthetic directories throughfile.tree.expand, which lists the filesystem (lines 305-321).FileSystem.listresolves the missing path withrealPath(...).pipe(Effect.orDie), producing the 500 (filesystem.ts).The current revision marks synthetic nodes expanded without loading them and skips root listing for filtered trees. Under the identical real-browser flow, the deleted tree still renders, there are zero
/filerequests, no toast, and no deleted-path server error. Normal unfiltered file browsing still lists real directories and preserves real errors.Test plan
cd packages/app && bun run test:unit— 433 passcd packages/app && bun typecheckcd packages/opencode && bun test test/project/project.test.ts— 38 passcd packages/opencode && bun test --timeout 30000 test/server/httpapi-file.test.ts— 2 passcd packages/opencode && bun typecheckopencode serveAPI flows