永久删除伙伴被 BOT_SHARED_HISTORY_REFERENCED 永久卡死:completed 委派/closed 私聊线程也阻断删除,且错误被 UI 吞成「操作未完成,请稍后重试」
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 401
- Avg merge
- 21h 40m
- Merged PRs (30d)
- 805
Description
## 复现环境
- 客户端:0.1.76(当日 hotfix,latest,无法再升级)
- OS:win32 x64
## 复现步骤
1. 在「伙伴」列表对某一个伙伴点「**永久删除**」
2. 弹窗「这会删掉……删了找不回来」后点确认
3. 页面提示「**操作未完成,请稍后重试**」——删除永远不成功
## 真实日志(被 UI 吞掉的根因)
```
[db-worker] db client rpc failed { op: 'tx', err: 'Bot 有共享委派或私聊历史,不能永久删除' }
[console] Error occurred in handler for 'maker:bot-lifecycle:action': Error: Bot 有共享委派或私聊历史,不能永久删除
code: 'BOT_SHARED_HISTORY_REFERENCED'
```
## 数据层面挡路的是什么(已实测本机 DB)
删除保护检查了 `bot_delegations` 和 `bot_direct_message_threads`:
- `bot_delegations`:该 bot 有一条**已 completed** 的委派记录(委托任务早已结束)
- `bot_direct_message_threads`:该 bot 有 closed(idle-timeout 关闭)与 active 的私聊 thread
即:连「已完成委派」「已关闭线程」也会挡住永久删除,且 UI 没有任何「结束/清除这些引用后再删」的入口,删除操作于是永久卡死。
## 预期/建议
1. `completed` 的委派与 `closed` 的线程不再作为删除阻挡条件(或集中导出为可清理列表);
2. 提供「强制删除(含清理历史委派/线程)」入口,由用户确认后执行;
3. 因保护拒绝时,也请把 db 层错误翻译成可执行动提示(如「请先结束与该伙伴的委派或对话」),不再用「操作未完成,请稍后重试」这种无信息量文案。
Contributor guide
Research direction
Start at the db-worker transaction for the `maker:bot-lifecycle:action` handler and inspect its checks on `bot_delegations` and `bot_direct_message_threads`. Trace how `BOT_SHARED_HISTORY_REFERENCED` reaches the UI. Done means eligible completed delegations and closed threads no longer block deletion, or a confirmed cleanup path exists, and refusal shows an actionable message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, database, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100