Skip to content

Windows Codex Node REPL MCP fails with windows sandbox failed: spawn setup refresh, breaking spreadsheet artifact runtime #26419

Open

Description

@graemeh

Summary

On Windows Codex Desktop, the Node REPL MCP server is exposed but fails even on a minimal smoke test. This prevents spreadsheet artifact workflows that expect the Node REPL / @oai/artifact-tool path from working, and forces fallback to local Python workbook generation.

Environment

  • Platform: Windows / PowerShell
  • Codex Desktop version observed: OpenAI.Codex_26.601.2237.0_x64
  • Codex command runner observed: codex-command-runner-0.136.0-alpha.2.exe
  • Node REPL executable configured under %LOCALAPPDATA%\OpenAI\Codex\bin\...\node_repl.exe
  • Node configured for Node REPL under %LOCALAPPDATA%\OpenAI\Codex\bin\...\node.exe
  • Primary-runtime Spreadsheets plugin enabled
  • Curated remote Data Analytics, Investment Banking, and Public Equity Investing skills also installed/enabled in the cache

Relevant config shape:

[features]
memories = true
js_repl = false

[mcp_servers.node_repl]
args = []
command = '<LOCALAPPDATA>\\OpenAI\\Codex\\bin\\<hash>\\node_repl.exe'
startup_timeout_sec = 120

[mcp_servers.node_repl.env]
NODE_REPL_NATIVE_PIPE_CONNECT_TIMEOUT_MS = "1000"
NODE_REPL_NODE_MODULE_DIRS = ""
NODE_REPL_NODE_PATH = '<LOCALAPPDATA>\\OpenAI\\Codex\\bin\\<hash>\\node.exe'
NODE_REPL_TRUSTED_CODE_PATHS = '<CODEX_HOME>'
CODEX_HOME = '<CODEX_HOME>'

Reproduction

  1. Start a Codex session on Windows.
  2. Use/discover the Node REPL MCP tools.
  3. Run js_reset.
  4. Run a minimal JS smoke test:
nodeRepl.write(JSON.stringify({ cwd: nodeRepl.cwd, tmpDir: nodeRepl.tmpDir }));

Actual result

The Node REPL kernel exits unexpectedly:

node_repl kernel exited unexpectedly

node_repl diagnostics: {"kernel_pid":18780,"kernel_status":"running","kernel_stderr_tail":"windows sandbox failed: spawn setup refresh","reason":"stdout_eof","stream_error":null}

Attempting an import has the same failure:

try {
  var mod = await import('@oai/artifact-tool');
  nodeRepl.write(JSON.stringify({available:true, keys:Object.keys(mod).slice(0,10)}));
} catch (e) {
  nodeRepl.write(JSON.stringify({available:false, error:String(e)}));
}

Result:

node_repl kernel exited unexpectedly

node_repl diagnostics: {"kernel_pid":39180,"kernel_status":"running","kernel_stderr_tail":"windows sandbox failed: spawn setup refresh","reason":"stdout_eof","stream_error":null}

After stopping a stale node_repl.exe process, js_reset failed with:

tool call error: tool call failed for `node_repl/js_reset`

Caused by:
    Transport closed

Expected result

The minimal smoke test should execute and return JSON. Spreadsheet artifact workflows should be able to use the documented Node REPL / @oai/artifact-tool workflow, or the runtime dependency path should be exposed clearly.

Additional observations

  • The primary-runtime Spreadsheets plugin exists but appears to contain skills/assets only, not an obvious node_modules directory or @oai/artifact-tool package.
  • NODE_REPL_NODE_MODULE_DIRS is empty in the Node REPL MCP environment.
  • A separate Data Analytics spreadsheets skill exists in the curated remote plugin cache.
  • Investment Banking and Public Equity Investing plugins include workbook-related scripts/templates. These may add routing ambiguity, but the Node REPL crash appears independent because even the minimal smoke test fails.
  • Local memory/history in this environment showed the same windows sandbox failed: spawn setup refresh failure before the current workbook task, suggesting this is not caused solely by the newest skills.

