fix(slack): route system events to bound agent sessions#34045
fix(slack): route system events to bound agent sessions#34045vincentkoc merged 11 commits intomainfrom
Conversation
Greptile SummaryThis PR fixes a bug where Slack inbound system events (reactions, member joins/leaves, pins, interactions, modals) were not routed through binding-aware agent session resolution, causing events to land in The fix threads Key changes:
Confidence Score: 5/5
Last reviewed commit: d8a7d9c |
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 Slack DM system events can be misrouted by using message author/bot_id as senderId for session routing
Description
For several system-event sources,
As a result, DM system events can be routed to a session bound to the bot ID (or to an account/default binding) instead of the intended per-user DM session. In deployments using per-peer bindings to isolate agents (e.g., VIP/customer-specific agents), this can cause cross-session information disclosure (DM activity metadata appearing in the wrong agent/session) and session confusion. Vulnerable routing logic: const peerId = isDirectMessage ? senderId : channelId;
...
return route.sessionKey;Example of non-peer return changed.message?.bot_id ?? changed.previous_message?.bot_id;RecommendationFor DMs, resolve the actual DM peer user ID from the Suggested approach:
// when conversations.info() returns an IM
const dmUser = (channel as any).user as string | undefined;
const channelType = normalizeSlackChannelType(p.channelType, channelId);
if (channelType === "im") {
const info = await resolveChannelInfo(channelId); // includes dmUser
const dmPeerId = info.userId;
const peerId = dmPeerId ?? undefined; // fallback handled below
if (peerId) {
return resolveAgentRoute({
cfg: params.cfg,
channel: "slack",
accountId: params.accountId,
teamId: params.teamId,
peer: { kind: "direct", id: peerId },
}).sessionKey;
}
}
Analyzed PR: #34045 at commit Last updated on: 2026-03-04T14:09:48Z |
* main: Compaction/Safeguard: require structured summary headings (openclaw#25555) Fix gateway restart false timeouts on Debian/systemd (openclaw#34874) fix(review): enforce behavioral sweep validation chore(changelog): clarify outbound media-only fallback openclaw#32788 thanks @liuxiaopai-ai fix(outbound): fail media-only text-only adapter fallback chore(changelog): align outbound adapter entry openclaw#32788 thanks @liuxiaopai-ai Outbound: avoid empty multi-media fallback sends Outbound: allow text-only plugin adapters chore(changelog): add PR entry openclaw#24337 thanks @echoVic test(ollama): add default header precedence coverage fix(ollama): pass provider headers to Ollama stream function (openclaw#24285) Agents: add generic poll-vote action support fix(node-host): sync rawCommand with hardened argv after executable path pinning (openclaw#33137) fix(daemon): handle systemctl is-enabled exit 4 (not-found) on Ubuntu (openclaw#33634) fix(model): propagate custom provider headers to model objects (openclaw#27490) fix(memory): serialize local embedding initialization to avoid duplicate model loads (openclaw#15639) Delete changelog/fragments directory fix(slack): route system events to bound agent sessions (openclaw#34045)
Summary
Describe the problem and fix in 2–5 bullets:
reaction_added) resolved session keys without channel/account binding-aware agent routing.agent:maininstead of the bound agent session, making reaction notifications appear silently missing.resolveSlackSystemEventSessionKeynow routes viaresolveAgentRoute(sender-aware for DMs), and callers now forwardsenderIdfor reaction/member/pin/interaction/modal event paths.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
agent:main.Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
mainagents.Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
pnpm vitest run --config vitest.unit.config.ts src/slack/monitor/events/reactions.test.ts src/slack/monitor/events/interactions.test.ts src/slack/monitor/monitor.test.tspnpm tsgopnpm checkCompatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
src/slack/monitor/context.tssrc/slack/monitor/events/system-event-context.tssrc/slack/monitor/events/interactions.tssrc/slack/monitor/events/interactions.modal.tsRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.resolveSlackSystemEventSessionKeywhen routing context is incomplete.