Skip to content

macOS interactive Codex shell loses DNS with Tailscale connected despite network-enabled profile. #48968

Open

Description

@Kiragu-Maina

What version of Codex CLI is running?

0.157.1

What subscription do you have?

Max

Which model were you using?

gpt-6-sol

What platform is your computer?

Darwin 24.6.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Apple Terminal 455.1 (zsh)

Codex doctor report

{
  "note": "Selected, redacted fields from codex doctor --json, run outside the task sandbox after enabling network_proxy=true",
  "schemaVersion": 1,
  "codexVersion": "0.157.1",
  "overallStatus": "ok",
  "checks": {
    "app_server.status": {
      "status": "ok",
      "details": {
        "app-server version": "0.158.0"
      }
    },
    "config.load": {
      "status": "ok",
      "details": {
        "config.toml parse": "ok",
        "feature flag overrides": "network_proxy=true"
      }
    },
    "runtime.provenance": {
      "status": "ok",
      "details": {
        "platform": "macos-aarch64",
        "version": "0.157.1",
        "install method": "Homebrew"
      }
    },
    "sandbox.helpers": {
      "status": "ok",
      "details": {
        "approval policy": "OnRequest",
        "filesystem sandbox": "restricted",
        "network sandbox": "enabled"
      }
    },
    "network.env": {
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "managed proxy": "configured",
        "proxy env vars": "none",
        "system proxy": "direct"
      }
    },
    "network.provider_reachability": {
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP"
    },
    "network.websocket_reachability": {
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 2 IPv6, first IPv4",
        "handshake result": "HTTP 101 Switching Protocols"
      }
    },
    "system.environment": {
      "status": "ok",
      "details": {
        "os version": "15.7.4",
        "os type": "Mac OS"
      }
    }
  }
}

What issue are you seeing?

On macOS 15.7.4 with Codex CLI 0.157.1, a fresh interactive codex session selected my custom permission profile with network.enabled = true, but curl -I https://example.com failed with curl: (6) Could not resolve host. Inside that shell, scutil --dns reported “No DNS configuration available.” DNS worked outside Codex, and the same request succeeded through codex exec and codex sandbox -P with the profile. Enabling [features] network_proxy = true made curl work in a fresh interactive session. The Mac uses Tailscale DNS.

What steps can reproduce the bug?

Environment: macOS 15.7.4. codex --version reported 0.157.1; the failed thread metadata and Codex doctor reported app-server 0.158.0. Tailscale DNS was active.

Configuration at the time of failure (network_proxy was unset):

default_permissions = "workspace-net"

[permissions.workspace-net]
extends = ":workspace"

[permissions.workspace-net.network]
enabled = true

[permissions.workspace-net.network.domains]
"*" = "allow"

  1. Start a fresh interactive session with codex -C /path/to/trusted/project.

  2. Ask Codex to run curl -I --max-time 10 https://example.com in its shell.

  3. Observe curl: (6) Could not resolve host: example.com (exit code 6), although the thread’s network permission is enabled.

  4. In the same environment, scutil --dns reported “No DNS configuration available.” DNS and curl worked outside the interactive Codex shell. A codex sandbox -P workspace-net test and a codex exec test also reached the site.

  5. Adding [features] network_proxy = true and starting another fresh interactive session made curl return HTTP 200.

Failed thread IDs: 01a0e787-ddaf-7d31-969a-7ae00f898d16 (standalone curl failure) and 01a0e7a7-87f4-78c2-bf12-27d92beda394 (scutil --dns and curl failure).

What is the expected behavior?

network-enabled interactive sessions can resolve hosts, or Codex explains that its network proxy is required.

Additional information

With Tailscale connected, an interactive Codex shell without network_proxy could not see DNS configuration and curl failed. After disconnecting Tailscale, a fresh interactive session with network_proxy=false and no HTTPS_PROXY returned HTTP 200. With Tailscale connected, a host-level codex -c features.network_proxy=false doctor --json run reported overallStatus: "ok"

