fix(telegram): #94620 prevent EADDRNOTAVAIL from triggering useless IP-rotation fallback#94712
fix(telegram): #94620 prevent EADDRNOTAVAIL from triggering useless IP-rotation fallback#94712qingminglong wants to merge 2 commits into
Conversation
EADDRNOTAVAIL(ephemeral port exhaustion)是本地 socket 分配失败, 尝试切换替代 Telegram API IP 地址无法解决。本次修复: 1. collectErrorCodes() 新增数值 errno 收集,使 errno=99 能被检测 2. shouldUseTelegramTransportFallback() 中排除 EADDRNOTAVAIL Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed June 19, 2026, 3:16 AM ET / 07:16 UTC. Summary PR surface: Source +9, Tests +38. Total +47 across 2 files. Reproducibility: yes. for source-level reproduction: current main retries code-less 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: Keep the fix in the Telegram fetch classifier, but normalize or narrowly map numeric EADDRNOTAVAIL variants while preserving retryable network fallbacks, then require real transport proof or an explicit maintainer proof override. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main retries code-less Is this the best way to solve the issue? No: the Telegram fetch module is the right owner boundary, but raw numeric errno strings are too broad and the numeric EADDR guard is incomplete. The safer fix is explicit errno-to-symbol normalization or a narrow local-socket guard that preserves retryable fallback behavior. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 86a28636fa80. Label changesLabel justifications:
Evidence reviewedPR surface: Source +9, Tests +38. Total +47 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 re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
help me merge |
Summary
当发生 EADDRNOTAVAIL(Linux errno 99 / macOS errno 49,临时端口耗尽)时,Telegram transport fallback 被误触发,尝试切换替代 Telegram API IP 地址——这是本地 socket 分配失败,换远程 IP 无效。
问题
collectErrorCodes()只收集字符串.code,忽略了.errno数值。EADDRNOTAVAIL 以errno=99出现时ctx.codes为空,触发hasFetchFailedEnvelope && ctx.codes.size === 0兜底回退修复
collectErrorCodes():增加数值 errno 收集,errno=99加入 codes 集合shouldUseTelegramTransportFallback():检测"EADDRNOTAVAIL"或"99"时立即返回false阻止回退不变更
network-errors.ts:getErrorCode()已有String(errno)逻辑createTelegramTransportAttempts():回退触发后的日志不在本次修复范围关联 Issue
Closes #94620
变更类型
风险等级
low
Real behavior proof
Behavior addressed: EADDRNOTAVAIL(ephemeral port exhaustion)不再触发 Telegram transport fallback,避免无效的 IP 切换重试和误导性日志。远程 IP 旋转无法修复本地 socket 分配失败。
Real environment tested: Linux 4.19 (x86_64), Node 22, pnpm 11
Exact steps or command run after this patch: 运行独立的 EADDRNOTAVAIL 验证脚本,模拟修复逻辑的 5 种错误场景:
After-fix evidence: 终端输出 — 5 种场景全部按预期通过:
Observed result after the fix: EADDRNOTAVAIL 以
.code=EADDRNOTAVAIL或.errno=99出现时,fallback 均被正确阻止(Fallback=NO)。正常网络错误(ETIMEDOUT、ENETUNREACH)以及纯 fetch failed 无 code 场景仍正常触发 fallback(Fallback=YES),行为无回归。What was not tested: 由于需要在宿主机上耗尽 ephemeral ports 才能复现 EADDRNOTAVAIL 生产场景,验证通过独立的 node 脚本精确模拟 5 种错误场景下的 fallback 决策逻辑。
Tests and validation
额外运行 Telegram 扩展测试套件,44 个测试全部通过(其中包含新增的 2 个 EADDRNOTAVAIL 专用测试),无回归。