github / github/copilot-cli

Copilot CLI SEA binary hangs when IPv6 is unroutable — no fallback to IPv4

Ouverte
#2,361 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area:networking
Langage dominant
Shell
Étoiles
11.2k
Forks
1.9k
Merge moyen
14 h 16 min
PR mergées (30 j)
6

Description

## Description

Copilot CLI v1.0.12 hangs on startup (and on any prompt/init) when DNS returns an IPv6 AAAA record for `api.individual.githubcopilot.com` that has no route. The bundled Node.js SEA binary's `fetch` (undici) does not fall back to IPv4, unlike system Node.js which handles this gracefully via Happy Eyeballs.

The CLI appears to work (login succeeds, Octokit API calls return 200), but the MCP server connection and model listing retry with exponential backoff (5s → 10s → 20s → 40s → 80s) across 5 attempts, making the CLI unusable for ~2.5 minutes before failing.

## Root cause

1. DNS returns both A (IPv4) and AAAA (IPv6) records for `api.individual.githubcopilot.com`
2. IPv6 is unroutable on the current network (e.g. mobile hotspot)
3. `curl -6 https://api.individual.githubcopilot.com/` → `No route to host`
4. `curl -4 https://api.individual.githubcopilot.com/` → works (404, as expected)
5. System Node.js `fetch('https://api.individual.githubcopilot.com/...')` → works (falls back to IPv4)
6. Copilot CLI SEA binary → `TypeError: fetch failed` (no fallback)

Because the binary is a Node.js Single Executable Application, `NODE_OPTIONS="--dns-result-order=ipv4first"` has no effect.

## Environment

- **OS:** macOS 15 (Darwin 25.3.0), Apple Silicon
- **Copilot CLI:** 1.0.12 (Homebrew cask)
- **Bundled Node.js:** v24.11.1
- **Network:** iPhone hotspot (no IPv6 routing) + DNS resolver that returns AAAA records

## Logs

From `~/.copilot/logs/`:

```
[ERROR] Starting remote MCP client for github-mcp-server with url: https://api.individual.githubcopilot.com/mcp/readonly
[ERROR] Creating MCP client for github-mcp-server...
[ERROR] Connecting MCP client for github-mcp-server...
[ERROR] Error making GitHub API request: AggregateError
[WARNING] Retrying request to GitHub API in 5 seconds. Attempt 1/5
[ERROR] MCP transport for github-mcp-server closed
[ERROR] Failed to start MCP client for remote server github-mcp-server: TypeError: fetch failed
```

Note: Octokit requests to `api.github.com` succeed (200) in the same session — only `fetch()`-based requests to `api.individual.githubcopilot.com` fail.

## Workaround

Disable any DNS resolver that returns AAAA records for the Copilot API endpoint (in my case, disabling Tailscale MagicDNS).

Adding an `/etc/hosts` entry for IPv4 does **not** help because `getaddrinfo` still returns the IPv6 address from DNS alongside the `/etc/hosts` IPv4 entry.

## Suggested fix

The SEA binary should use Happy Eyeballs (RFC 6555/8305) or `--dns-result-order=ipv4first` so that an unroutable IPv6 address doesn't prevent connection over IPv4. System Node.js v24 already handles this correctly — the issue is specific to the bundled undici in the SEA build.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.