Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="astrbot/builtin_stars/builtin_commands/commands/conversation.py" line_range="120-128" />
<code_context>
+ cfg = self.context.get_config(umo=umo)
+ agent_runner_type = cfg["agent_runner"]["runner_type"]
+
+ active_event_registry.stop_all(umo, exclude=message)
+ cid = await self.context.conversation_manager.get_curr_conversation_id(umo)
+ if agent_runner_type in THIRD_PARTY_AGENT_RUNNER_KEY:
+ await _clear_third_party_agent_runner_state(
+ self.context,
+ umo,
+ agent_runner_type,
+ )
+ else:
+ if cid:
+ await self.context.conversation_manager.update_conversation(
</code_context>
<issue_to_address>
**issue (bug_risk):** `reset` removes the third-party runner's stored conversation/thread ID immediately after `active_event_registry.stop_all`, but `stop_all` does not wait for already-running requests to finish. A request that completes afterward writes its newly received Dify/Coze/DashScope/DeerFlow ID back to session storage, so the next user message continues the supposedly reset remote conversation.
**Triggers:** When a third-party runner request is still completing while `/reset` is processed.
**Suggested fix:** Invalidate the runner state with a generation/token or await/cancel the relevant tasks before removing the stored remote conversation ID, and ignore late writes from the invalidated request.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if the new /reset behavior is wrong, it permanently clears the current conversation's stored history and may clear remote runner context; reverting the code will not restore that data. The impact is bounded to the session being reset, but the deleted context cannot be recovered by rerunning the command.
Blocking findings: astrbot/builtin_stars/builtin_commands/commands/conversation.py:128
| active_event_registry.stop_all(umo, exclude=message) | ||
| cid = await self.context.conversation_manager.get_curr_conversation_id(umo) | ||
| if agent_runner_type in THIRD_PARTY_AGENT_RUNNER_KEY: | ||
| await _clear_third_party_agent_runner_state( | ||
| self.context, | ||
| umo, | ||
| agent_runner_type, | ||
| ) | ||
| else: |
There was a problem hiding this comment.
issue (bug_risk): reset removes the third-party runner's stored conversation/thread ID immediately after active_event_registry.stop_all, but stop_all does not wait for already-running requests to finish. A request that completes afterward writes its newly received Dify/Coze/DashScope/DeerFlow ID back to session storage, so the next user message continues the supposedly reset remote conversation.
Triggers: When a third-party runner request is still completing while /reset is processed.
Suggested fix: Invalidate the runner state with a generation/token or await/cancel the relevant tasks before removing the stored remote conversation ID, and ignore late writes from the invalidated request.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
astrbot-docs | 11540df | Commit Preview URL Branch Preview URL |
Sep 19 2026, 07:52 AM |
This reverts commit e24f5ff.
This reverts commit 3fa0477.
Summary
Validation
Summary by Sourcery
Separate
/resetcontext clearing from/newconversation creation while preserving the appropriate local and remote conversation state.Bug Fixes:
/resetand/newconversation behavior across built-in and third-party Agent Runners.Enhancements:
/resetclear the active conversation context while preserving its metadata, and make/newcreate a separate conversation while retaining previous local records.Documentation:
/resetand/newsemantics.Tests: