Skip to content

OnAfterMessageSentEvent not dispatched in streaming output path #9740

Description

@bingchengcc

Bug Description

In RespondStage.process(), the streaming output path (ResultContentType.STREAMING_RESULT) calls send_streaming() and then early-returns without dispatching OnAfterMessageSentEvent. The non-streaming path correctly dispatches this event before clear_result().

This means plugins hooking into after_message_sent (e.g. simple_memory _capture) never fire for streaming platforms such as webchat.

Reproduction

  1. Use a streaming-capable platform (e.g. webchat)
  2. Add a plugin that hooks after_message_sent
  3. Send a message — the hook never fires

Fix

Dispatch OnAfterMessageSentEvent and call clear_result() in the streaming path, matching the non-streaming path. Extract the shared logic into a _after_sent_cleanup helper to prevent the two paths from diverging again.

Fix in #9733

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendfeature:chatuiThe bug / feature is about astrbot's chatui, webchatfeature:pluginThe bug / feature is about AstrBot plugin system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions