fix(telegram): split long streaming responses and reduce edit throttle#2349
Merged
fix(telegram): split long streaming responses and reduce edit throttle#2349
Conversation
6c2c4b1 to
2d88417
Compare
`send_or_edit()` now splits accumulated text at MAX_MESSAGE_LEN using `utf8_chunks()` in both the initial-send (None) and edit-overflow (Some) branches, matching the behavior of `send()`. This fixes Telegram API errors for streaming responses exceeding 4096 chars and unblocks the long_output E2E scenario (#2345). Reduce `should_send_update()` throttle from 10s to 3s to improve streaming UX when the provider emits chunks faster than the old interval allowed (#2341). Increase long_output E2E item count from 100 to 150 to reliably exceed 4096 chars post-MarkdownV2 escaping. Closes #2345, #2341
2d88417 to
3ef5404
Compare
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.
Summary
send_or_edit()now splits accumulated text atMAX_MESSAGE_LENusingutf8_chunks()in both the initial-send (None) and edit-overflow (Some) branches, matching the behavior ofsend(). Fixes Telegram API errors for streaming responses >4096 chars and unblocks thelong_outputE2E scenario.should_send_update()throttle reduced from 10s to 3s to improve streaming UX when the provider emits chunks at high frequency.long_outputE2E item count increased 100→150 to reliably exceed 4096 chars post-MarkdownV2 escaping.Closes #2345, #2341
Test plan
cargo nextest run -p zeph-channels --lib— 3 new tests forsend_or_edit()split logic passlong_outputscenario passes with ≥2 messagesstreamingscenario shows edit events with 3s throttle