fix(telegram): preserve can_edit after transient network errors in progress edits (#27828)
When edit_message_text fails with a transient error (httpx.ConnectError, NetworkError, server disconnected, timeouts), the progress-message sender must not permanently set can_edit = False — that would convert a single Telegram network hiccup into separate per-tool bubbles for the rest of the run. Changes: - gateway/platforms/telegram.py: edit_message now returns retryable=True for transient network errors (ConnectError, NetworkError, timeouts, server disconnects, temporarily unavailable). Permanent failures (flood control, message-not-found, permissions) remain retryable=False. - gateway/run.py: send_progress_messages checks result.retryable before setting can_edit = False. Transient failures skip the fallback-send and continue — the next edit cycle catches up with the accumulated lines. Permanent failures (flood, message-not-found, etc.) still disable editing. Tests: 22 new tests in test_telegram_progress_edit_transient.py covering transient vs permanent error classification, SendResult.retryable semantics, and the can_edit decision logic. Fixes #27828
This commit is contained in:
@@ -15462,6 +15462,17 @@ class GatewayRunner:
|
||||
)
|
||||
if not result.success:
|
||||
_err = (getattr(result, "error", "") or "").lower()
|
||||
# Transient network errors (ConnectError, timeouts)
|
||||
# must not permanently disable progress-message
|
||||
# editing — the next cycle can catch up. Only
|
||||
# permanent failures (flood control, message not
|
||||
# found, permissions) should set can_edit = False.
|
||||
if getattr(result, "retryable", False):
|
||||
logger.debug(
|
||||
"[%s] Transient edit failure — keeping can_edit=True",
|
||||
adapter.name,
|
||||
)
|
||||
continue
|
||||
if "flood" in _err or "retry after" in _err:
|
||||
# Flood control hit — backoff but keep editing.
|
||||
# Only disable edits for non-recoverable errors.
|
||||
|
||||
Reference in New Issue
Block a user