fix(slack): preserve per-user slash-command session isolation

This commit is contained in:
hinotoi-agent
2026-04-14 11:38:58 +08:00
committed by kshitij
parent 5cdc39e29a
commit a147164d3c
2 changed files with 46 additions and 1 deletions

View File

@@ -2695,9 +2695,14 @@ class SlackAdapter(BasePlatformAdapter):
# gateway command dispatcher by prepending the slash.
text = f"/{slash_name} {text}".strip()
# Slack slash commands can originate from DMs or shared channels.
# Preserve DM semantics only for DM channel IDs; shared channels must
# keep group semantics so different users do not collide into one
# session key.
is_dm = str(channel_id).startswith("D")
source = self.build_source(
chat_id=channel_id,
chat_type="dm", # Slash commands are always in DM-like context
chat_type="dm" if is_dm else "group",
user_id=user_id,
)