fix(telegram): add UND_ERR_CONNECT_TIMEOUT to PRE_CONNECT_ERROR_CODES#101258
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 6, 2026, 11:25 PM ET / 03:25 UTC. Summary PR surface: Source +1, Tests 0. Total +1 across 2 files. Reproducibility: yes. by source inspection: current main excludes Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow classifier fix after redacted real or fault-injected Telegram/undici send-path proof shows Do we have a high-confidence way to reproduce the issue? Yes by source inspection: current main excludes Is this the best way to solve the issue? Yes, this is the narrowest maintainable fix if the undici connect-timeout contract holds; broadening generic retry matching would be riskier for duplicate message delivery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 62e5d4406d85. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests 0. Total +1 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
ab2e950 to
aed3d03
Compare
aed3d03 to
b8e2dba
Compare
UND_ERR_CONNECT_TIMEOUT occurs during TCP/TLS connect handshake, before any HTTP request data is sent. Adding it to the pre-connect set allows isSafeToRetrySendError to safely retry sendMessage when undici's connect timeout fires — the message was never transmitted.
b8e2dba to
f255925
Compare
|
Land-ready maintainer proof for exact head
Sanitized AWS Crabbox lease |
|
Merged via squash.
|
…openclaw#101258) * fix(telegram): add UND_ERR_CONNECT_TIMEOUT to PRE_CONNECT_ERROR_CODES UND_ERR_CONNECT_TIMEOUT occurs during TCP/TLS connect handshake, before any HTTP request data is sent. Adding it to the pre-connect set allows isSafeToRetrySendError to safely retry sendMessage when undici's connect timeout fires — the message was never transmitted. * test(telegram): cover connect-timeout retry funnels --------- Co-authored-by: Peter Steinberger <[email protected]>
…openclaw#101258) * fix(telegram): add UND_ERR_CONNECT_TIMEOUT to PRE_CONNECT_ERROR_CODES UND_ERR_CONNECT_TIMEOUT occurs during TCP/TLS connect handshake, before any HTTP request data is sent. Adding it to the pre-connect set allows isSafeToRetrySendError to safely retry sendMessage when undici's connect timeout fires — the message was never transmitted. * test(telegram): cover connect-timeout retry funnels --------- Co-authored-by: Peter Steinberger <[email protected]>
…openclaw#101258) * fix(telegram): add UND_ERR_CONNECT_TIMEOUT to PRE_CONNECT_ERROR_CODES UND_ERR_CONNECT_TIMEOUT occurs during TCP/TLS connect handshake, before any HTTP request data is sent. Adding it to the pre-connect set allows isSafeToRetrySendError to safely retry sendMessage when undici's connect timeout fires — the message was never transmitted. * test(telegram): cover connect-timeout retry funnels --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
isSafeToRetrySendErrorguards non-idempotentsendMessageretries by checking onlyPRE_CONNECT_ERROR_CODES— errors that are guaranteed to have occurred before the request reached Telegram's servers.UND_ERR_CONNECT_TIMEOUT(undici's TCP/TLS connect timeout) was not in this set, sosendMessagewould not retry when the connection timed out during the handshake.This is inconsistent:
ECONNREFUSED,ENOTFOUND,ENETUNREACH, andEHOSTUNREACHare all inPRE_CONNECT_ERROR_CODESbecause they fire before the connection is established.UND_ERR_CONNECT_TIMEOUThas the same property — it fires during TCP/TLS connect, before any HTTP request bytes are written to the socket — yet it was only inRECOVERABLE_ERROR_CODES(permissive, for idempotent operations).Why This Change Was Made
undici's connect timeout covers the TCP three-way handshake and TLS negotiation phases. The HTTP request data is only written after the connection is established. If the connect timer fires, no bytes were sent — meaning Telegram never received the message, and retrying is safe.
Adding
"UND_ERR_CONNECT_TIMEOUT"toPRE_CONNECT_ERROR_CODESmakesisSafeToRetrySendErrorconsistent with its contract: retry only when the message was definitely not delivered.UND_ERR_CONNECT_TIMEOUTUND_ERR_HEADERS_TIMEOUTUND_ERR_BODY_TIMEOUTUser Impact
sendMessagebecomes more resilient on flaky networks — connection timeouts during the TCP/TLS handshake will be retried instead of failing the send. No risk of duplicate messages because the connect timeout guarantees no request data was transmitted.Evidence
Verified against commit
02892535on branchfix/telegram-pre-connect-undici-timeout.Before (broken)
After (fixed)
Regression guard
Tests and Validation
One assertion updated:
UND_ERR_CONNECT_TIMEOUTnow expectstrueforisSafeToRetrySendError, matching all other pre-connect error codes.Risk Checklist
sendMessageretries on one additional error code that is guaranteed to fire before any data reaches Telegram.Closes: N/A
Maintainer Evidence
Verified exact head
d5a71be15d369fa3dfa3ce8dd59c81268d230c6e.connectorsecureConnect;UND_ERR_CONNECT_TIMEOUTdestroys the socket before the connector callback exposes it to the HTTP dispatcher.HttpErrorenvelopes in bothsendMessageTelegramand bot delivery.A sanitized AWS Crabbox run reached the no-role bootstrap but the broker's
t3.smallfallback was OOM-killed during dependency installation, before tests; no test result is claimed from that run.