Skip to content

### [Desktop] 无法删除已失效的工作区路径,卸载重装后依旧残留 #36234

Closed as not planned

Description

@zhenxiwen

Description

opencode desktop 在打开一个不存在的目录(如 D:\WenObsidianVault,D盘已移除)后,该路径会永久残留,无法通过 UI 删除。即使:

  • 手动删除 AppData\Roaming\ai.opencode.desktop 下的 workspace .dat 文件
  • 卸载程序并删除安装目录
  • 重新安装

该路径仍然会出现在 opencode 中。

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

路径信息至少存储在 4 个地方,散落在不同文件的不同 JSON 字段中,没有统一的删除入口:

  1. opencode.workspace.D--WenObsidi.k9vod1.dat — 工作区文件
  2. opencode.global.dat / notification — 通知历史记录
  3. opencode.global.dat / server.recentlyClosed — 最近关闭的项目列表
  4. opencode.global.dat / layout (sessionView) — 会话视图布局状态

即使找到了第 1 个文件删掉,其余 3 处残留还在,重装后 opencode 仍会加载该路径。

复现步骤

  1. 在某个已存在的工作目录(如 D:\somefolder)中打开 opencode desktop
  2. 移除该盘符或目录(如拔掉 D 盘)
  3. 重启 opencode desktop
  4. 该路径仍然在 UI 中显示,无法删除
  5. 卸载 opencode 并删除 Programs\@opencode-aidesktop 安装目录
  6. 重装 opencode
  7. 步骤 4 的路径仍然出现

建议修复方向

  1. UI 层面:工作区列表增加右键菜单 "删除此工作区",或设置页面提供已打开项目的删除入口
  2. 卸载程序:卸载时询问用户是否清除 %AppData%\ai.opencode.desktop\ 下的用户数据
  3. 存储层面:工作区路径统一存储(当前散落在 4 个位置),不要各个模块各自存一份

环境

  • opencode desktop 版本:[请补充]
  • 操作系统:Windows

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Jul 10, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. tomideas commented on Jul 27, 2026

    @tomideas

    我用AI试了能删项目的方法(即UI 中不再显示), 你可以参考。

    删除 OpenCode 专案的方法:

    1. Opencode 利用AI进行以下指令
    2. 打开 %APPDATA%\ai.opencode.desktop\opencode.global.dat
    3. 找到 "server" 那行,里面有一段 "local":[{...}]
    4. 删掉目标专案的整个 {"worktree":"...","expanded":true}(含后面逗号)
    5. 存档,重开

    风险只有一个要记住:

    • global.dat → 随便改,只影响侧边栏显示
    • %LOCALAPPDATA%\share\opencode\opencode.db → 不能碰,那是所有对话记录,删了就永久没
  3. github-actions commented on Sep 26, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions