Description
When built-in group chat context awareness and image captioning are enabled, a text message sent immediately after an image can overtake the image while its caption is being generated.
The LLM request triggered by the text message then receives no context for the preceding image. If captioning fails, the stored group context also loses the image completely and contains only the sender/timestamp prefix.
Reproduction Steps
- Enable built-in group chat context awareness.
- Enable group image captioning with a vision provider.
- Send an image to a group.
- Immediately send a text comment about that image.
- Trigger an LLM response from the text message.
- Inspect the injected group context.
This is also reproducible without third-party plugins by invoking GroupChatContext.handle_message() concurrently: block the first image caption call, then handle a following plain-text event. The plain-text event completes first on current master.
Expected: the image record is completed before the later text record and is included in the text-triggered LLM request.
Actual: the text record can be appended first and the request contains no image caption.
AstrBot Version
v4.27.2 and master at a9bb8a6
Operating System
Linux
Deployment Method
Docker (soulter/astrbot:latest)
Message Platform Adapter
OneBot v11 (NapCat / aiocqhttp)
Error Log
[Core] [INFO] [core.event_bus]: user: [image]
[Core] [INFO] [core.event_bus]: user: text commenting on the image
[Plug] [DBUG] [astrbot.group_chat_context]: [user]: text commenting on the image
[Core] [DBUG] [agent_sub_stages.internal]: ready to request llm provider
[Plug] [DBUG] [astrbot.group_chat_context]: [user]: [Image: caption completed later]
There is no exception in the successful-caption case. Each event is dispatched in its own task while handle_message() waits for _format_message() before acquiring its per-session lock and appending the record.
On caption failure, the related log is:
[Plug] [ERRO] [astrbot.group_chat_context]: 获取图片描述失败: <provider error>
[Plug] [DBUG] [astrbot.group_chat_context]: [user/time]:
Supplementary Information
The issue is in the built-in GroupChatContext; a direct unit-level reproduction loads no third-party plugins.
Checklist
Description
When built-in group chat context awareness and image captioning are enabled, a text message sent immediately after an image can overtake the image while its caption is being generated.
The LLM request triggered by the text message then receives no context for the preceding image. If captioning fails, the stored group context also loses the image completely and contains only the sender/timestamp prefix.
Reproduction Steps
This is also reproducible without third-party plugins by invoking
GroupChatContext.handle_message()concurrently: block the first image caption call, then handle a following plain-text event. The plain-text event completes first on current master.Expected: the image record is completed before the later text record and is included in the text-triggered LLM request.
Actual: the text record can be appended first and the request contains no image caption.
AstrBot Version
v4.27.2 and master at a9bb8a6
Operating System
Linux
Deployment Method
Docker (
soulter/astrbot:latest)Message Platform Adapter
OneBot v11 (NapCat / aiocqhttp)
Error Log
There is no exception in the successful-caption case. Each event is dispatched in its own task while
handle_message()waits for_format_message()before acquiring its per-session lock and appending the record.On caption failure, the related log is:
Supplementary Information
The issue is in the built-in
GroupChatContext; a direct unit-level reproduction loads no third-party plugins.Checklist
GroupChatContextpath and was closed without merging.