Project icons are incorrectly inherited by new projects #6603

Open
opened 2026-02-16 18:04:43 -05:00 by yindo · 4 comments
Owner

Originally created by @stenci on GitHub (Jan 17, 2026).

Originally assigned to: @adamdotdevin on GitHub.

Description

Project icon assignment is incorrectly inherited from an existing project instead of being independent.

I have 4 existing projects with icons assigned and several projects without icons. When I create a new project, it automatically gets the icon of the first project that has an icon assigned.

Additionally, editing or removing the icon of that first project or any new project causes all newly created projects (that inherited the icon) to update or revert together. This does not affect all projects, only:

  • the first project with an icon
  • all projects created after that point

This suggests icon inheritance or default state is incorrectly tied to the first iconized project.

Plugins

No response

OpenCode version

  • The icons were correctly created with versions < 1.1.23
  • The issue first appeared on 1.1.23
  • The issue still reproduces on 1.1.25

Steps to reproduce

  1. Have multiple existing projects, with at least one project having an icon.
  2. Create a new project.
  3. Observe that the new project inherits the icon of the first project with an icon.
  4. Edit or remove the icon of that first project.
  5. Observe that all newly created projects update or revert their icon together.

Screenshot and/or share link

Image Image

Operating System

Windows 10

Terminal

No terminal, I'm using the desktop application

Originally created by @stenci on GitHub (Jan 17, 2026). Originally assigned to: @adamdotdevin on GitHub. ### Description Project icon assignment is incorrectly inherited from an existing project instead of being independent. I have 4 existing projects with icons assigned and several projects without icons. When I create a **new project**, it automatically gets the icon of the **first project that has an icon assigned**. Additionally, editing or removing the icon of that first project or any new project causes all newly created projects (that inherited the icon) to update or revert together. This does **not** affect all projects, only: - the first project with an icon - all projects created after that point This suggests icon inheritance or default state is incorrectly tied to the first iconized project. ### Plugins _No response_ ### OpenCode version - The icons were correctly created with versions < 1.1.23 - The issue first appeared on 1.1.23 - The issue still reproduces on 1.1.25 ### Steps to reproduce 1. Have multiple existing projects, with at least one project having an icon. 2. Create a new project. 3. Observe that the new project inherits the icon of the first project with an icon. 4. Edit or remove the icon of that first project. 5. Observe that all newly created projects update or revert their icon together. ### Screenshot and/or share link <img width="186" height="625" alt="Image" src="https://github.com/user-attachments/assets/5b5c33bf-f881-423d-b043-f8d077362632" /> <img width="149" height="620" alt="Image" src="https://github.com/user-attachments/assets/456faa75-fdd4-4ab9-a22c-7ca3db04b82b" /> ### Operating System Windows 10 ### Terminal No terminal, I'm using the desktop application
yindo added the bugweb labels 2026-02-16 18:04:43 -05:00
Author
Owner

@stenci commented on GitHub (Jan 17, 2026):

I reverted back to version 1.1.21 and the problem persists.

Using 1.1.21, I was originally able to create 4 projects and assign 4 different icons successfully. I then upgraded to 1.1.23 and 1.1.25 and created additional projects; all newly created projects shared the same icon.

After reverting again to 1.1.21, those newly created projects still share the same icon, even if I edit or remove their icons.

This suggests the issue is introduced during project creation in versions >= 1.1.23, rather than being a general icon management problem.

@stenci commented on GitHub (Jan 17, 2026): I reverted back to version 1.1.21 and the problem persists. Using 1.1.21, I was originally able to create 4 projects and assign 4 different icons successfully. I then upgraded to 1.1.23 and 1.1.25 and created additional projects; all newly created projects shared the same icon. After reverting again to 1.1.21, those newly created projects still share the same icon, even if I edit or remove their icons. This suggests the issue is introduced during project creation in versions >= 1.1.23, rather than being a general icon management problem.
Author
Owner

@stenci commented on GitHub (Jan 19, 2026):

I dug into the code and found the root cause. Project IDs are derived from the git root commit. If the working directory has no .git or the repo has no commits, opencode falls back to projectID = "global". That means all those projects share the same storage/project/global.json, so icons appear inherited and edits apply together.

