desktop: new-session project chip never reflects sibling directories of the same git repo
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 66/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- electron, typescript
- 領域
- desktop
調査の方向性
バグは composer の選択項目リゾルバにあり、list.find() で e.worktree === dir と e.sandboxes?.some(...) の OR 条件を実行しています。renderer のプロジェクトチップとドロップダウンのコードから始め、GET /api/project のレコードを各ディレクトリエントリにマージしている projects ストアを確認してください。チップのラベルとチェックマークが選択された兄弟ディレクトリに追従し、完全一致が sandboxes へのフォールバックより先に試され、サイドバーの動作が変わらなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- TypeScript
- スター
- 213k
- フォーク
- 28.4k
- 平均マージ
- 8時間 58分
- マージ済み PR(30日)
- 251
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
anomalyco/opencode のほかの issue
-
reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
anomalyco/opencode#56038 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
anomalyco/opencode#56002 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
app: keybinds match the produced character, so Ctrl+F and other letter shortcuts fail on non-Latin layouts対応中かも @ZXLyyds100 が 1 日前に担当しました。 オープンreproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
anomalyco/opencode#55676 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
tui: NumPad End/Home ignored under kitty keyboard protocol (Windows Terminal reports KP_END 57424)対応中かも @argszero が 1 日前に担当しました。 オープンreproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
anomalyco/opencode#55533 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
anomalyco/opencode#55383 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
anomalyco/opencode の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
agilepathway/label-checker#739 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
CopilotKit/OpenBot#800 ·
メンテナーはふだん 1 日以内に返信
-
Endpoint links in the tag operations list are below the 24px target size対応中かも @AdzerKI が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
ehmpathy/rhachet-roles-bhuild#471 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信