fix(telegram): hidden text-link URLs reach the agent inline (#31071, salvage #74769) - #93346
Conversation
૮ >ﻌ< ა ci reviewran on 3f6c3ba — refactor(telegram): move text_link expansion to telegram_ent
|
Well-executed fix with unusually complete tests — the UTF-16 offset conversion (
|
…ling The adapter facade is ~6.6k lines; new behaviour belongs in a topical sibling per the facade+siblings layout. expand_link_entities() now lives in telegram_entities.py and reuses the encode/decode UTF-16 slicing the adapter already uses for entity spans. Also: skip inlining when the anchor text already is the URL (no 'url (url)' duplication), trim the test file to the invariants and point it at the sibling.
8bfd26e to
3f6c3ba
Compare
Summary
Telegram messages with hidden hyperlinks ("click here" with a
text_linkentity) now reach the agent with the URL inlined — previously the agent saw only the anchor text and could not follow or fetch the link (#31071).Salvage of #74769 by @DreamyMoonMouse onto current main (clean cherry-pick, authorship preserved). Ported here from the weekly NanoClaw scout (nanocoai/nanoclaw#3283 fixes the same platform gap); an open community PR already covered it, so it is salvaged instead of reimplemented.
Changes
plugins/platforms/telegram/adapter.py: new_expand_link_entities()— converts UTF-16 entity offsets to code-point indices (emoji/CJK-safe), appends(url)after eachtext_linkanchor, idempotent on re-processing; wired into_build_message_event()(all text paths) plus both media-caption paths.tests/gateway/test_telegram_text_link_expansion.py: 13 tests — plain text, captions, emoji offsets, malformed entities, repeat processing.Why this PR over #31075
#31075 (earlier, by @dskwe) targets
gateway/platforms/telegram.py, which no longer exists after the adapter moved toplugins/platforms/telegram/; it also only covers 2 of the 3 ingestion paths. This branch cherry-picks #74769, which targets the current location and covers_build_message_eventcentrally. @dskwe was first to the bug — credit noted here.Validation
text_linkin DM textSource scout reference: nanocoai/nanoclaw#3283.
Infographic