codex exec panics on macOS when SCDynamicStoreCreate returns NULL (sandboxed environments)
Bug: codex exec panics on macOS when SCDynamicStoreCreate returns NULL
Environment
- macOS 15.4 (Darwin 25.3.0, arm64)
- codex-cli 0.116.0
- Apple Silicon (aarch64-apple-darwin)
Reproduction
codex exec --full-auto "echo hello"
Error
thread 'main' panicked at system-configuration-0.6.1/src/dynamic_store.rs:154:1:
Attempted to create a NULL object.
Root Cause
codex exec initializes its HTTP client which uses the system-configuration Rust crate (v0.6.1) to read macOS DNS resolver config via SCDynamicStoreCreate. When the calling process cannot connect to configd (e.g., running inside a sandboxed environment that restricts unix socket access), SCDynamicStoreCreate returns NULL, and the crate panics instead of handling it gracefully.
codex --version and codex --help work fine because they do not initialize the HTTP client.
Expected Behavior
Codex should handle SCDynamicStoreCreate returning NULL gracefully — fall back to /etc/resolv.conf or system defaults instead of panicking. This would allow codex to work in sandboxed environments (e.g., when invoked as a subprocess from Claude Code or other tools that apply macOS sandbox profiles).
Workaround
Running codex exec outside the sandbox works fine. The issue only occurs when the process is sandboxed.
Notes
- The panic originates in the
system-configurationcrate (v0.6.1), not in codex code directly - Symbols are stripped in the release binary so backtrace shows only
__mh_execute_header - This may be fixable by upgrading the
system-configurationcrate or by catching the NULL before it panics
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I dug into this and put together a focused fix branch with regression coverage:
690ce13e1What the branch does:
hyper-util0.1.19 -> 0.1.20system-configuration0.6.1 -> 0.7.0MODULE.bazel.locksandbox-execwithcom.apple.SystemConfiguration.configddeniedRoot cause chain:
reqwestsystem proxy support->
hyper-utilclient-proxy-system->
system-configuration->
SCDynamicStoreCreateWithOptions()When a seatbelt profile denies
mach-lookupforcom.apple.SystemConfiguration.configd,SCDynamicStoreCreateWithOptions()returnsNULL.system-configuration 0.6.1wraps thatNULLand panicssystem-configuration 0.7.0adds the missing null check and returnsNonehyper-util 0.1.20handles that safely and skips proxy detection instead of crashingIndependent repro I used against the installed
codex-cli 0.118.0:Observed there:
system-configuration-0.6.1/src/dynamic_store.rs:154101Verification on the branch:
cargo test -p codex-clientpasses in fullcodex-coreintegration coverage in my desktop-thread environment still had unrelated failures, so I did not claim that suite was cleanBecause
docs/contributing.mdsays external PRs are by invitation only, I have not tried to force an unsolicited PR through.If this approach aligns with the intended fix, would the team like me to open an invited PR from the branch above?
Thanks for the bug report. This will be addressed in the next release.