Skip to content

fix(slack): keep slash commands in their Slack conversation scope - #10875

Closed
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix/slack-command-session-scope
Closed

fix(slack): keep slash commands in their Slack conversation scope#10875
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix/slack-command-session-scope

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

Summary

  • route Slack slash commands with the same channel/thread semantics as normal Slack messages
  • stop forcing every slash command into a synthetic DM session
  • preserve thread context from Slack slash payloads so session-scoped commands target the active thread when present

Why

Issue #10688 reports that /model in Slack can appear to switch successfully but later turns still use the old provider/model. One concrete failure mode is session drift: the slash command writes its override into a DM-shaped session key while subsequent Slack replies resolve under the real channel or thread session.

This change fixes that mismatch by making slash commands build the same session source shape that normal Slack messages already use.

Scope

This PR intentionally addresses the Slack session-scope part of #10688. It does not claim to fix the dashboard provider-field UX.

Addresses #10688

Tests

  • python3 -m pytest -o addopts= tests/gateway/test_slack.py -k "SlashCommands or group_session_scope or dm_session_scope or preserves_thread_context"
  • python3 -m pytest -o addopts= tests/gateway/test_session_model_override_routing.py tests/gateway/test_model_switch_persistence.py
  • python3 -m pytest -o addopts= tests/gateway/test_session.py -k "distinct_dm_chat_ids_get_distinct_session_keys or group_sessions_are_isolated_per_user_when_user_id_present or group_thread_sessions_are_shared_by_default"

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

The core fix (slash command from to for shared channels) was merged via #18553 using PR #9361's approach. Your PR added additional extraction from which changes session-key semantics more aggressively — that's better as a separate follow-up if needed. Thanks for the contribution!

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

The core fix (slash command chat_type from DM to group for shared channels) was merged via #18553 using PR #9361's approach. Your PR added additional thread_ts extraction which changes session-key semantics more aggressively — better as a separate follow-up if needed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/slack Slack app adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants