Skip to content

fix: allow deleting assistants and sessions whose workspace directory is unavailable - #3152

Open
legenddcr wants to merge 2 commits into
GCWing:mainfrom
legenddcr:fix/invalid-workspace-item-deletion
Open

legenddcr wants to merge 2 commits into
GCWing:mainfrom
legenddcr:fix/invalid-workspace-item-deletion

Conversation

@legenddcr

Copy link
Copy Markdown
Contributor

Fixes #3150

Summary

Two related fixes so items whose workspace directory is unavailable can still be deleted.

1. Assistant workspaces with legacy or missing directories (desktop)

delete_assistant_workspace, reset_assistant_workspace, and reset_workspace_persona_files rejected any assistant whose registry record still points at the legacy BitFun root ~/.bitfun/personal_assistant/workspace-<id> (directories the brand migration never relocated), and there was no path for records whose directory is already gone — the assistant could never be deleted from the UI.

  • New WorkspaceService::is_manageable_assistant_workspace_path accepts both the current layout (~/.openbitfun/personal_assistant/workspace[-<id>]) and the legacy layout (~/.bitfun/personal_assistant/workspace[-<id>]). The legacy root name comes from the new legacy_hidden_data_directory() in core-types; the private constant in legacy-migration now reuses it.
  • delete_assistant_workspace: managed paths delete the directory as before; unmanaged records whose directory no longer exists fall back to a registry-only cleanup (logged in English); existing directories outside both managed layouts are still refused — the deletion safety boundary is unchanged.
  • reset_assistant_workspace and reset_workspace_persona_files accept both layouts.

2. Sessions whose workspace path is missing (web-ui)

FlowChatStore.deleteSession still required a workspace path before calling the backend, so sessions whose workspace directory is missing never reached the ID-first delete_session command; failures were swallowed and the session reappeared after reload.

  • The guard is removed; the workspace id is snapshotted synchronously before the first await, pre-ID sessions fail loudly, and backend delete failures surface through the existing notification path after local cleanup.
  • LocalSessionDriver cleanup moved into try/finally so local state is cleared even when backend cleanup fails.

Verification

  • cargo test -p openbitfun-core --no-default-features --features agent-runtime,git --lib service::workspace::service::tests — 20 passed
  • cargo test -p openbitfun-desktop --lib api::commands::assistant_workspace_delete_tests — 3 passed
  • cargo test -p openbitfun-legacy-migration --test migration_engine_contracts — 10 passed
  • cargo check -p openbitfun-desktop on this branch
  • Front-end suites (FlowChatStore 146 passed, SessionModule 52 passed, session-drivers 14 passed) were run on the pre-rebase working tree; the touched front-end files are unchanged between that baseline and this branch's base, so the results carry over.

Remote scenarios

Deletion and reset are local registry + local filesystem operations invoked through existing Tauri commands; no remote-surface contract changed and no new commands were added.

…ath is missing

FlowChatStore.deleteSession kept a stale workspace-path guard, so the
ID-first backend delete was never invoked and the session reappeared
after reload.

Refs GCWing#3150
…spaces

Assistant workspace records left at the legacy BitFun root
(~/.bitfun/personal_assistant/) by the brand migration, and orphaned
records whose directory is already gone, can now be deleted or reset.
Existing directories outside the managed layouts are still refused.
The legacy_hidden_data_directory() constant now comes from core-types,
replacing the private copy in legacy-migration.

Fixes GCWing#3150
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)

1 participant