anomalyco / anomalyco/opencode

desktop(win): fresh service start registers user home and drive root as ghost projects (no sessions, deletion does not stick)

Open
#49,428 1 comment 0 reactions 1 assignee View on GitHub

@Hona is already working on this.

Since Sep 17, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

On Windows, every fresh start of the OpenCode Desktop background service (opencode-cli.exe serve --service) registers the user's home directory (C:\Users\<user>) and the drive root (C:\) as projects in the server database. These project rows contain no sessions. Deleting them from Desktop → Settings → Projects does not stick: the next fresh service start (app relaunch, reboot auto-start) re-registers them, so the Projects list keeps growing ghost entries.

Environment

  • opencode version: 2.0.5 (desktop-managed CLI, channel latest)
  • OS: Windows 11 Pro 24H2 (Windows_NT 10.0.26200, win32 x64)
  • Terminal: OpenCode Desktop (Electron) 2.0.5
  • Shell: PowerShell 7 (user default)
  • Install/channel: desktop app packaged build, latest
  • Active plugins: opencode-mem@latest (global config)

Reproduction

  1. In Desktop → Settings → Projects, delete the extra entries (keep only the real project).
  2. Fully quit the Desktop app and kill the background service (opencode-cli.exe), or reboot (Desktop auto-starts on login).
  3. Open the Desktop app and let the background service start fresh.
  4. Settings → Projects shows the deleted entries again: C:\Users\<user> and C:\, both with zero sessions.

Reproducible consistently on every fresh service start.

Expected Behavior

The background service should not register directories as projects on its own. Startup should only register (at most) directories actually opened by the user — not the service's cwd (user home) and not the drive root.

Actual Behavior

Project rows for C:\Users\<user> and C:\ are inserted into the project table on service boot, matching the service startup timeline exactly (same second):

project table (opencode.db, redacted):

worktree time_created note
C:/Users/<user>/Documents/Default Project earlier real project
C:/Users/<user> 01:27:14 local ghost, 0 sessions
C:/ 01:27:20 local ghost, 0 sessions, 6 s after boot
/ built-in global project

Corresponding server log (~/.local/share/opencode/log/opencode.log, timestamps UTC):

2026-09-16T17:27:11Z run=4acc5529 message="cli starting" version=2.0.5 args=["--version"] role=cli
2026-09-16T17:27:12Z run=939abf0f message="cli starting" version=2.0.5 args=["serve","--service"] role=cli
2026-09-16T17:27:14Z run=939abf0f message="location services booted" directory="C:\Users\<user>" role=server
2026-09-16T17:27:20Z run=939abf0f message="watcher subscribe" path="C:\" type=entries role=server

Desktop main.log (01:27 boot) shows the app auto-starting and spawning the v2 background service; no explicit project directory is passed.

session / session_v2 tables contain no rows for either ghost directory — the projects exist purely from startup registration.

Additional Context

  • The ghost rows also cause the service to set up type=entries directory watchers on C:\, C:\Users, and C:\Users\<user> (drive-root-level watchers), which may have performance implications on machines with busy root directories.
  • Possibly related: #33309 (reject instance requests for non-existent directories), #47208 (show server-known projects in project lists).
  • Desktop app: ai.opencode.desktop 2.0.5; service command line: opencode-cli.exe serve --service.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.