Skip to content

fix(slack): normalize typed command mentions - #316

Merged
amaudruz merged 1 commit into
sandbox-quantum:mainfrom
Pumpurri:fix/315-slack-command-mentions
Aug 29, 2026
Merged

fix(slack): normalize typed command mentions#316
amaudruz merged 1 commit into
sandbox-quantum:mainfrom
Pumpurri:fix/315-slack-command-mentions

Conversation

@Pumpurri

Copy link
Copy Markdown
Contributor

Context

Fixes #315

Slack encodes an autocomplete-selected mention as <@U123>, even though it displays the mention as @username in the client.

The Slack slash-command path normalizes this encoding with translate_inbound, but the typed !command path previously passed its arguments to the command dispatcher unchanged. As a result, commands such as !invite-agent could silently fail when their target was selected from Slack’s autocomplete popup.

Description

Normalize typed Slack !command arguments using translate_inbound before dispatching them.

This converts Slack-encoded mentions such as <@U123> into the @username format expected by the command dispatcher. The stale slash-command comment was also updated to describe the shared normalization behavior accurately.

The related adapters were checked in the same pass:

  • Discord already normalizes typed-command mentions and has regression coverage.
  • Mattermost sends mentions as literal @username, so no normalization change is required.

Steps to review

  • core/switch_core/bridges/collaboration/slack/adapter.py — confirm typed command arguments pass through translate_inbound.
  • core/tests/switch_core/bridges/collaboration/test_slack_adapter.py — regression test sends !invite-agent <@U999> and verifies the dispatcher receives @worker.
  • Confirm the slash-command path continues using the same inbound translation.

Tests:

  • just check — passed
  • just typecheck — passed
  • just test — 2011 passed, 5 deselected
  • Live Slack test — an autocomplete-selected mention in !invite-agent @username successfully added the corresponding Switch agent

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@Pumpurri

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

switch-cla-assistant Bot added a commit that referenced this pull request Aug 28, 2026

@amaudruz amaudruz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for this !

@amaudruz
amaudruz merged commit ada716d into sandbox-quantum:main Aug 29, 2026
10 of 11 checks passed
amaudruz added a commit that referenced this pull request Sep 1, 2026
Two Slack bugfixes: normalize typed command mentions (#316) and resolve
agent mentions that crossed a workspace boundary (#327).

Bumps core/pyproject.toml and artifacts.yaml (switch-core 0.21.0 -> 0.21.1),
regenerates the artifact modules, and cuts the CHANGELOG section.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typed !-commands don't normalise Slack mention encoding in arguments

2 participants