Skip to content

fix(workspace): recognize legacy BitFun assistant workspaces and allow session deletion - #3428

Open
skyfireitdiy wants to merge 1 commit into
GCWing:mainfrom
skyfireitdiy:fix/issue-3150-upstream
Open

skyfireitdiy wants to merge 1 commit into
GCWing:mainfrom
skyfireitdiy:fix/issue-3150-upstream

Conversation

@skyfireitdiy

@skyfireitdiy skyfireitdiy commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3150

背景 / Background

BitFun → OpenBitFun 品牌迁移后,旧品牌根 ~/.bitfun/personal_assistant/ 下的助理工作区无法被删除/重置。根因是后端 is_assistant_workspace_path 只认新根(~/.openbitfun/...)而拒绝旧路径。同类症状是:工作区路径失效的会话在前端无法删除(deleteSession 残留 workspace path 守卫)。

修改点 / Changes

后端 src/crates/assembly/core/src/service/workspace/service.rs

  • assistant_descriptor_from_path 增加 legacy 分支:识别旧根 ~/.bitfun/personal_assistant/ 下的 workspace-<id> 与默认 workspace(无 id 后缀,返回 assistant_id=None),使 delete/reset 命令仍能对旧品牌工作区生效。

前端 src/web-ui/src/flow_chat/store/FlowChatStore.ts

  • 移除 deleteSession 的 workspace path 守卫(if (!sess || !sessionProjectWorkspacePath(sess)) { throw ... })。后端按 workspace ID(而非路径)解析会话存储,因此即使工作区目录不可用(如迁移前的助理工作区)也应继续尝试删除。

测试情况 / Tests

  • 后端 Rust:新增 legacy_bitfun_assistant_workspace_paths_are_still_recognized
    • cargo +stable test -p openbitfun-core --lib --features "agent-runtime,git" legacy_bitfun → 1 passed
  • 前端 Vitest:新增 deletes a session whose workspace directory is unavailable (ID-first backend)
    • vitest run src/flow_chat/store/FlowChatStore.test.ts -t "session removal active selection" → 8 passed(含新测试)

…w session deletion

The BitFun → OpenBitFun rebranding left pre-migration assistant workspaces rooted at the legacy hidden directory (~/.bitfun). Previously, these paths were rejected by `is_assistant_workspace_path`, preventing delete/reset commands from operating on them. Now, legacy assistant workspace paths are recognized, including the default workspace without an ID suffix.

Additionally, session deletion no longer requires a workspace path to be present, since the backend resolves session storage by workspace ID rather than by path. This allows deleting sessions whose workspace directory is unavailable (e.g., pre-migration workspaces).

Co-Authored-By: Jarvis-AI-42 <skyfireitdiy@gmail.com>
@GCWing

GCWing commented Oct 19, 2026

Copy link
Copy Markdown
Owner

原有的目录是否0.2.x可以删除。
还是指用工具迁移后,无法删除新的迁移后的助理。

@skyfireitdiy

Copy link
Copy Markdown
Contributor Author

都不是。这个 PR 修的是迁移后残留的旧助理,不是 0.2.x 目录,也不影响已迁移的新助理。

背景:Data Migrator 是复制而非移动,迁移完成后 ~/.bitfun/personal_assistant/ 旧目录仍保留在磁盘上。正常情况下,成功迁移的助理其 rootPath 会被重写到 ~/.openbitfun/personal_assistant/,删除不受影响。但 Issue #3150 里那个助理迁移被跳过/未覆盖(源目录保留、rootPath 仍指向 ~/.bitfun/...),当前版本只认新根,导致它在 UI 里永远删不掉。

这个 PR 让 is_assistant_workspace_path 同时识别 ~/.bitfun/personal_assistant/workspace-<id> 与默认 workspace,使这类残留的旧助理也能被删除/重置(真正删掉该目录),并移除前端 deleteSession 对失效工作区路径的守卫。已迁移到新根的助理行为不变。


🤖 此评论由 Jarvis GitHub/Gitee 插件自动处理

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 无法删除工作区路径失效的个人助理(Workspace path is not a managed assistant workspace)

3 participants