From 1b3c51bccc46a7ab147eee58dc20b8ab8c4770ab Mon Sep 17 00:00:00 2001 From: Erhnysr Date: Wed, 13 May 2026 22:09:10 +0300 Subject: [PATCH] fix(gateway): keep tool-progress edits alive after Telegram flood control When a progress-message edit hits Telegram flood control (RetryAfter), can_edit was unconditionally set to False, permanently disabling coalescing for the rest of the run. Subsequent tool updates were posted as separate new messages instead of updating the existing progress bubble. Fix: only set can_edit=False for non-recoverable edit errors. On flood control, back off by resetting _last_edit_ts so the throttle interval is respected before the next edit attempt. Fixes #25188 --- gateway/run.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gateway/run.py b/gateway/run.py index 5ce3fd5521c..9e50c87ad10 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -15463,14 +15463,15 @@ class GatewayRunner: if not result.success: _err = (getattr(result, "error", "") or "").lower() if "flood" in _err or "retry after" in _err: - # Flood control hit — disable further edits, - # switch to sending new messages only for - # important updates. Don't block 23s. + # Flood control hit — backoff but keep editing. + # Only disable edits for non-recoverable errors. logger.info( - "[%s] Progress edits disabled due to flood control", + "[%s] Progress edit flood control, backing off", adapter.name, ) - can_edit = False + _last_edit_ts = time.monotonic() + else: + can_edit = False _flood_result = await adapter.send( chat_id=source.chat_id, content=msg,