Summary
OpenCode Desktop can make its local sidecar server unresponsive for many minutes when opening a git project that contains a very large directory tree. The trigger appears to be desktop-enabled project icon discovery.
In the packaged desktop app, preferAppEnv() forces:
OPENCODE_EXPERIMENTAL_ICON_DISCOVERY: "true"
Then Project.fromDirectory starts Project.discover, which runs an unbounded recursive glob over the whole worktree:
fs.glob("**/favicon.{ico,png,svg,jpg,jpeg,webp}", {
cwd: input.worktree,
absolute: true,
include: "file"
})
On worktrees with a pathological number of directories, this can monopolize the sidecar process. While this is happening, even /global/health does not respond, so the Desktop app reports the local server as down. After the glob eventually finishes, the server becomes healthy again.
Environment
- OpenCode Desktop: 1.15.12
- OS: Windows
- Project type: git worktree
- Desktop local sidecar process: Electron
node.mojom.NodeService
Observed behavior
- OpenCode Desktop starts normally and the sidecar reports ready.
- Opening a specific git worktree triggers directory-specific requests.
- The sidecar stops responding even to
/global/health.
- One sidecar thread burns CPU for many minutes.
- After enough time passes, the server recovers and endpoints respond again.
This looks like a CPU-bound scan rather than a crash or permanent deadlock.
Evidence
In a real project, a runtime/cache directory contained a very large tree:
data/free-runtime/stale-leases
A safe diagnostic scan that intentionally skipped .git, .venv, venv, Backups, and editor/service directories still did not finish after 30 seconds and had already visited:
177350 directories
6865 files
0 favicon matches
Chromium request logs showed a long gap where only health/event requests were attempted; after the CPU-bound work completed, normal endpoints resumed.
The issue reproduces in Desktop, but not in CLI-like usage, which is consistent with Desktop forcing OPENCODE_EXPERIMENTAL_ICON_DISCOVERY=true.
Expected behavior
Project icon discovery should not be able to make the sidecar/local server unavailable.
At minimum, it should:
- honor common ignore directories such as
.git, node_modules, .venv, venv, dist, build, cache/runtime directories, and ideally configured watcher/gitignore excludes;
- use a bounded search strategy rather than
**/favicon... over the entire worktree;
- have a timeout or match/entry limit;
- not block sidecar health/API responsiveness;
- allow users to explicitly disable desktop icon discovery via env/config instead of Desktop unconditionally forcing it on.
Suggested fixes
Possible options:
- Do not force
OPENCODE_EXPERIMENTAL_ICON_DISCOVERY=true in Desktop when the user explicitly set it to false.
- Replace the full recursive glob with bounded candidate paths, for example root/public/static/assets/app directories with limited depth.
- Apply the same ignore/protected directory policy used elsewhere before scanning.
- Run icon discovery in a cancellable worker/child process with timeout/limit so it cannot block the sidecar event loop.
- Skip discovery once a project has any explicit icon override, and expose that as a normal UI/config fallback.
Workaround
Setting an explicit project icon override prevents Project.discover from scanning that project, but users should not need to patch local state to keep Desktop responsive.
Summary
OpenCode Desktop can make its local sidecar server unresponsive for many minutes when opening a git project that contains a very large directory tree. The trigger appears to be desktop-enabled project icon discovery.
In the packaged desktop app,
preferAppEnv()forces:OPENCODE_EXPERIMENTAL_ICON_DISCOVERY: "true"Then
Project.fromDirectorystartsProject.discover, which runs an unbounded recursive glob over the whole worktree:On worktrees with a pathological number of directories, this can monopolize the sidecar process. While this is happening, even
/global/healthdoes not respond, so the Desktop app reports the local server as down. After the glob eventually finishes, the server becomes healthy again.Environment
node.mojom.NodeServiceObserved behavior
/global/health.This looks like a CPU-bound scan rather than a crash or permanent deadlock.
Evidence
In a real project, a runtime/cache directory contained a very large tree:
A safe diagnostic scan that intentionally skipped
.git,.venv,venv,Backups, and editor/service directories still did not finish after 30 seconds and had already visited:Chromium request logs showed a long gap where only health/event requests were attempted; after the CPU-bound work completed, normal endpoints resumed.
The issue reproduces in Desktop, but not in CLI-like usage, which is consistent with Desktop forcing
OPENCODE_EXPERIMENTAL_ICON_DISCOVERY=true.Expected behavior
Project icon discovery should not be able to make the sidecar/local server unavailable.
At minimum, it should:
.git,node_modules,.venv,venv,dist,build, cache/runtime directories, and ideally configured watcher/gitignore excludes;**/favicon...over the entire worktree;Suggested fixes
Possible options:
OPENCODE_EXPERIMENTAL_ICON_DISCOVERY=truein Desktop when the user explicitly set it tofalse.Workaround
Setting an explicit project icon override prevents
Project.discoverfrom scanning that project, but users should not need to patch local state to keep Desktop responsive.