Repository navigation
Description
Description
The new-session project chip (first chip under the composer) never follows a directory selection for sibling directories of the same repository. It keeps showing the repository's canonical directory, and the checkmark in the dropdown stays on that same row, so switching between sibling clones looks like it silently failed.
It is UI-only: the click does update the draft's directory (verified in the desktop state store), and the session is created in the clicked directory, but the chip label and the checkmark never change. This makes it impossible to tell which directory a new session will run in.
Root cause, read from the shipped renderer bundle. GET /api/project returns one Project for all clones:
{"id":"7f3bb1b0…","canonical":"/home/me/work/app-dev","sandboxes":["/home/me/work/app-uat","/home/me/work/app-release"]}The server-scoped projects store resolves each directory entry as {...projectRecord, ...directoryEntry}, so every sibling directory entry carries the same sandboxes array. The composer's selected-item resolver then does one find() over both predicates:
list.find(e => e.worktree === dir || e.sandboxes?.some(s => s === dir))For dir = .../app-uat, the first entry (app-dev, whose hydrated sandboxes contains app-uat) matches the second predicate, so find() returns it before the exact-match entry is ever considered. The chip label and the checkmark are both derived from that resolver.
Suggested fix: exact match first, sandboxes only as a fallback:
list.find(e => e.worktree === dir) ?? list.find(e => e.sandboxes?.some(s => s === dir))The sidebar project rows are unaffected, because they compare the selected directory exactly.
Plugins
@tarquinen/opencode-dcp, @maximtop/opencode-session-namer, @prevalentware/opencode-goal-plugin, opencode-tui-usage
OpenCode version
v2.0.28
Steps to reproduce
- Clone the same git remote into three independent directories (e.g. app-dev, app-uat, app-release) — three plain clones, not worktrees, so they all resolve to the same project ID.
- Add all three directories as projects in OpenCode Desktop.
- Start a new session in one of the non-canonical clones (e.g. app-uat).
- Open the project chip dropdown under the composer. The chip and the checkmark both stay on app-dev.
- Select app-release. Still app-dev.
The click itself works: after selecting app-uat, the draft's directory in ~/.config/ai.opencode.desktop/drafts.sqlite becomes .../app-uat and lastProject follows, and GET /api/location?location[directory]=.../app-uat returns project.canonical = .../app-uat. Only the chip label and the checkmark are stale.
Reproducible every time for any repository that has more than one of its directories added as a project (I hit it with three clones of one repo).
Screenshot and/or share link
A 12s screen recording of the dropdown (checkmark stuck on the canonical directory while the draft directory is a sibling clone) is available on request.
Operating System
Linux 6.6.155-amd64-desktop-hwe (x86_64), Deepin desktop, X11
Terminal
OpenCode Desktop (Electron app), no terminal attached
Activity
opencode-agent commentedon Oct 14, 2026
Thanks for the detailed report and root-cause analysis. I could reproduce this.
How I tested it
app-dev,app-uat,app-release), withopencode servestarted fromapp-dev.GET /api/projectreturns one project withapp-devas canonical and the other two clones insandboxes, as in your report.What happened
app-uatshowsapp-devon the chip.app-uat, thenapp-release, from the dropdown updates the selected directory each time, but the chip label and the checkmark stay onapp-dev.This happens on v2.0.28 and still happens on the latest
dev(34d8ded). The resolver inpackages/app/src/new-session/project/selector.tsxis the singlefind()over both conditions that you described.One side note: v2's server never fills in
sandboxeson its own. Only the v1-to-v2 migration writes it, so your project data probably came from v1.The recording below shows it on
dev, the screenshots show the dropdown after pickingapp-releaseon both versions, and the script below reproduces it.recording.mp4
Reproduction script (repro.mjs)
Run it:
bun repro.mjsbrettjohnsen-sy commentedon Nov 3, 2026
Also seeing related behavior on OpenCode Desktop 2.2.5 on macOS (Apple Silicon), with two independent clones of the same Git remote. Their
.gitdirectories are separate; they are not linked worktrees./path/repo-mainin the desktop app./path/repo-prusing the Projects folder-plus button.repo-main.pwd: it correctly reports/path/repo-pr. The session breadcrumb also shows the PR directory, so this is not evidence that edits run in the wrong clone.The impact extends beyond the selector label: without a separate project entry, the user cannot easily browse the PR clone’s prior session history in the desktop UI. The session API does return prior sessions for
/path/repo-pr, so the history exists.Expected: independently selected clone directories should be clearly distinguishable in the UI, with a way to browse each directory’s history, even if they share a project identity internally. The issue description says the sidebar rows are unaffected; this report may be a related but distinct sidebar/history problem on 2.2.5. No screenshots or private repository details included.