feat(dingtalk): support shared session context in group chats - #7208
Merged
Conversation
hongxicheng
requested a deployment
to
ai-review-approved
August 21, 2026 09:48 — with
GitHub Actions
Waiting
|
Hi @hongxicheng, this is your 156th Pull Request. 🙌 Join Developer CommunityThanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page: We truly appreciate your enthusiasm—and look forward to your future contributions! 😊 We'll review your PR soon. |
hongxicheng
requested a deployment
to
ai-review-approved
August 24, 2026 07:50 — with
GitHub Actions
Waiting
hongxicheng
force-pushed
the
ding-shared-session
branch
from
August 24, 2026 08:57
ef6d519 to
bb79993
Compare
hongxicheng
requested a deployment
to
ai-review-approved
August 24, 2026 08:57 — with
GitHub Actions
Waiting
hongxicheng
force-pushed
the
ding-shared-session
branch
from
August 26, 2026 04:09
bb79993 to
f8c6638
Compare
hongxicheng
requested a deployment
to
ai-review-approved
August 26, 2026 04:09 — with
GitHub Actions
Waiting
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.

Description
DingTalk group chats previously always isolated context per member:
session_idis derived from the conversation id suffix, but
user_idis the sender, andsession state is keyed by
(user_id, session_id)— so every member got theirown context.
This PR adds a
share_session_in_grouptoggle so group members can share oneconversation context, matching the existing option in Feishu / WeCom / OneBot /
Matrix.
Defaults to
false, preserving current behavior — existing users see no change.Implementation (two call sites, both required)
build_agent_request_from_native— in a group with sharing on,request.user_idcollapses to the constant
"group"(same approach as WeCom). The rawpayload["sender_id"]is left untouched, so logging,acl_sender_idandmeta["user_name"]are unaffected.get_debounce_key— stops appendingsender_idwhen sharing is on. This oneis easy to miss but necessary: the queue key is computed from the payload at
enqueue time, before the
AgentRequestexists, so it cannot see thecollapsed
user_id. Changing only (1) would route two members of the samegroup into two queues with two concurrent consumers, while their
chat.idisnow identical —
TaskTracker.attach_or_startthen returnsis_new=False, thelater message only receives a subscriber queue and its payload is never
executed (log:
Message ignored (task already running)). Feishu and WeComdon't hit this because their payloads carry
session_id, so their queues arealready per-conversation.
Send path is unaffected
DingTalk resolves delivery targets through a stored sessionWebhook table.
Verified that changing
user_iddoes not affect it:meta["session_webhook"]— no table lookup.dingtalk:sw:<session_id>(no
user_idin the key).dingtalk:sw:group_<session_id>and fall backthrough
_suffix_only_webhook_keyto the group entry (covered by a test).conversation_id/sender_staff_id, unrelated touser_id.Drive-by fix (missing docs)
Feishu and WeCom have supported
share_session_in_groupin code for a while, butneither channel doc ever mentioned it (WeCom even defaults to
true, so users hadno documented way to find or disable it). This PR adds the field to their JSON
examples, channel-specific field tables and the appendix config overview.
Related Issue: Closes #7158
Security Considerations: [If applicable, e.g. channel auth, env/config handling]
Type of Change
Component(s) Affected
Checklist
pre-commit run --all-fileslocally and it passespytestor as relevant) and they passFor Channel Changes (DingTalk, Lark, QQ, Console, etc.)
./scripts/check-channels.sh(or./scripts/check-channels.sh --changed) and it passestests/contract/channels/test_<channel>_contract.py(REQUIRED)create_instance()with proper channel initializationtests/contract/channels/__init__.py)tests/unit/channels/test_<channel>.pyfor complex internal logicTesting
[How to test these changes]
Evidence
Examples of valid evidence:
pytest tests/unit/app/chats/ -qoutput)pre-commit run --all-filessummaryAdditional Notes
[Optional: any other context]