You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a Matrix group chat with multiple users, when User A sends a message containing a first-person pronoun ("me", "I"), the agent incorrectly resolves it to User B — the previous message sender in the same shared session.
To reproduce
Configure Matrix channel with groupPolicy: "allowlist" and requireMention: true
In a Matrix group room, Zhang sends: @bot review my recent code commits
Bot correctly looks up Zhang's commits (session displayName is now set to Zhang)
Bu sends: @bot show me my recent code commits
Expected: Bot looks up Bu's commits
Actual: Bot looks up Zhang's commits again
Root cause
Group chat sessions use a single shared key: agent:<agentId>:matrix:group:<roomId>. All users in the room share the same session context.
The Matrix plugin correctly includes sender identity in the message envelope (e.g., "Matrix message from Bu: ..."), but the session's displayName field gets overwritten by the last sender. The LLM then resolves first-person pronouns using the accumulated session context dominated by the previous user's conversation, rather than the current message's from field.
Issue #4683 (fixed in PR #4697) addressed displayName overwrite on outbound sends (when the bot uses the message tool). This bug is about inbound group messages where different senders contaminate the shared session's identity context.
Describe the bug
In a Matrix group chat with multiple users, when User A sends a message containing a first-person pronoun ("me", "I"), the agent incorrectly resolves it to User B — the previous message sender in the same shared session.
To reproduce
groupPolicy: "allowlist"andrequireMention: true@bot review my recent code commitsdisplayNameis now set to Zhang)@bot show me my recent code commitsRoot cause
Group chat sessions use a single shared key:
agent:<agentId>:matrix:group:<roomId>. All users in the room share the same session context.The Matrix plugin correctly includes sender identity in the message envelope (e.g.,
"Matrix message from Bu: ..."), but the session'sdisplayNamefield gets overwritten by the last sender. The LLM then resolves first-person pronouns using the accumulated session context dominated by the previous user's conversation, rather than the current message'sfromfield.Difference from #4683
Issue #4683 (fixed in PR #4697) addressed
displayNameoverwrite on outbound sends (when the bot uses themessagetool). This bug is about inbound group messages where different senders contaminate the shared session's identity context.Related issues
groupScopeconfig analogous todmScope(OPEN)Suggested fix
One or more of:
groupScope: "per-sender"as requested in Feature: groupScope option to consolidate group sessions into main #7524)displayNameto the current inbound message sender rather than persisting from the previous messagefromfield of each message for identity resolutionEnvironment
groupPolicy: "allowlist",requireMention: truedmScopeor custom session settings)Logs / screenshots
Session messages showing the contamination:
The
fromfield correctly identifies each sender, but the LLM resolves "me" to the wrong user due to session context contamination.