fix(core): improve conversation delete selectors#966
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Walkthrough本次变更新增批量删除选择器解析并接入会话删除流程,扩展删除命令文本参数及测试覆盖;同时统一聊天中间件的目标会话解析,并调整 Gemini 工具调用字段名和 Git 忽略规则。 Changes会话删除流程
Gemini 工具配置
仓库元数据
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant chatluna_delete
participant resolve_conversation
participant parseDeleteSeqs
participant conversation_manage
participant deleteConversation
User->>chatluna_delete: 提交文本删除选择器
chatluna_delete->>resolve_conversation: 解析删除目标
resolve_conversation->>parseDeleteSeqs: 解析数字与范围
parseDeleteSeqs-->>resolve_conversation: 返回序号集合
resolve_conversation->>conversation_manage: 传递批量删除目标
conversation_manage->>deleteConversation: 逐项执行删除
deleteConversation-->>conversation_manage: 返回成功或失败
conversation_manage-->>User: 返回删除结果
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors the conversation deletion logic by extracting and enhancing the sequence parsing into a shared utility function parseDeleteSeqs that supports multiple separators and ranges. It also updates the Gemini adapter to dynamically select the key for server-side tool invocations based on camelCase configuration. Feedback is provided regarding a potential ReDoS vulnerability in parseDeleteSeqs where the input length check should be performed before executing the regular expression to prevent performance degradation.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/core/src/commands/conversation.ts (1)
237-260: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
text参数会吞掉后置选项。chatluna.delete这里把conversation改成text后,用户如果写成chatluna.delete 3 -a,-a会被并入参数值,includeArchived不会生效。需要在帮助里明确要求“先写选项,后写目标”,或提醒用户把文本用引号包起来。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/commands/conversation.ts` around lines 237 - 260, chatluna.delete 的 text 类型 conversation 参数会吞掉其后的选项,导致 `includeArchived` 等选项失效。更新该命令的帮助文本或使用提示,明确要求用户先写选项再写目标 conversation,或将包含选项的目标文本用引号包裹;保留现有选项解析和删除逻辑不变。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/core/src/middlewares/system/conversation_manage.ts`:
- Around line 309-329: Update the batch-delete loop around deleteConversation to
catch errors per target, collecting successful conversation labels and failed
target labels separately instead of letting one exception abort the whole
operation. Build the final context.message using the existing
delete_success_multi/delete_failed messages for all-success/all-failure cases
and the new delete_partial i18n message when both collections are non-empty,
then return the same STOP status.
---
Outside diff comments:
In `@packages/core/src/commands/conversation.ts`:
- Around line 237-260: chatluna.delete 的 text 类型 conversation 参数会吞掉其后的选项,导致
`includeArchived` 等选项失效。更新该命令的帮助文本或使用提示,明确要求用户先写选项再写目标
conversation,或将包含选项的目标文本用引号包裹;保留现有选项解析和删除逻辑不变。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0a45c96a-5ab8-4028-8243-3093088e19f5
📒 Files selected for processing (10)
.gitignorepackages/adapter-gemini/src/utils.tspackages/core/src/commands/conversation.tspackages/core/src/middlewares/chat/rollback_chat.tspackages/core/src/middlewares/chat/stop_chat.tspackages/core/src/middlewares/conversation/resolve_conversation.tspackages/core/src/middlewares/system/conversation_manage.tspackages/core/src/utils/conversation.tspackages/core/tests/conversation-resolve.spec.tspackages/core/tests/conversation-utils.spec.ts
This pr improves conversation delete selectors and related resolve handling.
Bug Fixes
Other Changes
Validation