Skip to content

feat(slack): convert markdown tables to Block Kit table blocks - #48737

Closed
whatfontisthis wants to merge 1 commit into
NousResearch:mainfrom
whatfontisthis:feat/slack-table-block-kit
Closed

feat(slack): convert markdown tables to Block Kit table blocks#48737
whatfontisthis wants to merge 1 commit into
NousResearch:mainfrom
whatfontisthis:feat/slack-table-block-kit

Conversation

@whatfontisthis

@whatfontisthis whatfontisthis commented Jun 19, 2026

Copy link
Copy Markdown

Summary

When Hermes outputs markdown tables in a Slack response, the Slack adapter now converts them into Slack's supported Block Kit table blocks. Prose around tables is rendered as visible section blocks, preserving message order such as text -> table -> text and multiple tables in one response.

This replaces the earlier rich_text_table approach, which Slack rejected in live testing with invalid_blocks.

How it works

  1. _parse_markdown_tables() extracts pipe-delimited markdown tables and returns ordered text/table segments.
  2. _markdown_table_message_blocks() converts ordered segments into visible Slack blocks:
    • prose -> section + mrkdwn
    • table -> top-level table block
  3. _tables_to_blocks() builds Slack table rows with raw_text cells, respecting Slack's table limits.
  4. send() attaches blocks to chat_postMessage and falls back to plain markdown text if Slack rejects the table payload.

Behavior

  • Markdown tables render as native Slack table blocks.
  • Text before, between, and after tables remains visible and ordered.
  • Multiple tables in one message are supported.
  • If Slack returns invalid_blocks, Hermes retries as plain markdown text.
  • Messages without tables are sent as before.

Tests

  • ./venv/bin/python -m pytest tests/gateway/test_slack.py -k 'SendMarkdownTables' -q
  • ./venv/bin/python -m py_compile gateway/platforms/slack.py

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Jun 19, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Converts markdown tables in Slack messages to Block Kit rich_text_table blocks. Clean 1-file feature addition with proper fallback to plaintext for non-table content. Well-scoped.


Reviewed by Hermes Agent

@whatfontisthis
whatfontisthis force-pushed the feat/slack-table-block-kit branch from 50c66b8 to 34f5d02 Compare June 19, 2026 03:52
@whatfontisthis whatfontisthis changed the title feat(slack): convert markdown tables to Block Kit rich_text_table blocks feat(slack): convert markdown tables to Block Kit table blocks Jun 19, 2026
@teknium1

teknium1 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Superseded by #56102 (#56102), a broader opt-in Slack Block Kit renderer that includes native table blocks (per-column alignment, inline-formatted cells, monospace fallback over Slack's limits) and closes #18918. This was one of several independent fixes for the same area — thanks for contributing it.

@teknium1 teknium1 closed this Jul 1, 2026
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 P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants