app-server: silent exit 0 mid-turn immediately after a shell tool call, in read-only sandbox (macOS)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Summary
codex app-server reliably exits mid-turn with exit code 0, no signal, no stderr as soon as the model issues 1-2 shell tool calls during a read-only sandbox turn. No turn/completed notification, no error notification, no crash — the child process just terminates cleanly and the JSON-RPC client is left with a turn that will never resolve.
Reproduced 8/8 times across:
- A CLI upgrade (0.142.5 → 0.149.0)
- A clean uninstall + reinstall of
@openai/codex(ruling out a corrupted install)
Environment
codex-cli 0.149.0(@openai/codexnpm package, installed globally)- macOS (Darwin), Apple Silicon
codex app-serverinvoked as a long-lived detached child process, driven over stdin/stdout JSON-RPC (initialize→thread/start→turn/start), via a third-party wrapper (a Claude Code plugin) — same architecture described in #21813 and #21937.
Repro sequence
initialize, thenthread/startwithsandbox: "read-only",approvalPolicy: "never".turn/startwith a prompt that requires reading a large file and reasoning over it.- Server emits
turn/startedcorrectly. - Model issues 1-2 shell tool calls (e.g.
rg -n ...,sed -n '149,230p' <file>). Both are reported as completed successfully (item/completed, exit 0) via notifications. - Immediately after the second tool call's
item/completed, thecodex app-serverprocess itself exits —exit code 0,signal: null, stderr empty. Noturn/completed, noerrornotification ever arrives. - A trivial prompt with zero tool calls ("reply with exactly X") completes successfully every time on the same setup. Only turns where the model makes a shell tool call while in
read-onlysandbox mode reproduce this.
What I checked
- Not a Node version issue on the client side — same client code, same failure, across two
codexCLI versions. - Not a corrupted/stale global install — clean
npm uninstall -g @openai/codex+npm install -g @openai/codex@latestreproduces identically. - Not a client-side hang — I instrumented the JSON-RPC client with a watchdog + proper
exit-event wiring; it now correctly observes the app-server process exiting (code 0, no signal) rather than hanging forever waiting on a promise that was never rejected. - Tried isolating to detached vs. foreground invocation shape; the two closest existing reports (#21813, #21937) both involve
app-serverspawned as a detached background child by a wrapper, same as this setup, which may be a relevant common factor.
Possibly related
- #21937 — closest symptom match: worker silent death after a parallel-command burst,
Turn completednever fires (Linux/WSL2). - #21813 — detached task-worker exits without writing failed status on broker socket disconnect — same detached-wrapper architecture.
- #26533 — app-server stdout hits EOF mid-turn while the process stays alive (Windows) — different trigger (prompt content vs. tool calls), same "no terminal event, ever" shape.
- #18243 — macOS-specific: shell execution silently fails in
workspace-write/read-onlysandbox via the siblingmcp-servertransport;danger-full-accessavoids it. As a workaround, switching this setup's sandbox fromread-onlytodanger-full-accessalso avoids the silent exit here, which points at the sandbox subsystem (Seatbelt on macOS) as a plausible common cause across all of these reports, though I have no direct evidence of why it kills the parent process rather than just the sandboxed child.
Expected behavior
Either the turn completes normally, or the app-server surfaces a real error notification / non-zero exit / signal when something goes wrong — not a silent, clean exit 0 mid-turn with no diagnostic of any kind.
Workaround in use
Forcing sandbox: "danger-full-access" instead of read-only avoids the silent exit in this setup. Not a real fix — it gives up the read-only guarantee entirely just to get turns to complete.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the initialize, thread/start, and turn/start JSON-RPC sequence with sandbox set to read-only, then inspect the codex app-server path handling shell tool completion and process exits on macOS. Compare the behavior with danger-full-access and verify that a failing turn emits turn/completed or error rather than ending with a clean exit 0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, rust, shell
- Domain
- backend-api-design, operating-systems, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100