Add Slack blocks support to post_message - #6676
Open
suhaibmujahid wants to merge 2 commits into
Open
Conversation
suhaibmujahid
force-pushed
the
slack-blocks
branch
from
August 20, 2026 01:58
4bbc0c7 to
8bec66f
Compare
Extend Slack message actions to accept optional `blocks` payloads.
suhaibmujahid
force-pushed
the
slack-blocks
branch
from
August 20, 2026 03:10
8bec66f to
b3a51d4
Compare
There was a problem hiding this comment.
Pull request overview
Extends Hackbot’s Slack action plumbing to support Slack Block Kit payloads on recorded slack.post_message actions, enabling richer message layouts while keeping text as a fallback.
Changes:
- Add
blocksrecording support on the Slack action recording side (tests included). - Pass recorded
blocksthrough tochat.postMessagein the apply-side Slack handler. - Add apply-side test coverage for posting recorded
blockswhile keepingtextas a fallback.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| libs/hackbot-runtime/tests/test_slack_handler.py | Adds an apply-side test asserting blocks are posted and text remains as fallback. |
| libs/hackbot-runtime/tests/test_slack_actions.py | Adds recording-side tests for blocks behavior and validation around text/blocks. |
| libs/hackbot-runtime/hackbot_runtime/actions/slack.py | Updates parameter shaping to optionally include blocks and adds blocks support to record_message. |
| libs/hackbot-runtime/hackbot_runtime/actions/handlers/slack_handler.py | Threads optional blocks into the Slack SDK chat_postMessage call. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+27
to
+40
| def _params( | ||
| channel: str, text: str | None, blocks: list[dict] | None = None | ||
| ) -> dict[str, str | list[dict]]: | ||
| if not channel: | ||
| raise ToolError("channel must not be blank") | ||
| if not text: | ||
| raise ToolError("text must not be blank") | ||
| return {"channel": channel, "text": text} | ||
| if not text and not blocks: | ||
| raise ToolError("either 'text' or 'blocks' must be provided") | ||
|
|
||
| params: dict[str, str | list[dict]] = {"channel": channel, "text": text} | ||
|
|
||
| if blocks: | ||
| params["blocks"] = blocks | ||
|
|
||
| return params |
Comment on lines
77
to
82
| def record_message( | ||
| recorder: ActionsRecorder, | ||
| channel: str, | ||
| text: str, | ||
| blocks: list[dict] | None = None, | ||
| *, |
Comment on lines
58
to
63
| response = _client().chat_postMessage( | ||
| channel=channel, | ||
| text=params["text"], | ||
| blocks=params.get("blocks"), | ||
| metadata=metadata, | ||
| ) |
Comment on lines
87
to
+90
| For a run whose outcome is always worth reporting: the wording is code, not | ||
| a model turn, and the message is recorded once the result exists. | ||
| """ | ||
| return recorder.record(ACTION_TYPE, _params(channel, text), ref=ref) | ||
| return recorder.record(ACTION_TYPE, _params(channel, text, blocks), ref=ref) |
evgenyrp
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #6669
Extend Slack message actions to accept optional
blockspayloads.Stack created with GitHub Stacks CLI • Give Feedback 💬