Skip to content

fix(agents-login): prefer IPv4 so codex login can reach auth.openai.com#742

Merged
ExtraToast merged 1 commit into
mainfrom
fix/agents-login-prefer-ipv4
Jun 26, 2026
Merged

fix(agents-login): prefer IPv4 so codex login can reach auth.openai.com#742
ExtraToast merged 1 commit into
mainfrom
fix/agents-login-prefer-ipv4

Conversation

@ExtraToast

Copy link
Copy Markdown
Owner

Problem (live diagnosis)

codex login --device-auth (codex 0.141.0) fails instantly with error sending request for url (https://auth.openai.com/api/accounts/deviceauth/usercode). The agents-login-worker pod has no working IPv6 egress (connect = ENETUNREACH), auth.openai.com publishes AAAA records, and codex's Rust HTTP client (glibc getaddrinfo on this Debian image) tries the IPv6 address first with no IPv4 fallback. Node-based clients (claude login) are unaffected — they happy-eyeball to IPv4. Confirmed in-pod: node GET to that endpoint returns 200/400 (IPv4); a forced IPv6 connect is ENETUNREACH.

Fix

Add /etc/gai.conf (precedence ::ffff:0:0/96 100) in the runtime stage so glibc getaddrinfo ranks IPv4-mapped addresses first → codex connects over IPv4. One RUN line, runtime stage only; no version or logic changes.

Validation

No unit tests cover the Dockerfile. Needs a real deploy to confirm the device-auth POST succeeds (the worker will then progress past starting for Codex and emit the device code/URL). Authored by a separate codex worker, in parallel with the Claude chooser fix.

🤖 Generated with Claude Code

`codex login --device-auth` (codex 0.141.0) failed instantly with
"error sending request for url (https://auth.openai.com/api/accounts/deviceauth/usercode)".
The agents-login-worker pod has no working IPv6 egress (connect = ENETUNREACH),
auth.openai.com publishes AAAA records, and codex's Rust HTTP client (glibc
getaddrinfo on this Debian image) tries the IPv6 address first with no IPv4
fallback. Node-based clients (claude login) are unaffected because they
happy-eyeball to IPv4.

Add /etc/gai.conf with `precedence ::ffff:0:0/96 100` in the runtime stage so
glibc getaddrinfo ranks IPv4-mapped addresses first and codex connects over
IPv4 (which has working egress).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ExtraToast ExtraToast merged commit 7f5bb99 into main Jun 26, 2026
22 checks passed
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