Repository navigation
fix(telegram): replies are lost when the HTTP proxy refuses the tunnel - #140388
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 4:58 PM ET / 20:58 UTC (Revision 9). ClawSweeper reviewWhat this changesThe Telegram plugin marks refused or failed proxy tunnels as unsent requests so existing retries and durable recovery can preserve queued replies. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main still misclassifies refused proxy tunnels, and the supplied before/after observations support recovery without duplicate delivery. No blocking patch defect was found. Priority: P1 Review scores
Verification
How this fits togetherTelegram’s transport sends queued replies through a configured proxy and reports whether a request could have reached Telegram. The delivery queue uses that distinction to retry unsent messages while preserving protection against replaying ambiguous sends. flowchart TD
A[Queued Telegram reply] --> B[Telegram transport]
B --> C[Proxy tunnel]
C --> D{Tunnel opened?}
D -->|No| E[Existing safe retry and recovery]
D -->|Yes| F[Telegram API request]
F --> G[Delivery receipt or ambiguous outcome]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +55, Tests +293. Total +348 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep unsent-request classification in the transport that owns the proxy, using existing recovery while retaining ambiguity safeguards for requests that may have reached Telegram. Do we have a high-confidence way to reproduce the issue? Yes: refusing CONNECT before a durable Telegram send exposes the missing classification in current source, corroborated by the contributor’s before/after observations. This review did not execute a reproduction. Is this the best way to solve the issue? Yes: the patch records proven non-delivery at the transport owner and reuses existing retry and recovery contracts without broadening ambiguous-send replay. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c3f242fe0a79. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
70bce69 to
521cfe3
Compare
undici's ProxyAgent reports a non-200 CONNECT reply as a generic RequestAbortedError (UND_ERR_ABORTED) and a socket failure while the tunnel is opening as ProxyConnectionError (UND_ERR_PRX_CONN). Both fire before the TLS session to api.telegram.org exists, so the request never reached Telegram, but the Telegram send path treated them as an unknown post-send failure: one attempt, then the durable queue parked the reply as unknown_after_send and never replayed it. The Telegram transport owns its proxy dispatchers, so it now surfaces both shapes as TelegramRequestNotStartedError with the original error as cause. The existing no-send contract does the rest: the send runner retries in-process and rethrowTelegramSendError hands the durable queue a PlatformMessageNotDispatchedError, so the reply is replayed on the recovery schedule. Direct dispatchers and generic aborts keep their ambiguous, no-retry handling.
521cfe3 to
b234946
Compare
|
Thanks @Hekzory! Proof: Real Telegram Test Server turns recovered the original queued reply exactly once after proxy restoration and Gateway restart through both explicit and environment proxy settings. Abort, certificate, accepted-tunnel reset, and native reply controls passed, along with 124 focused tests and exact-head CI.
|
openclaw#140388) Classify transport-proven proxy tunnel failures through Telegram's existing request-not-started error so queued replies remain safely retryable. Preserve caller cancellation and ambiguous-send protection. Verified real Telegram Test Server recovery across Gateway restart through explicit and environment proxies, discriminating abort/TLS controls, native reply context, and focused regression tests. Co-authored-by: Ayaan Zaidi <[email protected]>
…irs for 8.35-D Adapt official PRs openclaw#140388, openclaw#156842, openclaw#168738, openclaw#169010, openclaw#165444, openclaw#164633 and openclaw#169029 to the existing synchronous 2026.8.35 custom queue and plugin baseline. Preserve prior A/B/C repairs, UI, locked dependencies, database schemas, configuration and build customizations. Canonical build source: 7fdcb8a1f5b9cec7c1e9d66bc8ae551a38f0ed70 Verified complete source tree: 6511c79 Upstream base: 713ba57 Selected regression boundaries: 247 tests passed; core and plugin production typechecks passed; bounded P0 autoreview scoped-clean. Broader Windows cleanup/symlink EPERM limits are recorded in local verification. No live Telegram-group test or full repository-green claim. Saved ordinary inbound final text permits one retry after typed ambiguous transport failure, at most two total sends, with possible duplicate after a lost acknowledgement. Media, controls and accepted partial/identityless evidence remain excluded. This does not grant all cron/invest completion paths replay permission. Candidate build only; no production deployment or memory reset.
Related: #126246
What Problem This Solves
Fixes an issue where durably queued Telegram replies are abandoned when an HTTP proxy refuses the CONNECT tunnel before the request reaches Telegram. The failed reply is treated as an ambiguous send, so recovery refuses to replay it after connectivity returns.
Why This Change Was Made
The Telegram transport marks Undici's exact refused-tunnel and proxy-connection error shapes as requests that did not start. Its existing retry and durable recovery paths then handle the unsent reply. The classification applies to transport-owned explicit and environment proxy dispatchers, preserves the original error cause, and lets caller cancellation take precedence. Ambiguous sends retain their existing no-replay protection.
User Impact
Durably queued replies can recover from a temporary proxy refusal and arrive once after the same proxy becomes healthy.
Evidence
unknown_after_send; recovery refused blind replay and retained its existing permanent failure record.