Activity

  1. added
    bug
    on Sep 28, 2026
  2. added
    CLI
    sandbox
    connectivity
    on Sep 28, 2026
  3. Kiragu-Maina commented on Sep 29, 2026

    @Kiragu-Maina
    Author

    Update: Root cause is background app-server daemon state poisoning, not Tailscale

    Following up on this report: we investigated further after completely disconnecting Tailscale and observed the exact same failures (curl: (6) Could not resolve host, scutil --dns: No DNS configuration available, id -un: <UID> instead of username, and gh TLS error OSStatus -26276).

    The host macOS environment outside Codex was completely healthy (curl [https://api.github.com](https://api.github.com) returned HTTP 200, id -un resolved correctly, and scutil --dns showed the active DHCP resolver).

    Core Findings

    1. Persistent Daemon Process Inheritance:
    • Interactive sessions (codex, codex resume) delegate tool execution to the shared background daemon (codex app-server --listen unix:// --managed-daemon).
    • If this daemon process encounters file descriptor exhaustion (e.g., Too many open files (os error 24)) or network topology shifts, its Mach bootstrap / XPC IPC handles to macOS system services (opendirectoryd for user accounts, configd for SystemConfiguration DNS, and Security framework for certificates) are permanently broken.
    • All interactive sessions attached to this daemon inherit the broken execution context.
    1. Permission Mode Disconnect:
    • Switching permissions in the TUI/config to "Full Access" or disabling filesystem sandboxing does not fix DNS/identity because the issue is not a Seatbelt file denial—it is the broken parent daemon process spawning the commands.
    1. codex doctor False Positive:
    • codex doctor reports 24 ok · 0 fail because it checks provider endpoints directly and inspects database integrity, but does not validate daemon subprocess IPC health (opendirectoryd or configd readiness).
    1. Workaround / Recovery:
    • Restarting the daemon immediately clears the issue:
    codex app-server daemon restart
    
    • Running with --no-daemon bypasses the stuck daemon and executes in the current terminal's valid session context.

    Suggestions for Codex

    • Add a health-check in codex doctor and daemon startup that verifies subprocess IPC health on macOS (e.g., asserting that getpwuid(getuid()) and SCDynamicStore resolve rather than failing silently).
    • Auto-recycle or notify the user when the background daemon process becomes degraded or orphaned after file descriptor exhaustion.
  4. denhamparry commented on Oct 17, 2026

    @denhamparry

    Same failure here on 0.163.0 (Darwin 25.6.0 arm64, Ghostty 1.3.1, no multiplexer, gpt-6-sol). The trigger was sleep/wake, with no file-descriptor exhaustion. Uploaded thread: 01a14b38-a2cf-7482-bd65-bb0b24f6b2c0.

    Symptoms (session with approval_policy=never, sandbox_policy=danger-full-access):

    scutil --dns   -> No DNS configuration available
    curl           -> curl: (6) Could not resolve host: api.github.com
    git over ssh   -> No user exists for uid 502
    gh auth status -> The token in default is invalid.   (keychain unreachable; token is valid)
    

    Timeline (local time):

    • 09:40: fresh managed daemon started. Tool calls had working DNS (HTTP/2 200 from api.github.com).
    • 15:25: lid-open wake.
    • 15:27: the daemon's own stderr starts logging codex_models_manager: failed to refresh available models: Connection failed. The updater's installer_fetch fails in the same window.
    • 19:04: a new TUI session attached to the same daemon has every lookup failing, as above.
    • codex app-server daemon restart fixed it immediately.

    What it isn't:

    • No Too many open files / os error 24 anywhere in the daemon stderr or logs_2.sqlite for that daemon's lifetime.
    • Not Seatbelt: sandbox_check() returns 0 for the daemon, codex-code-mode-host and the TUI, and log show has no sandbox denials for the failing curl/scutil.
    • Not the host: a normal shell in the same audit session and Ghostty coalition, and an in-process codex exec run at the same moment, resolved DNS and the UID fine.
    • codex doctor reported healthy throughout, because it doesn't exercise the daemon's spawn path.

    Every failing call goes through a Mach service (configd, mDNSResponder, opendirectoryd, securityd), which matches the stale bootstrap/XPC theory above. On this machine sleep/wake is enough to cause it, and it has recurred several times over a few weeks.

    Also, codex app-server daemon restart does not replace the daemon pid-update-loop helper. Ours is still the 09:40 process.

  5. ashrocket commented on Oct 21, 2026

    @ashrocket

    Confirming this on a separate Mac with Codex CLI and managed app-server 0.163.0, macOS 26.7.2 (arm64). In an interactive Codex session, shell commands cannot use the macOS system resolver, while the user reports normal Terminal and Claude Code networking works.

    Reproduction in the Codex tool shell:

    scutil --dns                         -> No DNS configuration available
    dig +short github.com               -> resolves an IPv4 address
    dscacheutil -q host -a name github.com -> no result
    curl -I --max-time 8 https://github.com -> curl: (6) Could not resolve host
    git fetch --prune origin             -> Could not resolve host: github.com
    id -un                               -> 501 (numeric UID, not username)
    

    The Git failure was the same with normal execution and an unsandboxed/escalated retry. HTTP_PROXY, HTTPS_PROXY, ALL_PROXY and lowercase variants were unset. The managed daemon reports running with both CLI and app-server at 0.163.0. I have not restarted the shared daemon because other sessions are active.

    This corroborates the stale daemon/SystemConfiguration and identity-service failure described above; I have not established the trigger on this machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugconnectivitysandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions