fix(telegram): stabilize streamed overflow markdown delivery - #52933
fix(telegram): stabilize streamed overflow markdown delivery#52933mrapac wants to merge 1 commit into
Conversation
|
Thanks for targeting a real Telegram delivery failure. The current main still unconditionally downgrades MarkdownV2 failures to plain text in both the final-edit path ( Problems
Suggested changes
Automated hermes-sweeper review. |
|
Thanks — I updated the branch to keep the current stream consumer gating intact and focused the fix on the adapter overflow paths. I also preserved RetryAfter details in overflow continuation failures, and verified the targeted gateway tests pass locally. |
|
Resolved the merge conflict with current The resolution keeps both sides of the recent gateway changes:
Verification after the merge:
|
91b0cd8 to
431e580
Compare
|
Updated this branch onto current Scope is still the intended 4 files: Verification on the refreshed branch: One small test-conflict cleanup was included in GitHub now reports the PR as mergeable again. |
|
Closing this PR because upstream v0.20.0 has addressed the split-delivery / overflow bug class more comprehensively. Specifically:
Together these root-cause the duplicate/swallow/markdown-formatting issues across the full gateway split-delivery surface, where this PR took a more targeted approach. The one residual edge case — flood-controlled turn-final edits leaving a raw streaming preview on screen — we're carrying as a small local commit ( Thanks for the review time, and great work on the v0.20.0 gateway overhaul! |
Bug Description
Long streamed Telegram replies could surface a lossy partial message before the clean final delivery completed.
In end-to-end testing this showed up as one or more of the following:
This was most noticeable on richly formatted responses that crossed Telegram's legacy edit limit and exercised overflow-split and retry / flood-control paths.
Root Cause
Several related delivery paths treated transient send/edit failures too similarly to real Markdown parse failures:
The net effect was that temporary delivery problems could become user-visible formatting loss.
Fix
This change narrows Telegram fallback behavior so long streamed replies fail more safely and consistently.
How to Verify
Test Plan
Manual / local verification completed:
python -m compileallon the touched gateway, adapter, and test filesNote: the full pytest suite was not available in the local Hermes venv used during debugging because
pytestwas not installed there.Risk Assessment
Low to Medium — the change is scoped to Telegram long-message streaming, overflow handling, and markdown/plain-text fallback decisions. The main regression risk is in Telegram-specific long-form delivery rather than the wider gateway.