Skip to content

Commit 8f26eb9

Browse files
Pick-catclaude
andcommitted
fix(telegram): address PR review comments for sendChatAction retry
- 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]>
1 parent 726d88f commit 8f26eb9

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

extensions/telegram/src/send.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ export async function sendMessageTelegram(
10291029
}
10301030

10311031
// Max retry attempts for sendChatAction to prevent infinite loops (issue #56096)
1032-
const MAX_SEND_CHAT_ACTION_RETRIES = 5;
1032+
const MAX_SEND_CHAT_ACTION_ATTEMPTS = 5;
10331033

10341034
/**
10351035
* Check if an error is recoverable for sendChatAction with stricter rules.
@@ -1061,7 +1061,7 @@ export async function sendTypingTelegram(
10611061
// Use limited retries with exponential backoff for sendChatAction
10621062
// This prevents infinite retry loops (issue #56096)
10631063
const typingRetryConfig: RetryConfig = {
1064-
attempts: MAX_SEND_CHAT_ACTION_RETRIES,
1064+
attempts: MAX_SEND_CHAT_ACTION_ATTEMPTS,
10651065
minDelayMs: 1000, // Start with 1s backoff
10661066
maxDelayMs: 30_000, // Cap at 30s
10671067
jitter: 0.2,
@@ -1073,6 +1073,7 @@ export async function sendTypingTelegram(
10731073
retry: typingRetryConfig,
10741074
verbose: opts.verbose,
10751075
shouldRetry: shouldRetrySendChatAction,
1076+
strictShouldRetry: true,
10761077
});
10771078
const threadParams = buildTypingThreadParams(target.messageThreadId ?? opts.messageThreadId);
10781079

@@ -1089,11 +1090,9 @@ export async function sendTypingTelegram(
10891090
} catch (err) {
10901091
// Log but don't fail - typing indicator is non-critical
10911092
// This ensures the main message flow continues even if typing fails
1092-
if (opts.verbose) {
1093-
sendLogger.warn(
1094-
`sendTypingTelegram failed after ${MAX_SEND_CHAT_ACTION_RETRIES} retries, continuing: ${formatErrorMessage(err)}`,
1095-
);
1096-
}
1093+
sendLogger.warn(
1094+
`sendTypingTelegram failed after ${MAX_SEND_CHAT_ACTION_ATTEMPTS} attempts, continuing: ${formatErrorMessage(err)}`,
1095+
);
10971096
// Return success anyway - typing indicator is best-effort
10981097
}
10991098

0 commit comments

Comments
 (0)