From 1f216de3a8668a2f248acce267322cecf75de089 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 14 Jul 2026 12:02:35 -0700 Subject: [PATCH] fix(slack): gate feedback buttons behind rich_blocks as documented MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docs state feedback_buttons requires rich_blocks: true, but _maybe_blocks rendered full Block Kit whenever feedback_buttons alone was enabled — implicitly turning on rich-block rendering the user never opted into. Align the code with the documented contract and add a regression test. --- plugins/platforms/slack/adapter.py | 2 +- tests/gateway/test_slack_block_kit_adapter.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/platforms/slack/adapter.py b/plugins/platforms/slack/adapter.py index 42ff90bbe6ce..0be1afbbc362 100644 --- a/plugins/platforms/slack/adapter.py +++ b/plugins/platforms/slack/adapter.py @@ -2040,7 +2040,7 @@ class SlackAdapter(BasePlatformAdapter): falls back to the plain ``text`` payload. A ``text`` fallback is ALWAYS sent alongside blocks, so this can safely return ``None`` at any time. """ - if not self._rich_blocks_enabled() and not self._feedback_buttons_enabled(): + if not self._rich_blocks_enabled(): return None try: blocks = render_blocks(content, mrkdwn_fn=self.format_message) diff --git a/tests/gateway/test_slack_block_kit_adapter.py b/tests/gateway/test_slack_block_kit_adapter.py index 0b88a0fafa70..13ab58c52991 100644 --- a/tests/gateway/test_slack_block_kit_adapter.py +++ b/tests/gateway/test_slack_block_kit_adapter.py @@ -79,7 +79,7 @@ class TestSendMessageBlocks: @pytest.mark.asyncio async def test_feedback_buttons_opt_in_appended_to_blocks(self): - adapter, client = _make_adapter({"feedback_buttons": True}) + adapter, client = _make_adapter({"rich_blocks": True, "feedback_buttons": True}) await adapter.send("C1", "final answer") @@ -89,6 +89,15 @@ class TestSendMessageBlocks: assert feedback["elements"][0]["type"] == "feedback_buttons" assert feedback["elements"][0]["action_id"] == "hermes_feedback" + @pytest.mark.asyncio + async def test_feedback_buttons_require_rich_blocks(self): + """feedback_buttons alone must not implicitly enable Block Kit rendering.""" + adapter, client = _make_adapter({"feedback_buttons": True}) + + await adapter.send("C1", "final answer") + + assert "blocks" not in client.chat_postMessage.await_args.kwargs + class TestEditMessageBlocks: @pytest.mark.asyncio