Skip to content

node_repl JS kernel fails on macOS with sandbox-exec sandbox_apply Operation not permitted #26262

Open

Description

@Jordak

node_repl JS kernel fails on macOS with sandbox-exec: sandbox_apply: Operation not permitted

Summary

In Codex Desktop on macOS, Browser/Chrome plugin control is unusable because the node_repl MCP server can initialize, but every js tool call fails when the JavaScript kernel is launched through Codex's sandbox wrapper. The same minimal js call succeeds when node_repl is run without CODEX_CLI_PATH or with --disable-sandbox, which points to the sandbox launch path rather than the browser plugins, Chrome, or bundled Node itself.

Environment

  • Platform: macOS 26.5, build 25F71, arm64
  • Codex app bundled CLI: codex-cli 0.136.0-alpha.2
  • Codex app/manual build channel observed in plugin metadata: 26.601.21317
  • node_repl path: /Applications/Codex.app/Contents/Resources/node_repl
  • bundled Node path: /Applications/Codex.app/Contents/Resources/node
  • configured MCP server:
[mcp_servers.node_repl]
command = "/Applications/Codex.app/Contents/Resources/node_repl"
args = []
startup_timeout_sec = 120

[mcp_servers.node_repl.env]
NODE_REPL_NODE_PATH = "/Applications/Codex.app/Contents/Resources/node"
CODEX_CLI_PATH = "/Applications/Codex.app/Contents/Resources/codex"
CODEX_HOME = "/Users/<user>/.codex"
NODE_REPL_TRUSTED_CODE_PATHS = "/Users/<user>/.codex"
BROWSER_USE_AVAILABLE_BACKENDS = "chrome,iab"

User-visible impact

  • mcp__node_repl.js fails even for nodeRepl.write("alive").
  • The in-app Browser and Chrome plugin cannot be controlled, because both depend on node_repl.
  • Restarting Chrome and restarting Codex did not fix it.
  • Chrome-specific health checks pass: Chrome is running, the Codex Chrome Extension is installed/enabled, and the native host manifest is correct.

Minimal repro

This succeeds when CODEX_CLI_PATH is not forcing the sandboxed launch path:

printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"diagnostic","version":"0"}}}' \
  '{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"js","arguments":{"code":"nodeRepl.write(\"alive\")","timeout_ms":30000,"title":"diagnostic"}}}' \
  | /Applications/Codex.app/Contents/Resources/node_repl

Output includes:

"text":"alive"

This fails when the MCP server is run with the same sandbox-related env shape as the configured Codex MCP server:

printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"diagnostic","version":"0"}}}' \
  '{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"js","arguments":{"code":"nodeRepl.write(\"alive\")","timeout_ms":30000,"title":"diagnostic"}}}' \
  | env \
      CODEX_CLI_PATH=/Applications/Codex.app/Contents/Resources/codex \
      NODE_REPL_NODE_PATH=/Applications/Codex.app/Contents/Resources/node \
      CODEX_HOME=/Users/<user>/.codex \
      NODE_REPL_TRUSTED_CODE_PATHS=/Users/<user>/.codex \
      /Applications/Codex.app/Contents/Resources/node_repl

Output:

node_repl kernel exited unexpectedly

node_repl diagnostics: {"kernel_pid":62545,"kernel_status":"exited(code=71)","kernel_stderr_tail":"WARNING: proceeding, even though we could not update PATH: Operation not permitted (os error 1) | sandbox-exec: sandbox_apply: Operation not permitted","reason":"stdout_eof","stream_error":null}

The same command succeeds if --disable-sandbox is added to node_repl, even with CODEX_CLI_PATH present.

Expected behavior

node_repl should be able to launch its JavaScript kernel inside the normal Codex sandbox and run a minimal nodeRepl.write("alive") call. Browser and Chrome plugins should then be able to initialize.

Actual behavior

The MCP server initializes, but the JS kernel exits immediately with:

sandbox-exec: sandbox_apply: Operation not permitted

Diagnostics

codex doctor --json overall status: fail.

Relevant checks:

  • runtime.provenance: ok, macos-aarch64, version 0.136.0-alpha.2
  • sandbox.helpers: ok, filesystem sandbox restricted, network sandbox restricted, approval policy OnRequest
  • mcp.config: ok, one stdio server configured
  • installation: ok, bundled executable /Applications/Codex.app/Contents/Resources/codex
  • system.environment: ok, macOS 26.5
  • network.provider_reachability: fail due DNS/network being unavailable in this sandboxed session
  • terminal.env: fail because this noninteractive diagnostic has TERM=dumb

The network and terminal doctor failures do not appear causative: the minimal node_repl repro fails before any browser/network action, and the direct non-sandboxed node_repl JS call succeeds.

Workaround

Adding --disable-sandbox to the node_repl MCP server args appears to make the minimal JS call succeed, but that weakens isolation for JavaScript tool execution and is not a good default workaround.

Related issues checked

Searched existing issues for:

  • node_repl sandbox-exec sandbox_apply Operation not permitted
  • sandbox_apply Operation not permitted
  • node_repl

Found several Windows node_repl sandbox setup issues, but no exact macOS sandbox_apply match.

