fix(slack): gate feedback buttons behind rich_blocks as documented

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.
This commit is contained in:
Teknium 2026-07-14 12:02:35 -07:00
parent fc8f8ad33f
commit 1f216de3a8
2 changed files with 11 additions and 2 deletions

View file

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

View file

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