Skip to content

fix(telegram): guard rich details math crash - #46102

Merged
teknium1 merged 1 commit into
mainfrom
fix/telegram-rich-details-math-guard
Jun 14, 2026
Merged

fix(telegram): guard rich details math crash#46102
teknium1 merged 1 commit into
mainfrom
fix/telegram-rich-details-math-guard

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Telegram rich messages now fall back to MarkdownV2 for the specific details+math payload shape that can crash Telegram Desktop 6.9.1.

Changes

  • gateway/platforms/telegram.py: detect <details>...</details> blocks containing LaTeX-style math and skip sendRichMessage / sendRichMessageDraft for that content.
  • tests/gateway/test_telegram_rich_messages.py: cover dangerous details+math send/draft fallback while preserving rich delivery for details without math and math outside details.

Validation

Check Result
python3 -m py_compile gateway/platforms/telegram.py tests/gateway/test_telegram_rich_messages.py pass
scripts/run_tests.sh tests/gateway/test_telegram_rich_messages.py 42 passed

Infographic

Hermes rich-message safety guard

@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: fix/telegram-rich-details-math-guard vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10906 on HEAD, 10904 on base (🆕 +2)

🆕 New issues (2):

Rule Count
unresolved-attribute 2
First entries
run_agent.py:2920: [unresolved-attribute] unresolved-attribute: Object of type `Self@get_credits_spent_micros` has no attribute `_credits_session_start_micros`
tests/run_agent/test_credits_notices_toggle.py:76: [unresolved-attribute] unresolved-attribute: Unresolved attribute `_credits_session_start_micros` on type `AIAgent`

✅ Fixed issues (1):

Rule Count
invalid-assignment 1
First entries
tests/run_agent/test_credits_notices_toggle.py:76: [invalid-assignment] invalid-assignment: Object of type `None` is not assignable to attribute `_credits_session_start_micros` of type `int`

Unchanged: 5735 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@teknium1
teknium1 merged commit 9459057 into main Jun 14, 2026
28 checks passed
@teknium1
teknium1 deleted the fix/telegram-rich-details-math-guard branch June 14, 2026 11:22
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter P2 Medium — degraded but workaround exists labels Jun 14, 2026
AIalliAI pushed a commit to AIalliAI/Hermes that referenced this pull request Jun 14, 2026
fatalacris pushed a commit to fatalacris/hermes-agent that referenced this pull request Jun 16, 2026
T02200059 pushed a commit to T02200059/hermes-agent that referenced this pull request Jun 18, 2026
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
Methodician added a commit to Methodician/hermes-agent that referenced this pull request Jul 4, 2026
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 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 P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants