Repository navigation
fix(telegram): avoid permanent getFile retries without losing temporary files - #117798
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 1:05 AM ET / 05:05 UTC. ClawSweeper reviewWhat this changesThe PR changes Telegram media resolution so permanent Merge readinessKeep this PR open for maintainer review: current Priority: P2 Review scores
Verification
How this fits togetherTelegram inbound handlers resolve attachment metadata through flowchart LR
A[Telegram inbound update] --> B[Inbound media handler]
B --> C[Media resolver]
C --> D[getFile retry decision]
D -->|retryable| E[Bounded getFile retry]
D -->|permanent| F[Typed media failure]
E --> G[Download and persist attachment]
F --> H[Handler and durable replay policy]
Decision needed
Why: The branch has focused regression coverage and controlled runtime proof, but this is a user-visible compatibility contract for Telegram's server-provided error wording rather than a purely mechanical cleanup. Before merge
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +101. Total +105 across 2 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the method-scoped retry policy: retry shared network, rate-limit, and server failures plus the known temporary Do we have a high-confidence way to reproduce the issue? Yes, from current source and the focused branch regression cases: current Is this the best way to solve the issue? Yes, subject to the maintainer compatibility choice: the retry owner is the resolver itself, and the patch reuses the shared Telegram retry classifier instead of creating a parallel policy while retaining the explicit temporary-file case. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4b26a15a1f42. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer decision: accept the scoped
This explicitly accepts ClawSweeper's sole optional rank-up/owner decision for exact head |
|
Merged via squash.
|
…ia (openclaw#117798) Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes an issue where Telegram repeatedly retried permanent media-file lookup failures, delaying attachment handling, while preserving Telegram's documented temporary-file-unavailable response that legitimately succeeds on retry.
Why This Change Was Made
Replace the method owner's permissive retry-all policy with the existing canonical Telegram network/rate-limit/server-error classifier plus one tightly scoped, typed grammY
getFileexception for Telegram's explicitly temporary HTTP 400 response. Keep the special file-too-large path, cancellation, flood waits, and document/sticker ownership unchanged.User Impact
Permanent invalid-file, unauthorized, forbidden, missing, and conflict errors now fail immediately instead of being retried three times. Temporary Telegram file-storage delays still recover automatically for both ordinary attachments and stickers.
Evidence
getFilethree times instead of once.4ea3060bd3209e7f3c94ef76de8af8630247f72f: the complete Telegram media owner suite passes 38/38, covering permanent errors, temporary 400 recovery for both documents and stickers, 429 retry-after, 500/502, network errors, abort/deadline, and file-too-large behavior.gpt-5.6-solhigh-reasoning P0–P3 review explicitly rechecked the previously discovered temporary-400 regression: zero findings, confidence 0.98; native TruffleHog 3.96.0 scan clean.Redacted real resolver + controlled Bot API proof
The exact frozen production owner ran against actual local HTTP Bot API responses using pinned grammY 1.45.1, an actual
Bot.api.getFileclient, real OpenClawresolveMedia, a real PNG, its configured trusted-local-root guard, and isolated media persistence. NogetFile/resolver mock or Vitest harness was used.Compatibility is deliberately method-scoped: pinned grammY
out/core/error.jsandout/core/error.d.tsdirectly defineGrammyError.method, numericerror_code, and serverdescription; onlymethod === "getFile", status 400, and the documented temporary-file phrase receive the existing bounded retry. Generic polling/webhook classification remains unchanged.