Skip to content

fix(connectors): fall back to another address for OAuth - #1148

Merged
nixuuu merged 2 commits into
devfrom
fix/oauth-egress-address-fallback
Nov 23, 2026
Merged

nixuuu merged 2 commits into
devfrom
fix/oauth-egress-address-fallback

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

When DNS returns an unreachable IPv6 address before a reachable IPv4 address, the OAuth transport now tries the next address from the same validated DNS answer. It prefers the address that answered for subsequent requests to that origin. The HTTP request starts only after TCP connects, so a failed response or TLS handshake cannot trigger a replay. Origin, redirect, certificate and SNI checks still apply.

The fallback is sequential and follows resolver order. Each TCP dial has up to 2 seconds within the existing 20-second request budget. Full Happy Eyeballs would reduce latency with overlapping dials and needs additional scheduling and socket cleanup. The reported failure returns immediately and is covered by the sequential fallback.

Start errors distinguish network, metadata and client registration failures. A network error during token refresh also reaches the worker when it blocks a tool call. Gateway logs and exports use allowlisted codes and HTTP status fields.

Verification

  • On nix-hetzner-1 (Linux, Bun 1.4.5), check:tmp passed 39 tests on PR revision 907a31b6 across OAuth egress and startup, connector calls and refresh, Slack user refresh, redirects and connector errors. The regression includes the four reported pre-connect errors and Darwin's EADDRNOTAVAIL, no extra DNS lookup, an ambiguous POST failure, and a real IPv6 refusal followed by one IPv4 POST over HTTPS. The TLS fixture rejects a mismatched certificate hostname.
  • Gateway and logs typechecks, lint and format on edited files, and git diff --check passed. A local TLS probe confirmed SNI and hostname verification. Notion's public discovery endpoint returned HTTP 200 with the pinned transport.
  • The macOS ARM CI job runs the focused transport tests. The original Notion Reconnect flow over IPv4-only Wi-Fi with Tailscale still needs confirmation on Canopy Desktop with the fix.
  • Copy audit (§8) passed. The previous generic start error now gives a short action based on the cause. The worker result gives a reconnect action for network failures during OAuth refresh.

Thanks @kubaul for reporting the issue and identifying the address ordering.

Fixes: #1050

@nixuuu
nixuuu enabled auto-merge (squash) November 23, 2026 09:19
@nixuuu
nixuuu disabled auto-merge November 23, 2026 09:24
@nixuuu
nixuuu enabled auto-merge (squash) November 23, 2026 09:28
@nixuuu
nixuuu merged commit f417cac into dev Nov 23, 2026
17 checks passed
@nixuuu
nixuuu deleted the fix/oauth-egress-address-fallback branch November 23, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant