企微不同的人/群,上下文串台
Pre-checks
- [x] I have searched existing issues and this is not a duplicate.
Deployment Method
Docker
Steps to Reproduce
1、添加数字员工到企微机器人 2、单聊 3、拉企微进群 4、群里 at 企微, 回复私人单聊消息, 发现session 不隔离
Expected vs Actual Behavior
企微(或者其他 IM)不同人/群 Session 隔离
Logs / Screenshots
抱歉,由于企业保密问题,无法企微截屏。
This issue has been fixed in commit adf86c5. Changes:
Root Cause: Group chat sessions were incorrectly attributed to individual users instead of being treated as shared group conversations. Three specific bugs:
find_or_create_channel_session()re-attributed sessionuser_idto the latest sender in group chats- WeCom webhook handler ignored group chat IDs entirely (always used
wecom_p2p_) - Slack and Discord included
sender_idin theirconv_id, creating per-user sessions even in shared channels
Fix:
- Added
is_group(bool) andgroup_name(string) fields toChatSessionmodel - Group sessions use the agent creator's
user_idas a stable placeholder - Group sessions are excluded from the 'mine' session scope and only visible in 'all sessions' view (admin/creator only)
- Fixed
conv_idgeneration across all 6 IM channel handlers (Feishu, WeCom webhook, WeCom WebSocket, Slack, Discord, Microsoft Teams)
Files changed: chat_session.py, channel_session.py, chat_sessions.py, feishu.py, wecom.py, wecom_stream.py, slack.py, discord_bot.py, teams.py, + Alembic migration
Upgrade notes: The Alembic migration (a1b2c3d4e5f6) is idempotent and adds two new columns with safe defaults. No manual action required.
This has been fixed in commit 56bef0f (PR #184): Stabilize WeCom channel state and session isolation.
Root cause: WeCom channel handler was not properly isolating conversation context per user/group, causing context bleed between different users and group chats.
Fix: Each WeCom conversation now gets a unique conv_id keyed by user open_id or group chat_id, ensuring full session isolation.