-
-
Notifications
You must be signed in to change notification settings - Fork 80.3k
Discord/Telegram/Slack slash commands ignore session.dmScope routing #39605
Copy link
Copy link
Closed
BingqingLyu/openclaw
#129Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
No fields configured for issues without a type.
Bug Description
Native slash commands (
/status,/ask, etc.) in Discord, Telegram, and Slack DMs route toagent:main:maininstead of respectingsession.dmScope(e.g.per-channel-peer). Normal text messages in the same DM correctly route toagent:main:discord:direct:<userId>.Reproduction
session.dmScope = per-channel-peerin configagent:main:discord:direct:1324002460267974737)/statusin the same DM → session showsagent:main:mainRoot Cause
All three channel providers (Discord, Telegram, Slack) load config once at provider startup (
loadConfig()) and capture it in a closure. Normal message handlers callloadConfig()fresh per message, but the slash/native-command routing path reuses the stale startup config snapshot.Since
resolveAgentRoutereadscfg.session.dmScopeto compute the session key, the slash command path always uses the config state from startup time, which may not reflect the currentdmScopesetting.Affected code paths:
src/discord/monitor/native-command.ts–dispatchDiscordCommandInteractionuses closure-capturedcfgsrc/telegram/bot-native-commands.ts–resolveCommandRuntimeContextuses closure-capturedcfgsrc/slack/monitor/slash.ts–handleSlashCommandusesctx.cfgfrom startupWorking code path (for comparison):
src/discord/monitor/message-handler.preflight.ts– callsloadConfig()fresh per messageImpact
dmScope = per-channel-peer(orper-peer,per-account-channel-peer) see slash commands operating on the wrong session/statusshows stale or unrelated session info in DMs