[Windows] Node REPL MCP kernel fails: "spawn setup refresh" os error 740

Resolved 💬 2 comments Opened Jun 7, 2026 by alextavish Closed Jun 12, 2026

Bug Report: Node REPL MCP "spawn setup refresh" failure on Windows

Environment

  • Codex: 26.602.4764.0 (Windows Store)
  • OS: Windows 10.0.26200
  • Sandbox mode: workspace-write

Error

mcp__node_repl__js 调用始终返回:
"node_repl kernel exited unexpectedly: windows sandbox failed: spawn setup refresh"

Root Cause

沙箱存在版本分裂。Shell 命令使用 payload_len=3204 (新版) 映射到 WindowsApps 路径正常工作,
但 Node REPL MCP kernel 使用 payload_len=3096 (旧版) 映射到:
C:\Users\NJZ\AppData\Local\OpenAI\Codex\bin\fb2111b91430cb17\codex-windows-sandbox-setup.exe
spawn 时报 os error 740 (ERROR_ELEVATION_REQUIRED)。

Sandbox Log Evidence

[2026-06-07 18:40:25.709] START: node.exe --experimental-vm-modules ...\kernel.js
[2026-06-07 18:40:25.746] setup refresh: spawning ...\fb2111b91430cb17\codex-windows-sandbox-setup.exe
(cwd=C:\Users\NJZ\Documents\Codex, payload_len=3096)
[2026-06-07 18:40:25.748] setup refresh: failed to spawn: os error 740

对比 Shell 命令 (正常):
[2026-06-07 18:36:51.224] setup refresh: spawning ...\WindowsApps\...\resources\codex-windows-sandbox-setup.exe
(cwd=C:\Program Files\WindowsApps\...\app, payload_len=3204)
[2026-06-07T10:36:51.240] setup refresh: processed 3 write roots; SUCCESS

Attempted Fixes (all failed)

  1. 删除 fb2111b91430cb17 目录 — 重启 Codex 后自动重建
  2. 替换 codex-windows-sandbox-setup.exe 为 WindowsApps 版本 — 相同 error 740
  3. 杀掉旧版 codex.exe 进程 — 问题依旧
  4. 完全重启 Codex — 问题依旧

Key Observation

node_repl.exe (34ab3e1324cc55b5) 内嵌的沙箱集成使用 payload 3096,
而 codex.exe 主进程使用 payload 3204。两个 payload 版本映射不同 setup 路径。

Workaround

通过 shell_command + node -e 执行 JS 代码正常可用。

Sandbox Log

完整日志: C:\Users\NJZ\.codex\.sandbox\sandbox.2026-06-07.log

日志证据

失败模式 (每次 kernel.js 启动)

START: node.exe ...\kernel.js --session-id 5b245c34...
setup refresh: spawning ...\fb2111b91430cb17\codex-windows-sandbox-setup.exe
    (cwd=C:\Users\NJZ\Documents\Codex, payload_len=3096)
setup refresh: FAILED 请求的操作需要提升。 (os error 740)

共出现 11 次,100% 失败。

成功模式 (Shell 命令)

setup refresh: spawning ...\WindowsApps\...\resources\codex-windows-sandbox-setup.exe
    (cwd=C:\Program Files\WindowsApps\...\app, payload_len=3204)
setup refresh: processed 3 write roots (read roots delegated); errors=[]
setup binary completed

关键差异

| 项目 | Kernel (失败) | Shell (成功) |
|------|--------------|-------------|
| payload_len | 3096 | 3204 |
| cwd | Documents\Codex | WindowsApps\app |
| setup 路径 | fb2111b91430cb17\ | WindowsApps\resources\ |
| 错误 | os error 740 (提权) | 无 |

已尝试的修复 (全部无效)

  1. 删除 fb2111b91430cb17 目录 → 重启后重建
  2. 替换 setup.exe 为 WindowsApps 版本 → 同样 error 740
  3. 杀掉旧版 codex.exe 进程 (PID 34276/25868) → 问题依旧
  4. 完全退出并重启 Codex → 目录和问题均重现
  5. 尝试硬链接 → WindowsApps 安全限制拒绝访问

临时替代方案

通过 shell_command + node -e 执行 JS,完全正常。

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