fix:Slack DM delivery mirrors can split sessions by routing bare D... IM channel IDs as channel sessions#80111
fix:Slack DM delivery mirrors can split sessions by routing bare D... IM channel IDs as channel sessions#80111bek91 wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. source-reproducible. Current main routes bare Slack Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the Slack-owned canonicalization fix after maintainer review and redacted real setup proof, then let it close #80091; any legacy session merge or doctor repair can be handled separately. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible. Current main routes bare Slack Is this the best way to solve the issue? Yes, directionally. The narrow maintainable fix belongs in the Slack plugin’s outbound route resolver and conversation-info helper, and this patch preserves channel/MPIM behavior while avoiding new What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 739479254661. |
|
Landed a corrected maintainer version in 50c77f2. What changed from the PR branch:
Also landed 4143c8b as a follow-up to #75356 after full Slack tests caught that the new mention parser was too strict for existing loose internal mention tokens. Validation:
I could not add fresh live Slack proof here because this environment has no Slack creds in env. The code path was checked against the installed Slack SDK types and the linked issue already includes live workspace API evidence for Thanks @bek91. The landed commit preserves your contributor credit via |
Summary
Fixes Slack outbound delivery-mirror session reconstruction for native Slack IM channel IDs (
D...). Amessage.sendcall can legitimately target Slack’s concrete DM channel, but OpenClaw session routing should treat that same conversation as a direct Slack user session keyed by the peerU...user ID.This PR updates the Slack outbound route resolver so
D...andchannel:D...targets resolve through Slack conversation metadata and only create a mirror route when Slack confirmschannel.is_impluschannel.user. In that case the mirror session is canonicalized toslack:direct:<u...>, matching inbound Slack DM routing. If the lookup fails or Slack does not return the peer user, the mirror route is skipped instead of writing a known-wrongslack:channel:<d...>session key.Fixes #80091.
Root Cause
Inbound Slack DM routing already treats D-prefixed Slack channels as IMs and keys the route by the message sender user ID. The outbound delivery-mirror path did not do the same. It parsed bare outbound targets with
defaultKind: "channel", only reclassifiedG...IDs, and therefore allowed a Slack IM channel ID such asD0AEWSDHAQHto produce a session key like:Later inbound messages in the same visible Slack DM thread route to the canonical direct user session, for example:
That split loses prior thread context even though the Slack UI shows one DM thread.
What Changed
resolveSlackChannelType()contract as a compatibility wrapper.D...andchannel:D...targets todirect:U...when Slack confirms the mapping.channel:D...can still be used as the concrete Slack delivery target; only mirror/session reconstruction changes.C...andG...targets.User Impact
After this change, sending into a Slack DM thread through
message.sendwith a nativeD...target no longer creates a separate channel-scoped OpenClaw session. Outbound delivery mirrors and later inbound DM turns resolve to the same direct user session whenever Slack exposes the peer user mapping.Existing bad
agent:*:slack:channel:d...sessions are not migrated in this PR. This PR prevents new bad mirror sessions from being created.Real Behavior Proof
Pending live after-fix proof from a real Slack-connected OpenClaw setup.
Planned proof:
D...) and real thread timestamp from a Slack DM where OpenClaw is configured.to the post-fix direct user session:
Unit tests, typechecks, and CI below are supplemental only and do not replace this live proof.
Validation
git diff --checkpnpm test extensions/slack/src/channel.test.ts extensions/slack/src/channel-type.test.tspnpm test:extension slackpnpm tsgo:extensionspnpm exec oxfmt --check --threads=1 extensions/slack/src/channel.ts extensions/slack/src/channel-type.ts extensions/slack/src/channel.test.ts extensions/slack/src/channel-type.test.ts CHANGELOG.mdcodex review --base origin/maincodex reviewresult: no discrete correctness issues found.AI Assistance
Implemented with Codex. I understand the submitted change and verified the behavior at the code and targeted validation level; live real-behavior proof is pending as noted above.