Skip to content

Give each outbound connect attempt one second instead of 250 ms - #1376

Merged
helpcodeai merged 2 commits into
mainfrom
fix/outbound-connect-attempt-timeout
Nov 1, 2026
Merged

helpcodeai merged 2 commits into
mainfrom
fix/outbound-connect-attempt-timeout

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

Telegram calls on Cloud fail now and then with ETIMEDOUT after only 0.5 s (7 calls in 6 workspaces on 31 Oct, 12 in 6 the day before, mostly telegram_bot_get_updates and send_message). api.telegram.org has an IPv4 and an IPv6 address. For such hosts Node's happy-eyeballs gives each address only 250 ms (autoSelectFamilyAttemptTimeout), and the Cloud containers have no IPv6 route, so one lost SYN on the IPv4 attempt is enough to fail the whole call.

Changes

  • createSsrfGuardedAgents (the agents every outbound connector call uses) sets autoSelectFamilyAttemptTimeout to 1,000 ms. A lost SYN is retried inside the attempt, and the fallback to the next address still comes after one second. The 5 s socket timeout is unchanged.
  • Spec: both agents carry the setting.

Type

  • Bug fix

Testing

  • Added/updated unit tests

In packages/backend: npx jest src/common/ssrf.util.spec.ts src/common/outbound-http.spec.ts src/common/outbound-fetch.util.spec.ts (81 passed), npx eslint on the two files, npx tsc --noEmit -p tsconfig.json. Same in Cloud and self-hosted; it only matters for hosts with several addresses where the first attempt is slow.

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • All existing tests pass
  • This PR has a descriptive title

Related Issues

Daily check 2026-10-31 (proposed) and 2026-11-01, cloud.md candidate 6.

@helpcodeai
helpcodeai enabled auto-merge (squash) November 1, 2026 09:27
@helpcodeai
helpcodeai merged commit 34e166b into main Nov 1, 2026
14 checks passed
@helpcodeai
helpcodeai deleted the fix/outbound-connect-attempt-timeout branch November 1, 2026 09:52
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant