The first `codex --yolo` in a terminal had macOS say magpie wanted files
in the Desktop folder. magpie keeps Codex's managed app-server daemon
current (KeepCodexDaemonCurrent restarts it with `codex app-server daemon
restart` when no session is attached). On macOS a process is the TCC
"responsible process" of whoever started it, so the daemon that restart
leaves running answered to magpie. Every codex run in a terminal attaches
to that daemon, which works in the run's folder, so ~/Desktop was asked
for under magpie's name.
proc.CombinedOutputOwn runs a command through posix_spawn with
responsibility_spawnattrs_setdisclaim (looked up with dlsym, as it has no
header), so the command and what it leaves running answer for themselves.
Only stdio is passed on, stdin is /dev/null, signals are reset, and the
context's end kills it as CommandContext would. restartCodexDaemon uses it.
Elsewhere, and in a build without cgo (the CLI), it is cmd.CombinedOutput.
Run (darwin/arm64, Go 1.26.8, at f51ab771f + this):
- go test -count=1 ./internal/proc/: ok (TestCombinedOutputOwnAnswersForItself,
TestCombinedOutputOwnRuns, TestCombinedOutputOwnContext)
- go test -count=1 ./internal/provider/: ok with
-skip TestUnreadLoginsWriteErrorsKeepCredentials; that test crashes with
"close of synctest channel from outside bubble" in filememo.Forget on
main too, which is #3632 (open, a patch is under review there)
- gofmt -l clean; go vet for darwin, linux and windows on proc and provider;
CGO_ENABLED=0 -tags nogui build, the GUI build, linux nogui and windows
builds
Broken by hand:
- the disclaim call turned off: TestCombinedOutputOwnAnswersForItself red
("the sleep answers to 2201, this process to 2201")
- restartCodexDaemon back on cmd.CombinedOutput:
TestRestartedCodexDaemonIsNotMagpies red ("the daemon answers to 2201,
magpie to 2201")
Not tried: a real TCC prompt (the tests check the responsible pid macOS
reports, which is what the prompt names; it can't be shown in a sandbox).
The CLI build, without cgo, still starts the daemon as its own child; it
is the GUI that keeps the daemon current for most users.