My workflow often includes a single parent folder with no git repo, containing multiple subfolders, each with its own git repo (web app, Excel macro, tools, etc.). I keep them together so one opencode session can coordinate changes across all of them. Because the parent has no .git, new projects end up in "global".

Suggested fix for non‑git folders: persist a stable per‑directory project ID instead of using "global". Two possible approaches:

  • Use the directory name (better than global, but renames break identity).
  • Create a .opencode folder inside the directory that stores a generated project ID (and possibly the icon).

I strongly prefer option 2 because it keeps identity stable across renames and gives a natural place to store project‑level assets like icons.

@stenci commented on GitHub (Jan 19, 2026): I dug into the code and found the root cause. Project IDs are derived from the git root commit. If the working directory has no .git or the repo has no commits, opencode falls back to projectID = "global". That means all those projects share the same storage/project/global.json, so icons appear inherited and edits apply together. My workflow often includes a single parent folder with no git repo, containing multiple subfolders, each with its own git repo (web app, Excel macro, tools, etc.). I keep them together so one opencode session can coordinate changes across all of them. Because the parent has no .git, new projects end up in "global". Suggested fix for non‑git folders: persist a stable per‑directory project ID instead of using "global". Two possible approaches: - Use the directory name (better than global, but renames break identity). - Create a `.opencode` folder inside the directory that stores a generated project ID (and possibly the icon). I strongly prefer option 2 because it keeps identity stable across renames and gives a natural place to store project‑level assets like icons.
Author
Owner

@attkri commented on GitHub (Feb 14, 2026):

I can reproduce this on Desktop and can confirm the behavior is identity-coupling related, not just UI rendering.

Observed:

  • New projects can inherit an existing icon.
  • Updating/removing the original icon updates inherited ones as well.

Likely cause:

  • Projects without a resolvable git-based identity appear to fall back to a shared/global ID, so multiple projects map to the same project storage entry.

Suggested fix direction:

  1. Never use a shared fallback identity across distinct project paths.
  2. Generate a per-project stable fallback ID (path-derived hash or local project metadata).
  3. Add migration logic for existing "global"-backed entries to avoid breaking existing users.
  4. Add regression tests:
    • non-git folder A and non-git folder B must produce different project IDs
    • icon updates in A must not affect B
    • behavior remains stable across app restart

Happy to help test a patch build on Windows.

@attkri commented on GitHub (Feb 14, 2026): I can reproduce this on Desktop and can confirm the behavior is identity-coupling related, not just UI rendering. Observed: - New projects can inherit an existing icon. - Updating/removing the original icon updates inherited ones as well. Likely cause: - Projects without a resolvable git-based identity appear to fall back to a shared/global ID, so multiple projects map to the same project storage entry. Suggested fix direction: 1. Never use a shared fallback identity across distinct project paths. 2. Generate a per-project stable fallback ID (path-derived hash or local project metadata). 3. Add migration logic for existing "global"-backed entries to avoid breaking existing users. 4. Add regression tests: - non-git folder A and non-git folder B must produce different project IDs - icon updates in A must not affect B - behavior remains stable across app restart Happy to help test a patch build on Windows.
Author
Owner

@attkri commented on GitHub (Feb 14, 2026):

Additional reproducible scenario from Windows Desktop (likely related persistence regression):

  1. Right-click project icon -> Edit
  2. Select an SVG icon file located in the repo root
  3. Save -> icon is shown correctly
  4. Close OpenCode Desktop and open it again
  5. Icon is gone and falls back to the default first-letter avatar

Expected:

  • The selected icon should persist after app restart.

Regression note:

  • This worked before version 1.20 (per repeated local testing).
@attkri commented on GitHub (Feb 14, 2026): Additional reproducible scenario from Windows Desktop (likely related persistence regression): 1. Right-click project icon -> Edit 2. Select an SVG icon file located in the repo root 3. Save -> icon is shown correctly 4. Close OpenCode Desktop and open it again 5. Icon is gone and falls back to the default first-letter avatar Expected: - The selected icon should persist after app restart. Regression note: - This worked before version 1.20 (per repeated local testing).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6603