1jehuang / 1jehuang/jcode

Telegram ambient notifications fail on unescaped Markdown and oversized transcripts

Open
#982 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

autonomous: no bug triage: needs-decision
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

  1. Configure Telegram under [safety] and enable telegram_reply_enabled.
  2. Enable ambient mode.
  3. Send a normal message to the bot so that Jcode queues it and starts an ambient cycle.
  4. Allow the cycle to complete with a non-trivial generated transcript.
  5. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.