From 552ebd5d9a55f478947c50bf7e6c84526ef11d3a Mon Sep 17 00:00:00 2001 From: Blueteemo Date: Thu, 30 Apr 2026 00:12:58 +0800 Subject: [PATCH 1/3] fix: check event.is_stopped() after handler execution in star_request.py --- astrbot/core/pipeline/process_stage/method/star_request.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/astrbot/core/pipeline/process_stage/method/star_request.py b/astrbot/core/pipeline/process_stage/method/star_request.py index 9422d6317a..877dba3a23 100644 --- a/astrbot/core/pipeline/process_stage/method/star_request.py +++ b/astrbot/core/pipeline/process_stage/method/star_request.py @@ -47,6 +47,8 @@ async def process( async for ret in wrapper: yield ret event.clear_result() # 清除上一个 handler 的结果 + if event.is_stopped(): + break except Exception as e: traceback_text = traceback.format_exc() logger.error(traceback_text) From 37ac1247c0edaeeeb431d8bd12ef923910428b2c Mon Sep 17 00:00:00 2001 From: Blueteemo Date: Thu, 30 Apr 2026 00:26:39 +0800 Subject: [PATCH 2/3] fix: move is_stopped() check before clear_result(), add check in except block and loop start --- astrbot/core/pipeline/process_stage/method/star_request.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/astrbot/core/pipeline/process_stage/method/star_request.py b/astrbot/core/pipeline/process_stage/method/star_request.py index 877dba3a23..3ee9fe6d0a 100644 --- a/astrbot/core/pipeline/process_stage/method/star_request.py +++ b/astrbot/core/pipeline/process_stage/method/star_request.py @@ -34,6 +34,8 @@ async def process( handlers_parsed_params = {} for handler in activated_handlers: + if event.is_stopped(): + break params = handlers_parsed_params.get(handler.handler_full_name, {}) md = star_map.get(handler.handler_module_path) if not md: @@ -46,9 +48,9 @@ async def process( wrapper = call_handler(event, handler.handler, **params) async for ret in wrapper: yield ret - event.clear_result() # 清除上一个 handler 的结果 if event.is_stopped(): break + event.clear_result() # 清除上一个 handler 的结果 except Exception as e: traceback_text = traceback.format_exc() logger.error(traceback_text) @@ -70,3 +72,5 @@ async def process( event.clear_result() event.stop_event() + if event.is_stopped(): + break From 8c2173d58fb15dad804348471133db8233274880 Mon Sep 17 00:00:00 2001 From: Blueteemo Date: Thu, 30 Apr 2026 00:35:06 +0800 Subject: [PATCH 3/3] fix: remove redundant is_stopped() check after stop_event() in except block --- astrbot/core/pipeline/process_stage/method/star_request.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/astrbot/core/pipeline/process_stage/method/star_request.py b/astrbot/core/pipeline/process_stage/method/star_request.py index 3ee9fe6d0a..3adcddc077 100644 --- a/astrbot/core/pipeline/process_stage/method/star_request.py +++ b/astrbot/core/pipeline/process_stage/method/star_request.py @@ -72,5 +72,3 @@ async def process( event.clear_result() event.stop_event() - if event.is_stopped(): - break