Skip to content

[Bug]: Telegram rich tables are rewritten into bullets by the shared formatter #45323

Closed

Description

@abner-augusto

Bug Description

Telegram rich-message delivery was still running pipe tables through the shared formatter, which rewrote them into bullet groups before final send.

That means:

  • rich Telegram replies could lose native table rendering
  • the standalone send_message proxy path could also flatten tables unless the formatter was explicitly told not to rewrite them

Steps to Reproduce

  1. Enable Telegram rich messages in the gateway.
  2. Send a message containing a Markdown table (| / ---).
  3. Observe the gateway logs and the final Telegram message.

Expected Behavior

Rich Telegram sends should preserve raw table markdown so Bot API rich rendering can display it natively.

Standalone send_message should preserve MarkdownV2 escaping, but must not flatten pipe tables into bullets.

Actual Behavior

The shared formatter rewrites pipe tables into bullet groups before delivery.

Relevant log signatures:

Markdown table detected; rewriting to bullet groups (rows=N caller=format_message:...)
Markdown table rewrite completed

Affected Component

  • Gateway (Telegram)
  • Tools (send_message proxy path)

Messaging Platform

  • Telegram

Debug Report

hermes debug share --local --lines 80

Relevant excerpt:

version:          0.16.0 (2026.6.5) [fca84fe2]
os:               Linux 6.12.86+deb13-amd64 x86_64
python:           3.11.15
profile:          default
hermes_home:      ~/.hermes
model:            gpt-5.4-mini
provider:         openai-codex
terminal:         local

features:
  gateway:            running (systemd (user), pid 1225772)
  platforms:          telegram, whatsapp

Proposed Fix

  • Make TelegramAdapter.format_message() accept an explicit rewrite_tables flag.
  • Default it to legacy behavior only when rich messages are disabled.
  • Call it with rewrite_tables=False for rich Telegram sends.
  • Call it with rewrite_tables=False in tools/send_message_tool.py.
  • Keep table rewriting only on the legacy MarkdownV2 path.
  • Add regression tests for both rich gateway sends and standalone send_message.

Notes

I also reproduced the failure mode in the gateway logs while checking the issue:

  • sendRichMessage attempt ... has_table=True
  • sendRichMessage success ...
  • and the table rewrite log should not appear on the rich path

If the rewrite log appears on a rich-enabled send, the wrong code path is still active.

Activity

  1. abner-augusto commented on Jun 13, 2026

    @abner-augusto
    Author

    Adding a fuller debug-share snapshot here for the issue thread.

    Command:

    hermes debug share --local --lines 120

    Relevant excerpt:

    version:          0.16.0 (2026.6.5) [fca84fe2]
    os:               Linux 6.12.86+deb13-amd64 x86_64
    python:           3.11.15
    openai_sdk:       2.24.0
    profile:          default
    hermes_home:      ~/.hermes
    model:            gpt-5.4-mini
    provider:         openai-codex
    terminal:         local
    
    features:
      toolsets:           hermes-cli
      mcp_servers:        0
      memory_provider:    openviking
      gateway:            running (systemd (user), pid 1225772)
      platforms:          telegram, whatsapp
      cron_jobs:          4 active / 4 total
      skills:             222
    
    config_overrides:
      display.streaming: True
      fallback_providers: [{'provider': 'deepseek', 'model': 'deepseek-v4-flash'}, {'provider': 'openrouter', 'model': 'deepseek/deepseek-v4-flash'}]
    

    The full local command also captured the gateway logs around the rich-message path and the earlier permission failure when I tried to create the issue with labels. The issue itself is already open, so this is just the debug-share context for maintainers.

  2. added
    type/bugSomething isn't working
    P2Medium — degraded but workaround exists
    comp/gatewayGateway runner, session dispatch, delivery
    comp/toolsTool registry, model_tools, toolsets
    on Jun 13, 2026
  3. liuhao1024 commented on Jun 13, 2026

    @liuhao1024

    This is fixed by #45327 — fix(telegram): preserve pipe tables on rich-message and standalone send paths.

  4. abner-augusto commented on Jun 22, 2026

    @abner-augusto
    Author

    Already fixed upstream by #45327 (preserve pipe tables on rich-message and standalone send paths). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliverycomp/toolsTool registry, model_tools, toolsetsplatform/telegramTelegram bot adaptertype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions