mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-15 17:30:13 +08:00
* fix: reject follow-up messages after stop requested (#6626) Once a user sends /stop, follow-up messages should no longer be accepted for that runner. Previously, there was a race window where messages sent after stop could still be queued as follow-ups. This fix gates the follow_up() method to check both done() and _stop_requested before accepting a new follow-up message. Acceptance criteria met: - After /stop, later follow-up messages return None (rejected) - Post-stop follow-ups are not added to _pending_follow_ups - No post-stop text is injected into tool results - Graceful-stop behavior otherwise unchanged - Follow-ups submitted before stop retain current behavior Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test: add regression tests for issue #6626 follow-up rejection Add focused tests that verify the complete tool-result injection path for follow-up messages after stop is requested: - test_follow_up_rejected_and_runner_stops_without_execution: Verifies that when stop is requested before any execution, follow-ups are rejected and the runner stops gracefully without executing tools. - test_follow_up_merged_into_tool_result_before_stop: Verifies that follow-ups queued before stop are properly merged into tool results via _merge_follow_up_notice(). - test_follow_up_after_stop_not_merged_into_tool_result: Regression test that simulates the race condition from issue #6626. Verifies that only pre-stop follow-ups are merged into tool results, and post-stop follow-ups are rejected at the admission point. These tests validate the fix in ToolLoopAgentRunner.follow_up() that checks both self.done() and self._stop_requested before accepting new follow-up messages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(agent): update stop request check in ToolLoopAgentRunner --------- Co-authored-by: ccsang <ccsang@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Soulter <905617992@qq.com>
31 KiB
31 KiB