Skip to content

Fix !command so @mentions resolve and code-wrapped commands run, like /command (CHOO-2342) - #313

Merged
abeldantas merged 3 commits into
sandbox-quantum:mainfrom
abeldantas:fix/bang-command-intake
Sep 4, 2026
Merged

Fix !command so @mentions resolve and code-wrapped commands run, like /command (CHOO-2342)#313
abeldantas merged 3 commits into
sandbox-quantum:mainfrom
abeldantas:fix/bang-command-intake

Conversation

@abeldantas

@abeldantas abeldantas commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

!command is parsed straight from message text. After CHOO-2277 gave each agent an autocomplete user group, that broke bang commands: a typed @agent arrived as Slack markup, and code-wrapped commands were dropped silently. In this PR we fix both, in the shared command funnel and the Slack adapter.

… /command (CHOO-2342)

!command is parsed straight from message text. After CHOO-2277 gave each agent
an autocomplete user group, that broke bang commands: a typed @agent arrived as
Slack markup, and code-wrapped commands were dropped silently. This fixes both.
@abeldantas
abeldantas requested a review from amaudruz as a code owner August 27, 2026 17:26
Copilot AI lite review requested due to automatic review settings August 27, 2026 17:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR restores parity between Slack !command and /command handling by ensuring agent @mentions are translated into plain @agent-name form for downstream dispatch, and by allowing whole-message code-wrapped bang commands to execute instead of being treated as ordinary chatter.

Changes:

  • Translate inbound !command arguments via the collaboration adapter before dispatch (matching the existing message and slash-command behavior).
  • Treat whole-message Slack code spans (`...` / ... ) as eligible command text for human senders, so code-wrapped !commands execute.
  • Add regression tests covering code-wrapped command intake and argument translation for thread mapping.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
core/switch_core/bridges/collaboration/bridge_core.py Translates inbound command args via the adapter before sending the command event into Matrix.
core/switch_core/bridges/collaboration/slack/adapter.py Unwraps whole-message code spans for human senders before bang-command detection.
core/tests/switch_core/bridges/collaboration/test_slack_adapter.py Adds tests verifying code-wrapped !commands run (and do not double-bridge as messages) plus unwrap edge cases.
core/tests/switch_core/bridges/collaboration/test_command_thread_mapping.py Extends test scaffolding and adds a regression test ensuring command args are translated via the adapter.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread core/switch_core/bridges/collaboration/slack/adapter.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@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.

Image

When commands have to be stripped the result comes in the root of the conv, while it should come in the thread of the command message

@abeldantas

Copy link
Copy Markdown
Collaborator Author
SCR-20260828-tagn

@abeldantas
abeldantas requested a review from amaudruz August 28, 2026 21:00
@abeldantas
abeldantas merged commit 5594010 into sandbox-quantum:main Sep 4, 2026
10 checks passed
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.

3 participants