You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Opening a second checkout of the same repository redirects to the stored worktree #50821
The app identifies a project by its git remote, so every local checkout of the same repository maps to one project (by design, see #36219). The project row keeps the worktree of the checkout that was opened first. When a second checkout is opened later, the client resolves it to the same project and navigates to the stored worktree instead of the directory the user picked:
projectRoot() in packages/app/src/pages/layout.tsx maps the opened directory to the project's stored worktree
navigateToProject() then navigates to that root and restores the most recent session under it
rootFor() / projects.open() in packages/app/src/context/layout.tsx collapse the opened directory onto the stored worktree as well
Two visible consequences:
With both checkouts on disk, opening the new one lands in the old one: old path in the URL, old session list, old project name and icon.
After the old checkout is deleted, the stored worktree still points at the missing path, so opening the new checkout keeps targeting it. The persisted project list on the client (opencode.global.dat -> server.projects) also keeps the dead entry in the sidebar.
The server-side stale worktree fallback is handled separately in #47326. This issue is about the client: when the opened directory is itself a registered directory of the project (its worktree or one of its sandboxes), the app should stay on it.
Plugins
None
OpenCode version
1.18.30 (dev)
Steps to reproduce
Clone a repository with a remote to /tmp/repo-a, open it in the app, and create a session there
Copy or re-clone it to /tmp/repo-b (same remote, so both resolve to the same project id)
Open /tmp/repo-b through the project picker
The app navigates to /tmp/repo-a and restores its latest session
Quit, delete /tmp/repo-a, relaunch, and open /tmp/repo-b again
It still resolves to the deleted /tmp/repo-a
Screenshot and/or share link
N/A
Operating System
macOS 15
Terminal
N/A (web app served locally; the same layout code runs in the desktop app)
If your report covers a distinct aspect (e.g. the specific client-side navigation path through projectRoot() / navigateToProject() / rootFor(), or the stale dead-path case after deleting the original checkout), it may still warrant its own issue — but please review the above first and add a note here if you believe this is meaningfully different.
Thanks for the report! In OpenCode 2.0 the app keeps the folder you picked instead of redirecting to another checkout of the same repository. If you still see this on the latest OpenCode, please open a new issue with details. Closing as completed.
Activity
github-actions commentedon Sep 23, 2026
This issue might be a duplicate of existing issues. Please check:
If your report covers a distinct aspect (e.g. the specific client-side navigation path through
projectRoot()/navigateToProject()/rootFor(), or the stale dead-path case after deleting the original checkout), it may still warrant its own issue — but please review the above first and add a note here if you believe this is meaningfully different.Tarquinen commentedon Oct 20, 2026
Thanks for the report! In OpenCode 2.0 the app keeps the folder you picked instead of redirecting to another checkout of the same repository. If you still see this on the latest OpenCode, please open a new issue with details. Closing as completed.
— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