Repository navigation
docs: document isolated session impact on session_id and unified_msg_origin - #10538
Open
lingyun14beta wants to merge 1 commit into
Open
lingyun14beta wants to merge 1 commit into
lingyun14beta wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="docs/en/dev/astrbot-config.md" line_range="166" />
<code_context>
Whether to enable **Isolate Conversation**. Defaults to `false`. On supported platforms, each group member has a separate conversation context when enabled. Unsupported platforms retain their existing context. Access to `/new` and `/reset` is controlled by [command permissions](../use/command.md), which follow conversation isolation by default.
+The setting also rewrites the session identifier of group messages: `session_id` becomes a platform-specific composite ID (on QQ, `sender ID_group ID`), and `unified_msg_origin` changes along with it. Plugins that store or query data per group should use `event.get_group_id()` to get the raw group ID; see [Handling Message Events](./star/guides/listen-message-event).
+
#### `platform_settings.rate_limit`
</code_context>
<issue_to_address>
**DingTalk IDs lack group**
When a plugin relies on the documented composite ID format for a DingTalk group message, dingTalk’s unique-session builder sets `session_id` to `event.get_sender_id()` only, so the ID has no group component; a plugin expecting the documented sender-and-group format parses or uses the wrong per-group key.
Document that DingTalk’s builder returns only the sender ID, and avoid promising a composite ID format for every supported platform.
Also at `docs/zh/dev/astrbot-config.md:166`, `docs/en/dev/star/guides/listen-message-event.md:46-47`, `docs/zh/dev/star/guides/listen-message-event.md:46-47`.
</issue_to_address>
### Comment 2
<location path="docs/en/dev/star/guides/send-message.md" line_range="42" />
<code_context>
)
```
+> [!WARNING]
+> The example above uses `unified_msg_origin` as the conversation history storage key. When **Isolate Conversation** (`platform_settings.unique_session`) is enabled, the `unified_msg_origin` of group messages changes, so the same group resolves to a different conversation depending on the setting. Use `event.get_group_id()` when you need to target a group; see [Handling Message Events](./listen-message-event).
+
</code_context>
<issue_to_address>
**Group ID breaks message sending**
When a plugin passes `event.get_group_id()` directly to `Context.send_message` as the send target, `Context.send_message` passes the raw group ID to `MessageSesion.from_str`, which raises `ValueError` because the ID is not a `unified_msg_origin` or `MessageSession`; the message is not sent.
Clarify that `event.get_group_id()` is for group identification, not a `Context.send_message` target; use a `unified_msg_origin` or `MessageSession` to send.
Also at `docs/zh/dev/star/guides/send-message.md:42-43`, `docs/en/dev/star/guides/send-message.md:43`.
</issue_to_address>
### Comment 3
<location path="docs/en/dev/astrbot-config.md" line_range="166" />
<code_context>
Whether to enable **Isolate Conversation**. Defaults to `false`. On supported platforms, each group member has a separate conversation context when enabled. Unsupported platforms retain their existing context. Access to `/new` and `/reset` is controlled by [command permissions](../use/command.md), which follow conversation isolation by default.
+The setting also rewrites the session identifier of group messages: `session_id` becomes a platform-specific composite ID (on QQ, `sender ID_group ID`), and `unified_msg_origin` changes along with it. Plugins that store or query data per group should use `event.get_group_id()` to get the raw group ID; see [Handling Message Events](./star/guides/listen-message-event).
+
#### `platform_settings.rate_limit`
</code_context>
<issue_to_address>
**Session IDs stay unchanged**
When isolate Conversation is enabled on a platform without a registered unique-session builder, `build_unique_session_id` returns `None`, so `WakingCheckStage.process` leaves `event.session_id` unchanged and `unified_msg_origin` does not change; plugin authors expecting a changed key are misled.
Qualify the notices to say that session IDs change only on platforms with a unique-session builder.
Also at `docs/zh/dev/astrbot-config.md:166`, `docs/en/dev/star/guides/listen-message-event.md:46-47`, `docs/zh/dev/star/guides/listen-message-event.md:46-47`, `docs/en/dev/star/guides/ai.md:377`, `docs/zh/dev/star/guides/ai.md:375`, `docs/en/dev/star/guides/send-message.md:43`, `docs/zh/dev/star/guides/send-message.md:43`, `docs/zh/dev/star/plugin.md:134-135`.
</issue_to_address>Sourcery assessment
Approval pending. 3 findings to address first.
Blocking findings: docs/en/dev/astrbot-config.md:166, docs/en/dev/star/guides/send-message.md:42, docs/en/dev/astrbot-config.md:166
…origin When `platform_settings.unique_session` (Isolate Conversation) is enabled, group messages get a platform-specific composite `session_id`, so `unified_msg_origin` changes with it. Plugins that key per-group data on either value silently address a different session once the setting flips. - Warn about the rewrite in the message event guide and recommend `event.get_group_id()` for per-group storage (zh/en) - Correct the `AstrBotMessage.session_id` comment: it holds the raw adapter value, only the event's copy is rewritten - State the mechanism in the `platform_settings.unique_session` reference and point to the guide (zh/en) - Note the consequence where a stored `unified_msg_origin` is used as a conversation or history key (send-message, ai; zh/en) - List the per-platform formats and note that DingTalk returns the sender ID alone, and that unsupported platforms keep their `session_id` unchanged - Clarify that `event.get_group_id()` is for identification only and is not a valid `Context.send_message` target
lingyun14beta
force-pushed
the
fix/docs-isolated-session-umo
branch
from
October 12, 2026 15:26
e22b2be to
db34146
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enabling Isolate Conversation (
platform_settings.unique_session) rewrites thesession_idof group messages to a platform-specific composite ID, sounified_msg_originchanges with it. Plugins that store or query data per groupby either value address a different session once the setting is toggled, and the
current docs never mention this.
Continues #7947, which was closed by the stale-PR cleanup, rebased on current
master.Modifications / 改动点
after example and the
event.get_group_id()recommendation (zh/en)AstrBotMessage.session_idcomment: it holds the raw adapter value;only the event's
session_idcopy is rewrittenplatform_settings.unique_sessionreference page,which previously described only the conversational consequence (zh/en)
unified_msg_originis used as aconversation or history key (send-message, ai; zh/en)
%, not_)9 files changed, 30 insertions(+), 3 deletions(-)
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
📚 I checked the affected WebUI instructions and screenshots in
docs/zhanddocs/enagainst the changed navigation, page structure, and labels, and updated them in this PR (or explained why no documentation update is needed). For renamed, moved, or merged entry points, I included an old entry → new entry mapping in the documentation and changelog./ 我已对照变化后的 WebUI 入口、页面结构和术语,核对并在本 PR 中更新
docs/zh和docs/en的相关操作说明与截图(或说明无需更新文档的原因)。入口改名、移动或合并时,已在文档和 changelog 中补充 旧入口 → 新入口 对照。🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Document the identifier changes and plugin considerations introduced by enabling isolated conversations.
Enhancements:
Documentation: