fix(telegram): address Copilot review feedback

- Fix silent parse failures: message_id.parse().unwrap_or(0) replaced
  with match + tracing::warn on parse error (update_draft, finalize_draft)
- Fix UTF-8 panic: byte-based truncation replaced with char_indices()
  safe boundary detection for TELEGRAM_MAX_MESSAGE_LENGTH
- Fix global rate limiter: Mutex<Option<Instant>> replaced with
  Mutex<HashMap<String, Instant>> for per-chat rate limiting so
  concurrent conversations don't interfere with each other
- Document Block variant: clarify it's reserved for future use and
  currently behaves the same as Partial
This commit is contained in:
Xiangjun Ma 2026-02-18 00:07:19 -08:00 committed by Chummy
parent 93538a70e3
commit e21fe1ff55
2 changed files with 47 additions and 13 deletions

View file

@ -1449,7 +1449,8 @@ pub enum StreamMode {
Off,
/// Update a draft message with every flush interval.
Partial,
/// Update a draft message in larger chunks.
/// Update a draft message in larger chunks (reserved for future use;
/// currently behaves the same as `Partial`).
Block,
}