Activity

  1. added
    bug
    app
    mcp
    sandbox
    tool-calls
    on Jun 3, 2026
  2. costleya commented on Jun 9, 2026

    @costleya

    I have the same problem after an update I think, and now it only works with full access.

    UPDATE:
    I think I'm silly. Doing it outside a project requires me to give repl/codex access to my whole computer, which I obviously did not do. Doing it inside a project works with no problems.

  3. endgegnerbert-tech commented on Jun 9, 2026

    @endgegnerbert-tech

    The strongest extra signal here is that the minimal js call succeeds until the sandboxed launch path is introduced, which narrows this a lot. I’d test whether the failure is specifically tied to the wrapper path that mutates PATH / sandbox policy before kernel spawn, because the stderr suggests the launch wrapper is already in trouble before node_repl itself gets a fair start.

  4. TyceHerrman commented on Aug 11, 2026

    @TyceHerrman

    made a proposal for different approach to sandboxing in #38028 that would take care of problems encountered in this issue. Endpoint Security's descendants client could avoid this exact nested-Seatbelt failure by enforcing policy over a process subtree

  5. JeongJaeSoon commented on Aug 28, 2026

    @JeongJaeSoon

    I can reproduce this exact failure on a freshly reinstalled current desktop build, including in a project-backed task.

    Environment

    • ChatGPT desktop app: 26.825.32147 (build 7303)
    • Bundled/plugin app-server CLI: codex-cli 0.150.0-alpha.12.2
    • Bundled Node: v24.19.0
    • macOS: 26.5.1 (build 25F80), arm64
    • Browser plugin: 26.825.32147
    • Chrome plugin: 26.825.32147
    • Chrome extension: 1.2.27268.51612_0
    • Task type: local, project-backed, workspace-write/restricted sandbox

    I removed the stale /Applications/Codex.app registration and then reinstalled the ChatGPT desktop app. The active native-host registry now contains only the current /Applications/ChatGPT.app entry (26.825.32147, native-host protocol v2).

    Chrome-specific checks all pass:

    • Chrome is running
    • The extension is installed and enabled in the selected profile
    • The native messaging manifest exists and is correct
    • The manifest points to the current Chrome plugin host
    • There are no active references to /Applications/Codex.app

    However, the managed mcp__node_repl__js path still fails before either Browser or Chrome is selected, even for a minimal nodeRepl.write("alive") call.

    The user-visible result is:

    trusted Node process exited unexpectedly; kernel reset, rerun your request
    

    I then ran the same installed node_repl binary directly over MCP stdio.

    Without CODEX_CLI_PATH, the full initialize -> tools/list -> tools/call(js) sequence succeeds and returns alive.

    With the current CODEX_CLI_PATH set, the MCP server initializes but the first js call fails with:

    kernel_status="exited(code=71)"
    kernel_stderr_kind="macos_sandbox_failed"
    sandbox-exec: sandbox_apply: Operation not permitted
    reason="stdout_eof"
    

    A minimal nested Seatbelt check in the same task also fails:

    $ sandbox-exec -p '(version 1) (allow default)' /usr/bin/true
    sandbox-exec: sandbox_apply: Operation not permitted
    

    This appears to confirm that the installed binaries, browser clients, Chrome extension, and native-host registration are healthy; the failure is specifically the sandboxed kernel launch from an already restricted project task. Reinstalling/restarting does not change it. I did not use --disable-sandbox.

  6. rileyjameson commented on Aug 31, 2026

    @rileyjameson

    Confirming the same macOS failure on a current Codex Desktop build, with evidence that this regressed from a working build on the same machine.

    Current failing environment:

    • Codex Desktop: 26.825.51511 (build 7377)
    • Bundled Codex CLI: 0.151.0-alpha.7.1 when first observed; 0.151.0-alpha.7.2 after fully quitting and restarting
    • macOS 26.5.2, arm64
    • node_repl args: [] (no disable-sandbox workaround enabled)

    Minimal result:

    • Even a one-line nodeRepl.write health check fails before browser selection with: trusted Node process exited unexpectedly; kernel reset
    • Direct JSON-RPC diagnostics report kernel_status exited(code=71), kernel_stderr_kind macos_sandbox_failed, and: sandbox-exec: sandbox_apply: Operation not permitted
    • The same bundled helper succeeds outside the outer workspace sandbox.
    • It also succeeds with the helper disable-sandbox flag, which isolates the failure to the nested sandbox launch path. I restored the normal sandboxed configuration afterward.

    Regression evidence from the same Mac:

    • On 2026-08-30, Browser/Chrome control worked successfully under browser build 26.825.32147 and bundled CLI 0.150.0-alpha.12.2; it listed and inspected live Chrome tabs.
    • Under 26.825.51511 / CLI 0.151.0-alpha.7.x, the helper now exits before it can select Chrome or the in-app browser, inspect authentication, or request any URL.
    • Fully quitting and restarting Codex did not help.
    • codex doctor reports the installed application is consistent and the sandbox configuration is readable.

    This is therefore not specific to Chrome, a browser extension, an authenticated account, or a particular page. It appears to be a regression in the sandboxed node_repl kernel launch path.

    Codex task / correlation ID: 01a05998-3fbb-7f70-9412-7137cee6bc1a

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

    appbrowserbugmcpsandboxtool-calls

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions