The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(slack): load channel skill bindings on slash-command turns
John Paul Solivac1c2bab74210
diff --git a/plugins/platforms/slack/adapter.py b/plugins/platforms/slack/adapter.pyindex 3cac42eadd4..208e1db1d82 100644--- a/plugins/platforms/slack/adapter.py+++ b/plugins/platforms/slack/adapter.py@@ -6082,11 +6082,14 @@ class SlackAdapter(BasePlatformAdapter):user_id=user_id,user_name=await self._resolve_user_name(user_id, chat_id=channel_id, team_id=team_id),thread_id=thread_id, scope_id=team_id or None)+ from gateway.platforms.base import resolve_channel_skillsevent = MessageEvent(text=text,message_type=(MessageType.COMMAND if text.startswith("/") else MessageType.TEXT),source=source, raw_message=command,- channel_prompt=self._channel_prompt_with_identity(channel_id, team_id))+ channel_prompt=self._channel_prompt_with_identity(channel_id, team_id),+ # Bound skills load only when a session starts; "/hermes <question>" can start one.+ auto_skill=resolve_channel_skills(self.config.extra, channel_id, None))# Stash response_url so the first reply for this channel+user goes ephemeral. COMMAND# events only: free-form "/hermes <question>" replies must stay public.response_url = command.get("response_url", "")diff --git a/tests/plugins/platforms/slack/test_slash_command_channel_prompt.py b/tests/plugins/platforms/slack/test_slash_command_channel_prompt.pyindex 9fc2c31a143..4f8a5a73dca 100644--- a/tests/plugins/platforms/slack/test_slash_command_channel_prompt.py+++ b/tests/plugins/platforms/slack/test_slash_command_channel_prompt.py@@ -1,9 +1,10 @@-"""Slack slash-command turns carry the same channel prompt and source names as messages.+"""Slack slash-command turns carry the same channel prompt, skill binding and source names as messages.A ``/hermes <question>`` turn is a human turn, so the gateway re-pins ``channel_pin`` and thesession-context key from it. Built without ``channel_prompt``, ``chat_name`` and ``user_name``,it ran without the configured channel prompt and flipped both pins, and the next ordinary-message flipped them back: two agent rebuilds and two prompt-cache misses per slash turn.+message flipped them back: two agent rebuilds and two prompt-cache misses per slash turn. Without+``auto_skill``, a session opened by ``/hermes <question>`` never loaded the channel's bound skill."""from unittest.mock import AsyncMock, MagicMock@@ -16,7 +17,9 @@ from plugins.platforms.slack.adapter import SlackAdapterdef _adapter(channel_id: str) -> SlackAdapter:a = SlackAdapter(PlatformConfig(- enabled=True, token="xoxb-fake", extra={"channel_prompts": {channel_id: "Answer in haiku."}}))+ enabled=True, token="xoxb-fake", extra={+ "channel_prompts": {channel_id: "Answer in haiku."},+ "channel_skill_bindings": [{"id": channel_id, "skill": "triage"}]}))a._app = MagicMock()a._app.client = AsyncMock()a._app.client.users_info = AsyncMock(@@ -48,6 +51,7 @@ async def test_slash_turn_matches_message_turn_prompt_and_names(channel_id, chanslash, message = (c.args[0] for c in adapter.handle_message.await_args_list)assert message.channel_prompt and "Answer in haiku." in message.channel_promptassert slash.channel_prompt == message.channel_prompt+ assert slash.auto_skill == message.auto_skill == ["triage"]assert (message.source.chat_name, message.source.user_name) == (chat_name, "Alice")assert (slash.source.chat_name, slash.source.user_name) == (message.source.chat_name, message.source.user_name)