Skip to content

fix: use UMO-bound config for group_icl_enable in on_message#7397

Open
saschabuehrle wants to merge 1 commit intoAstrBotDevs:masterfrom
saschabuehrle:fix/issue-7305-group-icl-umo
Open

fix: use UMO-bound config for group_icl_enable in on_message#7397
saschabuehrle wants to merge 1 commit intoAstrBotDevs:masterfrom
saschabuehrle:fix/issue-7305-group-icl-umo

Conversation

@saschabuehrle
Copy link
Copy Markdown

@saschabuehrle saschabuehrle commented Apr 6, 2026

Fixes #7305

on_message() currently reads group_icl_enable from the default config via self.context.get_config().
When a platform instance is bound to a non-default profile, this can disable group context recording even though ltm_enabled() correctly reads the UMO-bound config.

This patch makes on_message() read group_icl_enable with the same umo=event.unified_msg_origin lookup path used by ltm_enabled().

Greetings, saschabuehrle

Summary by Sourcery

Bug Fixes:

  • Fix reading of group_icl_enable in on_message to respect UMO-bound configuration instead of always using the default profile.

@auto-assign auto-assign bot requested review from advent259141 and anka-afk April 6, 2026 11:21
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 6, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • When switching get_config to use umo=event.unified_msg_origin, consider guarding against missing or partial config (e.g., using .get with sensible defaults) to avoid runtime errors if the UMO-bound profile lacks provider_ltm_settings or group_icl_enable.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- When switching `get_config` to use `umo=event.unified_msg_origin`, consider guarding against missing or partial config (e.g., using `.get` with sensible defaults) to avoid runtime errors if the UMO-bound profile lacks `provider_ltm_settings` or `group_icl_enable`.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dosubot dosubot bot added the area:core The bug / feature is about astrbot's core, backend label Apr 6, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the configuration retrieval in the on_message method to include the unified message origin (umo). The reviewer suggests optimizing performance by fetching the configuration once at the beginning of the method to avoid redundant lookups across multiple calls.

Comment on lines +39 to +41
group_icl_enable = self.context.get_config(
umo=event.unified_msg_origin
)["provider_ltm_settings"]["group_icl_enable"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The configuration for the current UMO is fetched multiple times in this method (via ltm_enabled, need_active_reply, and again here). While this PR correctly fixes the UMO binding, consider fetching the configuration once at the beginning of on_message and reusing it to avoid redundant lookups and improve efficiency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 群聊上下文感知在绑定非默认配置文件时失效:读取了错误配置中的 group_icl_enable

1 participant