[Bug] macOS background sessions inherit stale NetworkExtension flow policy from supervisor process

Open 💬 0 comments Opened Jun 27, 2026 by jxc

Bug Description
Background sessions inherit a broken macOS network flow policy from the supervisor process; restarting the session doesn't clear it.

On macOS, a claude background session (via claude agents / --bg) runs as a child of a long-lived top-level claude supervisor process (parent = launchd). macOS binds NE/NECP network flow policies to a process at launch. If the supervisor was started while a stale NetworkExtension flow policy existed (e.g. from NextDNS or any VPN that was later removed), every background session it spawns inherits the broken policy — Go binaries (kubectl, helm, anything using connectx()) get instant connect: no route to host for LAN destinations, while libc tools (curl, ssh) and regular foreground terminals reach the same host fine.

The trap: /stop + restart of a background session does not fix it, because the session respawns under the same poisoned supervisor — the stale policy lives in the grandparent. Users will burn many cycles restarting the session, the terminal, and DNS settings, none of which help. The only fixes are (a) use a foreground session, or (b) kill the top-level claude supervisor and relaunch from a clean shell.

Requests:

  1. Could background sessions be spawned such that they don't inherit a stale flow policy from a long-running supervisor (e.g. re-fork from a clean context, or detect the connectx/no route to host failure mode and surface targeted guidance)?
  2. At minimum, a diagnostic hint when a Go-binary network call fails with no route to host in a bg session but the host is reachable via libc — pointing at the supervisor-restart fix — would save a lot of thrashing.

Environment: macOS (Darwin 25.x), Claude Code 2.1.195, background session; NextDNS later switched to CLI (no active NE), but neagent still running and SIP-protected (can't be signal-killed).

Environment Info

  • Platform: darwin
  • Terminal: xterm-256color
  • Version: 2.1.195
  • Feedback ID: 6f3668a1-1e71-491f-beb7-0d07d79f6de9

Errors

[]

View original on GitHub ↗