Clawith icon indicating copy to clipboard operation
Clawith copied to clipboard

连接微信后,每次发消息都会创建一个用户

Open zhlqe opened this issue 7 months ago • 2 comments

Pre-checks

Deployment Method

Docker

Steps to Reproduce

Image

Expected vs Actual Behavior

不创建用户

Logs / Screenshots

No response

zhlqe avatar Apr 28 '26 09:04 zhlqe

服务器部署版 (NODEjs+PGZSQL+RANDIS)也有这样的问题

xieqingyu-china avatar May 14 '26 10:05 xieqingyu-china

Reviewed against the current codebase, this issue now appears resolved.

Current code evidence:

  • backend/app/services/wechat_channel.py:211-221 resolves incoming WeChat senders through channel_user_service.resolve_channel_user(...) using the stable from_user_id as external_user_id.
  • backend/app/services/channel_user_service.py:263-265 and 311-316 explicitly treat WeChat identity lookup by external_id (from_user_id).
  • backend/app/services/channel_user_service.py:318-334 now avoids duplicate-match failures by selecting a single canonical OrgMember row instead of raising on duplicates.
  • There are also dedicated tests for this WeChat path in backend/tests/test_identity_id_mapping.py:162-212, covering existing-member lookup and lazy-registration shell creation using the WeChat external ID.

That means repeated messages from the same WeChat sender now resolve back to the same channel identity instead of creating a fresh platform user every time.

yaojin3616 avatar Jun 10 '26 13:06 yaojin3616