-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Telegram retry regex too strict: bare grammy Network request for 'X' failed! (no "after") never classified as recoverable for context: send, drops outbound messages #80362
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
isRecoverableTelegramNetworkError(err, { context: "send" })inextensions/telegram/src/network-errors.ts(compileddist/send-*.js) fails to classify grammy's bare pre-connect formNetwork request for 'sendChatAction' failed!as recoverable — so the per-requestshouldRetrypredicate increateTelegramRequestWithDiagreturnsfalseand the user-visible reply is silently dropped.Root cause
The regex used to whitelist grammy network errors only matches the post-connect form:
…but grammy raises two distinct forms:
Network request for 'sendChatAction' failed!Network request for 'sendChatAction' failed after 5 attempts: ...The current regex requires the literal
failed\s+after\b, so the pre-connect form (the safer one to retry) is rejected, while the post-connect form (the riskier one) passes.For
context: "send",allowMessageMatch=falseis set deliberately to avoid retrying the post-connect form and producing duplicate user messages. That's correct for the post-connect case — but it also skips the snippet checkRECOVERABLE_MESSAGE_SNIPPETS(which DOES contain"network request"), leaving only the broken regex as the gatekeeper.Net effect: a single transient socket-pool failure during event-loop starvation drops the user's reply with no retry.
Reproduction
[diagnostic] liveness warning: ... eventLoopDelayMaxMs=15000and accompanying[fetch-timeout] timer delayed 33208ms, likely event-loop starvation.Network request for 'sendChatAction' failed!(no "after").[telegram] message processing failed: HttpError: Network request for 'sendMessage' failed!— single attempt, no retry.Repro on our box: 2026-05-10 20:15:19-20:17:47 — 39 send failures over 140s, all single-attempt, no retry log lines. v2026.5.3-1.
Suggested fix
Make the post-connect
after ...clause optional — the regex still matches both forms safely:Test cases (all should match):
Negative cases (should NOT match):
Verified locally — old regex matches 1/4 positive cases; new regex matches 4/4 with no false positives.
Why this is safe
The pre-connect form happens specifically when grammy's internal fetch aborts before any bytes are written — either via AbortSignal (timeout firing) or synchronously from a dead undici pool socket. In both cases the request never reached api.telegram.org, so retry cannot create a duplicate.
Related
Workaround
Patch
dist/send-*.jspost-install (we wired this into apost-openclaw-upgrade.shhook to survive package updates).