Skip to content

fix(telegram): add max retries and backoff to sendChatAction#1548

Open
BingqingLyu wants to merge 2 commits into
mainfrom
fork-pr-56153-fix-issue-56096-telegram-sendchataction-backoff
Open

fix(telegram): add max retries and backoff to sendChatAction#1548
BingqingLyu wants to merge 2 commits into
mainfrom
fork-pr-56153-fix-issue-56096-telegram-sendchataction-backoff

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add MAX_SEND_CHAT_ACTION_RETRIES (5) to prevent infinite retry loops
  • Add shouldRetrySendChatAction() to skip 429 (rate limit) and 529 (overloaded) errors
  • Add exponential backoff (1s to 30s) with jitter for sendChatAction
  • Make sendTypingTelegram failures non-blocking (best-effort typing indicator)

Why

Issue openclaw#56096 reports that Telegram sendChatAction enters an infinite retry loop when the model returns 529 (overloaded). The bot becomes completely unresponsive. This fix:

  1. Limits retry attempts to 5 (instead of infinite)
  2. Never retries on 429/529 errors (these cause the loop)
  3. Uses exponential backoff with 1s → 2s → 4s → 8s → 16s pattern
  4. Even if all retries fail, the typing indicator is non-critical so the main message flow continues

Testing

  • Code compiles without errors
  • Logic changes are minimal and focused
  • Matches the issue requirements

Fixes openclaw#56096

Pick-cat and others added 2 commits March 28, 2026 11:56
- Add MAX_SEND_CHAT_ACTION_RETRIES (5) to prevent infinite loops
- Add shouldRetrySendChatAction to skip 429/529 errors that cause loops
- Add is429Or529Error check to sendChatActionHandler (issue openclaw#56096)
- Add exponential backoff (1s to 30s) with jitter
- Gracefully handle sendTypingTelegram failures (non-critical)

Fixes openclaw#56096

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Add strictShouldRetry: true to prevent 429 errors from being retried
  via TELEGRAM_RETRY_RE fallback regex
- Rename MAX_SEND_CHAT_ACTION_RETRIES to MAX_SEND_CHAT_ACTION_ATTEMPTS
  since 'attempts' represents total call count, not retry count
- Always log typing failures (remove opts.verbose guard) so production
  issues are visible

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Telegram sendChatAction infinite retry loop with no backoff

2 participants