User impact

  • Documented spreadsheet artifact runtime cannot be used.
  • Spreadsheet tasks fall back to ad hoc Python/local package workflows.
  • One workaround attempt produced a hand-built XLSX package that Excel refused to open as corrupt.
  • A valid workbook was later generated only after installing openpyxl locally into the workspace.

Questions / suggested investigation

  1. Why does Node REPL fail on a minimal smoke test with windows sandbox failed: spawn setup refresh?
  2. Why does killing a stale node_repl.exe leave the MCP transport closed rather than respawning cleanly?
  3. Should [features].js_repl = false coexist with an exposed node_repl MCP server/tool?
  4. Should NODE_REPL_NODE_MODULE_DIRS be empty when spreadsheet skills instruct agents to use @oai/artifact-tool?
  5. Should @oai/artifact-tool be present in the primary-runtime plugin cache, or resolved through another dependency loader that is not currently exposed?
  6. Could multiple spreadsheet/workbook-oriented skills from primary-runtime, Data Analytics, Investment Banking, and Public Equity Investing create routing ambiguity for workbook tasks?

Activity

  1. added
    bug
    app
    windows-os
    mcp
    sandbox
    tool-calls
    on Jun 4, 2026
  2. graemeh commented on Jun 7, 2026

    @graemeh
    Author

    Update with a tested workaround, based on the observation from @eliotcougar in #26530 that Codex CLI 0.137.0 ships a codex-windows-sandbox-setup.exe helper containing an asInvoker manifest while the Windows Desktop App cached/bundled helper did not.

    On the affected Windows Desktop App install, I verified:

    • @openai/[email protected] installed via npm reports codex-cli 0.137.0.
    • The npm CLI helper binary contains asInvoker.
    • The Desktop App cached helper binary did not contain asInvoker.
    • After replacing the Desktop App cached codex-windows-sandbox-setup.exe with the npm CLI 0.137.0 helper, the original windows sandbox failed: spawn setup refresh failure no longer appeared.

    There was one additional failure after that first helper swap: node_repl then failed with an EPERM while trying to lstat the user AppData directory through the Desktop App cached Node path. Pointing NODE_REPL_NODE_PATH at a normal installed Node executable outside the Desktop AppData cache resolved that second failure.

    After applying both changes, actual node_repl JavaScript execution worked again. After adding the primary runtime node_modules directory to NODE_REPL_NODE_MODULE_DIRS, both of these imports also worked:

    await import("@oai/artifact-tool")
    await import("@oai/artifact-tool/presentation-jsx")
    

    The important caveat: the workaround did not persist across a Codex Desktop restart. After restart, Desktop regenerated/reverted:

    • CODEX_CLI_PATH back to the Desktop AppData cached codex.exe
    • NODE_REPL_NODE_PATH back to the Desktop AppData cached node.exe
    • NODE_REPL_NODE_MODULE_DIRS back to empty
    • the Desktop App cached codex-windows-sandbox-setup.exe back to the non-asInvoker helper

    Reapplying the workaround after restart restored node_repl and the artifact-tool imports again.

    Sanitized workaround shape:

    1. Install/update npm Codex CLI to 0.137.0.
    2. Use the npm CLI 0.137.0 codex-windows-sandbox-setup.exe helper in place of the Desktop App cached helper.
    3. Set CODEX_CLI_PATH to the npm CLI 0.137.0 codex.exe.
    4. Set NODE_REPL_NODE_PATH to a regular installed Node executable outside the Desktop AppData runtime cache.
    5. If primary runtime imports are needed, set NODE_REPL_NODE_MODULE_DIRS to the primary runtime dependency node_modules directory.

    This makes me think the CLI-side fix is real, but the Windows Desktop App still needs to bundle/regenerate the updated helper and preserve/generate a working node_repl env after restart.

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

    appbugmcpsandboxtool-callswindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions