Skip to content

fix(telegram): expose hidden text-link URLs - #74769

Open
DreamyMoonMouse wants to merge 1 commit into
NousResearch:mainfrom
DreamyMoonMouse:fix/telegram-text-link-entities
Open

fix(telegram): expose hidden text-link URLs#74769
DreamyMoonMouse wants to merge 1 commit into
NousResearch:mainfrom
DreamyMoonMouse:fix/telegram-text-link-entities

Conversation

@DreamyMoonMouse

Copy link
Copy Markdown

Summary

  • expand inbound Telegram text_link entities so the model receives their hidden URLs
  • preserve Telegram UTF-16 entity offsets for emoji/non-BMP text
  • handle text and media captions while safely ignoring malformed entities
  • add regression coverage for captions, multiple links, UTF-16 boundaries, and idempotence

Tests

  • scripts/run_tests.sh tests/gateway/test_telegram_text_link_expansion.py tests/gateway/test_telegram_documents.py tests/gateway/test_telegram_group_gating.py tests/gateway/test_telegram_reply_quote.py tests/gateway/test_telegram_rich_messages.py (80 passed)
  • python -m py_compile plugins/platforms/telegram/adapter.py tests/gateway/test_telegram_text_link_expansion.py
  • git diff --check

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins platform/telegram Telegram bot adapter P3 Low — cosmetic, nice to have labels Jul 30, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #31075 and #31071, not a duplicate. This patches the current plugins/platforms/telegram/adapter.py, uses inline URLs, and adds event-path, idempotence, and surrogate-boundary guards; #31075 patches the older gateway path and emits Markdown links.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for porting this to the current bundled Telegram adapter. The reported gap is present on current main: plugins/platforms/telegram/adapter.py:9668 creates inbound events from visible message.text alone, while media paths reset captions from raw text at plugins/platforms/telegram/adapter.py:8952 and :8967.

The PR addresses the current ingress layer: _expand_link_entities handles text_link URLs and UTF-16 offsets (plugins/platforms/telegram/adapter.py:8183-8239 in fa3a0ed74744), the shared builder uses it (:9726), and both caption overrides use it (:9010, :9025). The builder is used by normal text, commands, observed messages, and media on main (plugins/platforms/telegram/adapter.py:8494, :8690, :8712, :8950, :8963). No core tool, configuration, or environment-variable surface is added.

Automated hermes-sweeper review.

@teknium1

Copy link
Copy Markdown
Contributor

Salvaged onto current main in #93346 (clean cherry-pick — your commit and authorship preserved), since this branch predates the adapter's move to plugins/platforms/telegram/. Thanks @DreamyMoonMouse! Leaving both open for maintainer review.

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

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/telegram Telegram bot adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants