Skip to content

fix(telegram): use retry logic for sticker getFile calls#32349

Merged
steipete merged 1 commit intoopenclaw:mainfrom
scoootscooob:fix/telegram-sticker-getfile-retry
Mar 3, 2026
Merged

fix(telegram): use retry logic for sticker getFile calls#32349
steipete merged 1 commit intoopenclaw:mainfrom
scoootscooob:fix/telegram-sticker-getfile-retry

Conversation

@scoootscooob
Copy link
Copy Markdown
Contributor

Summary

  • Sticker downloads called ctx.getFile() directly without retry, while all other media types used resolveTelegramFileWithRetry() (3 attempts, 1-4s delay with jitter)
  • This made stickers vulnerable to transient Telegram API failures, especially in group topics where file availability can be delayed
  • Now stickers use the same retry helper as all other media types

Refs #32326

Changes

  • delivery.resolve-media.ts: Replace direct ctx.getFile() in resolveStickerMedia with resolveTelegramFileWithRetry(ctx), adding null-check for the retry helper's return value
  • delivery.resolve-media-retry.test.ts: Add sticker to makeCtx helper and two new tests for sticker retry behavior

Test plan

  • All 18 media retry tests pass (16 existing + 2 new sticker tests)
  • All 77 Telegram bot tests pass (3 test files)
  • ESLint passes

🤖 Generated with Claude Code

The sticker code path called ctx.getFile() directly without retry,
unlike the non-sticker media path which uses resolveTelegramFileWithRetry
(3 attempts with jitter). This made sticker downloads vulnerable to
transient Telegram API failures, particularly in group topics where
file availability can be delayed.

Refs openclaw#32326

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR fixes an inconsistency where sticker getFile calls bypassed the shared resolveTelegramFileWithRetry helper used by every other media type (voice, audio, photo, video, document, animation). The two-line production change and two new tests are correct and well-scoped.

  • delivery.resolve-media.ts: ctx.getFile() replaced with resolveTelegramFileWithRetry(ctx); ?. null-guard added to file?.file_path since the helper returns null on exhausted retries — both changes are correct.
  • delivery.resolve-media-retry.test.ts: "sticker" added to makeCtx, plus one success-after-retry test and one exhausted-retries-returns-null test that mirror existing patterns for other media types.
  • No regressions or unintended behavior changes identified; the outer try/catch in resolveStickerMedia continues to guard against downstream errors from downloadAndSaveTelegramFile.

Confidence Score: 5/5

  • This PR is safe to merge — it is a minimal, targeted bugfix with appropriate test coverage.
  • The change is two lines of production code that align sticker handling with an already-proven retry pattern used by all other media types. The null-guard is correct, the new tests cover both the happy-retry and exhausted-retry paths, and no existing behaviour is modified.
  • No files require special attention.

Last reviewed commit: 56f323d

@steipete steipete merged commit de09ca1 into openclaw:main Mar 3, 2026
24 of 25 checks passed
@steipete
Copy link
Copy Markdown
Contributor

steipete commented Mar 3, 2026

Landed.

  • Gate: pnpm vitest run src/telegram/bot/delivery.resolve-media-retry.test.ts src/telegram/bot-handlers.test.ts
  • Merge commit: de09ca1

Thanks @scoootscooob!

dawi369 pushed a commit to dawi369/davis that referenced this pull request Mar 3, 2026
)

The sticker code path called ctx.getFile() directly without retry,
unlike the non-sticker media path which uses resolveTelegramFileWithRetry
(3 attempts with jitter). This made sticker downloads vulnerable to
transient Telegram API failures, particularly in group topics where
file availability can be delayed.

Refs openclaw#32326

Co-authored-by: Claude Opus 4.6 <[email protected]>
OWALabuy pushed a commit to kcinzgg/openclaw that referenced this pull request Mar 4, 2026
)

The sticker code path called ctx.getFile() directly without retry,
unlike the non-sticker media path which uses resolveTelegramFileWithRetry
(3 attempts with jitter). This made sticker downloads vulnerable to
transient Telegram API failures, particularly in group topics where
file availability can be delayed.

Refs openclaw#32326

Co-authored-by: Claude Opus 4.6 <[email protected]>
AytuncYildizli pushed a commit to AytuncYildizli/openclaw that referenced this pull request Mar 4, 2026
)

The sticker code path called ctx.getFile() directly without retry,
unlike the non-sticker media path which uses resolveTelegramFileWithRetry
(3 attempts with jitter). This made sticker downloads vulnerable to
transient Telegram API failures, particularly in group topics where
file availability can be delayed.

Refs openclaw#32326

Co-authored-by: Claude Opus 4.6 <[email protected]>
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
)

The sticker code path called ctx.getFile() directly without retry,
unlike the non-sticker media path which uses resolveTelegramFileWithRetry
(3 attempts with jitter). This made sticker downloads vulnerable to
transient Telegram API failures, particularly in group topics where
file availability can be delayed.

Refs openclaw#32326
V-Gutierrez pushed a commit to V-Gutierrez/openclaw-vendor that referenced this pull request Mar 17, 2026
)

The sticker code path called ctx.getFile() directly without retry,
unlike the non-sticker media path which uses resolveTelegramFileWithRetry
(3 attempts with jitter). This made sticker downloads vulnerable to
transient Telegram API failures, particularly in group topics where
file availability can be delayed.

Refs openclaw#32326

Co-authored-by: Claude Opus 4.6 <[email protected]>
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 19, 2026
)

The sticker code path called ctx.getFile() directly without retry,
unlike the non-sticker media path which uses resolveTelegramFileWithRetry
(3 attempts with jitter). This made sticker downloads vulnerable to
transient Telegram API failures, particularly in group topics where
file availability can be delayed.

Refs openclaw#32326

Co-authored-by: Claude Opus 4.6 <[email protected]>
(cherry picked from commit de09ca1)
alexey-pelykh added a commit to remoteclaw/remoteclaw that referenced this pull request Mar 19, 2026
) (#1646)

The sticker code path called ctx.getFile() directly without retry,
unlike the non-sticker media path which uses resolveTelegramFileWithRetry
(3 attempts with jitter). This made sticker downloads vulnerable to
transient Telegram API failures, particularly in group topics where
file availability can be delayed.

Refs openclaw#32326


(cherry picked from commit de09ca1)

Co-authored-by: scoootscooob <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
ephb pushed a commit to ephb-bot/openclaw that referenced this pull request Mar 19, 2026
)

The sticker code path called ctx.getFile() directly without retry,
unlike the non-sticker media path which uses resolveTelegramFileWithRetry
(3 attempts with jitter). This made sticker downloads vulnerable to
transient Telegram API failures, particularly in group topics where
file availability can be delayed.

Refs openclaw#32326

Co-authored-by: Claude Opus 4.6 <[email protected]>
lukeg826 pushed a commit to lukeg826/openclaw that referenced this pull request Mar 26, 2026
)

The sticker code path called ctx.getFile() directly without retry,
unlike the non-sticker media path which uses resolveTelegramFileWithRetry
(3 attempts with jitter). This made sticker downloads vulnerable to
transient Telegram API failures, particularly in group topics where
file availability can be delayed.

Refs openclaw#32326

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

channel: telegram Channel integration: telegram size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants