agentscope-ai / agentscope-ai/QwenPaw

Feishu group chats (share_session_in_group) lose per-message sender in history

未關閉
#5,721 1 則留言 0 個 reaction 已指派 1 人 已被 @hongxicheng 認領 在 GitHub 檢視
主要語言
Python
星號
34.9k
分支
3.1k
平均合併
1 天 15 小時
30 天內合併 PR
225

描述

### Summary

In Feishu group chats with `share_session_in_group=True`, all members'
messages are routed into one shared session, but each user message is
persisted as only `role=user` + `content`. The real speaker is not stored
per message, so once the context grows the model can no longer tell who
said what in the history.

### Environment

- QwenPaw 2.0.0b1
- Channel: Feishu, `share_session_in_group=True` (also affects topic
threads)

### Current behavior / evidence

The Feishu channel already parses the sender (nickname, open_id,
`sender_display`) and puts it in the inbound `meta` (`user_name`,
`feishu_sender_id`). But:

- `BaseChannel.build_agent_request_from_user_content(...)` builds the
`Message` with only `type/role/content` — `Message.metadata` is never
populated, even though the schema supports it.
- `_request_input_to_msgs(...)` converts to an agentscope `Msg` keeping
only `role/content` (name is set to the role, not the sender).
- With `share_session_in_group=True`, `meta["feishu_sender_id"]` is
overwritten to `"group"` for routing — further proof the real sender
must be stored separately or it is lost.

Net effect: persisted history is `role=user` + `content` with `name="user"`
for everyone.

### Impact

Breaks any group capability that needs to distinguish historical speakers:

- "What did just say?"
- "What did A and B each ask for?"
- "Continue answering what asked earlier"
- Per-user profiles / preferences / long-term memory in group chats

### Expected

Each user message in a shared group session should persist the real
sender, and the model should be able to attribute each historical user
message to its speaker. Internal metadata must not leak into user-visible
content.

### Proposed fix

PR incoming: persist a compact, safe sender metadata subset per message,
separate routing identity from the real sender, and project the sender
into the model's view (and summarize/memory) as a ``
envelope on a throwaway copy — without persisting the envelope or adding
an outbound stripper. Feishu-scoped with a generic base hook so other
group channels can opt in.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。