feat(telegram): streaming output support (Edit + Draft modes)#276
feat(telegram): streaming output support (Edit + Draft modes)#276Youhai020616 wants to merge 1 commit intoRightNow-AI:mainfrom
Conversation
Add progressive message display for Telegram so AI responses appear like typing instead of waiting for the full response. Implements two strategies: Edit mode (sendMessage + editMessageText, works everywhere) and Draft mode (sendMessageDraft, DM only, experimental). Auto mode selects the best strategy. Includes rate-limit adaptive backoff, cursor indicator, message splitting for long responses, and full backward compatibility via default trait implementations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🔍 Adversarial Review — PR #276Size: large (1106 lines, 7 files) | Reviewers: skeptic, architect, minimalist Verdict: REJECTSix independent HIGH findings, three with cross-reviewer consensus — correctness, data integrity, and API contract failures make this unsafe to merge. Findings1. [HIGH | CONSENSUS ×3] UTF-8 byte-slice panic — 2. [HIGH | CONSENSUS ×2] Partial-stream fallback creates ghost messages — 3. [HIGH] Abnormal stream close marked as successful delivery — 4. [HIGH | CONSENSUS ×2] 5. [HIGH] 6. [HIGH] Trait coupled to 7. [MEDIUM | CONSENSUS ×2] 8. [MEDIUM | CONSENSUS ×2] Detached converter task with no error propagation — 9. [MEDIUM] 10. [MEDIUM] Delivery record split-brain for partial streams — What Went Well
Lead Judgment
|
Summary
sendMessage+editMessageText, works in groups and DMs) and Draft mode (sendMessageDraftBot API 9.5, DM only, experimental)stream_mode: offpreserves existing behavior with zero impactChanges
openfang-types/config.rsTelegramStreamModeenum,TelegramStreamConfigstruct, new fields onTelegramConfigopenfang-channels/types.rsChannelStreamEventenum,StreamSinktrait,supports_streaming()/begin_stream()onChannelAdapteropenfang-channels/formatter.rsescape_html_entities(),find_split_point()helpersopenfang-channels/telegram.rsTelegramStreamSinkimplementingStreamSink, Edit/Draft modes, rate-limit backoff, message splitting, cursor indicatoropenfang-channels/bridge.rssend_message_streaming()onChannelBridgeHandle,dispatch_streaming(), streaming fallback in dispatchopenfang-api/channel_bridge.rssend_message_streaming()impl withStreamEvent → ChannelStreamEventconversion+819 lines, -19 lines across 7 files (including Cargo.lock)
Key Features
▌shown during streaming, removed on finalizeConfig Example
🤖 Generated with Claude Code