fix(telegram): exclude EADDRNOTAVAIL from transport fallback to avoid misleading logs and dead-code retries#95275
Conversation
EADDRNOTAVAIL 是本地 socket 分配失败,切换远程 Telegram IP 无效。 collectErrorCodes() 增加数值 errno 提取,shouldUseTelegramTransportFallback() 在 EADDRNOTAVAIL 时返回 false 避免无效回退和误导性日志。 Fixes openclaw#94620 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed June 20, 2026, 4:24 AM ET / 08:24 UTC. Summary PR surface: Source +8, Tests +25. Total +33 across 2 files. Reproducibility: yes. at source level: current main and v2026.6.8 show probeTelegram can still force-promote fallback after getMe fetch errors while the pinned-IP warning remains. I did not establish a live socket-exhaustion Telegram repro in this read-only review. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 findings
Review detailsBest possible solution: Fix both the direct fetch classifier and the probe forced-fallback boundary so EADDRNOTAVAIL never promotes IP rotation while preserving valid remote/family fallback behavior, then add focused regression coverage and redacted real runtime proof or an explicit maintainer proof override. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main and v2026.6.8 show probeTelegram can still force-promote fallback after getMe fetch errors while the pinned-IP warning remains. I did not establish a live socket-exhaustion Telegram repro in this read-only review. Is this the best way to solve the issue? No: the classifier guard is useful but not the best complete fix because the probe forced-fallback boundary still discards the original local socket allocation error. The safer fix carries the original error into the fallback decision and preserves valid retry behavior for other network failures. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 68790eb4b9a8. Label changesLabel justifications:
Evidence reviewedPR surface: Source +8, Tests +25. Total +33 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
|
|
/clawsweeper |
Summary
当系统临时端口耗尽(EADDRNOTAVAIL)时,Telegram 传输层误判为"DNS 解析的 IP 不可达",触发 fallback 切换远程 IP——这对本地 socket 分配失败毫无意义。
Root Cause
collectErrorCodes()只收集.code字符串,忽略了.errno(数值 99)。ctx.codes为空时触发codes.size === 0的兜底回退。Fix
collectErrorCodes(): 增加数值errno提取shouldUseTelegramTransportFallback(): 遇到EADDRNOTAVAIL(code 或 errno)时直接返回 falseTest plan
buildFetchFallbackError("EADDRNOTAVAIL")→ false{ errno: 99 }的 cause → falsebuildFetchFallbackError("ENETUNREACH")→ trueFixes #94620
🤖 Generated with Claude Code
Real behavior proof
Behavior addressed: EADDRNOTAVAIL(临时端口耗尽)不再误触发 Telegram fallback
Real environment tested: Linux 4.19.112, Node v22.18.0
Before-fix evidence:
collectErrorCodes()只检查.code字符串,EADDRNOTAVAIL 的.code和.errno均未捕获 →ctx.codes为空 → 触发codes.size === 0兜底回退,日志误导性显示 "DNS-resolved IP unreachable"。Exact steps or command run after this patch:
After-fix evidence:
45 tests passed,新增 3 个 EADDRNOTAVAIL 测试全部通过:
Observed result after the fix:
shouldUseTelegramTransportFallback()在包含"EADDRNOTAVAIL"或"99"时返回false,避免无意义 IP 切换。其他网络错误(如ENETUNREACH)仍正常回退。What was not tested: 未在实际 Telegram API 环境中验证(缺少 Telegram bot token)。单元测试覆盖了关键代码路径和边界条件。