Telegram ambient notifications fail on unescaped Markdown and oversized transcripts
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 19.9k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 30
Description
Summary
Telegram receives the immediate queue acknowledgement, but the actual ambient cycle response can fail to send.
Jcode sends the detailed ambient cycle body with parse_mode = "Markdown". That body can contain arbitrary model-generated Markdown and the full conversation transcript. Invalid or unmatched Markdown causes Telegram to reject the message. A full transcript can also exceed Telegram's 4,096-character message limit.
Environment
- Jcode v0.77.1 (
3d164135a) - Windows x86_64
- Ambient mode enabled
- Telegram notifications and replies enabled
- Private Telegram chat with the bot
Steps to reproduce
- Configure Telegram under
[safety]and enabletelegram_reply_enabled. - Enable ambient mode.
- Send a normal message to the bot so that Jcode queues it and starts an ambient cycle.
- Allow the cycle to complete with a non-trivial generated transcript.
- Observe that the queue acknowledgement arrives, but the cycle response does not.
Actual behavior
The ambient cycle completes, then Telegram rejects the notification:
telegram notification failed: Telegram API error (400 Bad Request): Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 26837
The current implementation sets Markdown mode in crates/jcode-base/src/telegram.rs, while crates/jcode-app-core/src/notifications.rs includes the full conversation transcript in the detailed body sent to message channels.
Expected behavior
The ambient summary should reach Telegram regardless of Markdown characters generated by the model. Long content should not exceed Telegram's message limit.
Possible approaches include sending plain text, escaping Telegram Markdown correctly, and truncating or splitting messages before sending them.
Additional notes
The bot token and chat ID are valid. Telegram acknowledgements and read-only API checks work, so this is not an authentication, chat access, or webhook problem.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in crates/jcode-base/src/telegram.rs to inspect Markdown handling and Telegram message limits, then trace the detailed body assembled in crates/jcode-app-core/src/notifications.rs. Reproduce the ambient notification failure with generated Markdown and a long transcript. Done means the summary reaches Telegram despite arbitrary Markdown and content stays within the platform's message limit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100