fix(telegram): fix broken URL parsing for Markdown messages#7387
Closed
dsocolobsky wants to merge 2 commits into
Closed
fix(telegram): fix broken URL parsing for Markdown messages#7387dsocolobsky wants to merge 2 commits into
dsocolobsky wants to merge 2 commits into
Conversation
…ersion The link regex in format_message used [^)]+ for the URL portion, which stopped at the first ) character. URLs with nested parentheses (e.g. Wikipedia links like Python_(programming_language)) were improperly parsed. Use a better regex, which is the same the Slack adapter uses.
✅ Review Complete - LGTMTested in isolation - all tests passing Test Results
Detailed AnalysisURL parentheses fix ✅
Test coverage ✅
Integration ✅
RecommendationMerge immediately. This fix:
No additional changes needed. Ready for merge. Reviewer: @teknium1 |
teknium1
added a commit
that referenced
this pull request
Apr 20, 2026
Contributor
|
Merged via PR #13187 (#13187). Your commit was cherry-picked onto current main with your authorship preserved in git log. Thanks @dsocolobsky! |
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
aj-nt
pushed a commit
to aj-nt/hermes-agent
that referenced
this pull request
May 1, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
Luminet2023
pushed a commit
to Luminet2023/hermes-agent
that referenced
this pull request
May 1, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…ousResearch#9091, NousResearch#13131 - Fix duplicate 'timezone' import in e2e conftest - Fix test_text_before_command_not_detected asserting send() is awaited when no agent is present in mock setup (text messages don't produce command output)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes the Telegram MarkdownV2 link regex to handle URLs containing parentheses (e.g. Wikipedia links).
The link regex in
format_messageused[^)]+for the URL portion, which stopped matching at the first)character. URLs with nested parentheses likehttps://en.wikipedia.org/wiki/Rust_(programming_language)were truncated, producing malformed MarkdownV2 that Telegram's API rejected. This caused the entire message to fall back to plain text, losing all formatting.The fix copies the regex used by the Slack adapter, which works.
Before and after screenshot:

Related Issue
N/A
Type of Change
Changes Made
gateway/platforms/telegram.py: Updated the markdown link regex informat_messagefromr'\[([^\]]+)\]\(([^)]+)\)'tor'\[([^\]]+)\]\(([^()]*(?:\([^()]*\)[^()]*)*)\)'to support one level of nested parentheses in URLs.How to Test
[text](url)shown as literal text, all bold/italic/formatting lostChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings)cli-config.yaml.exampleif I added/changed config keysCONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows