orca icon indicating copy to clipboard operation
orca copied to clipboard

[Bug][Windows] codex-windows-sandbox-setup.exe "The specified module could not be found" when a hosted Claude Code agent invokes Codex (works when Orca runs Codex directly)

Open Cainiaooo opened this issue 4 months ago • 2 comments

Environment

  • Orca: 1.4.123
  • OS: Windows 11 (10.0.26100)
  • Codex CLI: 0.142.5 (npm global @openai/codex, win32-x64)
  • Codex Windows sandbox: [windows] sandbox = "elevated" (default), copied verbatim into Orca's managed CODEX_HOME

Summary

Running Codex directly as an Orca agent (the Codex TUI in a worktree) works fine. But when a Claude Code agent hosted by Orca invokes Codex — e.g. via the OpenAI Codex Claude Code plugin (which runs codex app-server), or a direct codex exec from Claude Code's shell — Windows repeatedly shows:

codex-windows-sandbox-setup.exe — "The specified module could not be found"

It fires on every sandbox setup/refresh, so it pops up many times during a session. Both Codex invocations run under the same Orca managed CODEX_HOME (%APPDATA%\orca\codex-runtime-home\home) with the same copied [windows] sandbox = "elevated" config — the only thing that differs is who spawns Codex.

Repro

  1. Windows 11, Codex 0.142.5, [windows] sandbox = "elevated" (default).
  2. In Orca, run Codex directly as an agent → works, no popup.
  3. In Orca, run a Claude Code agent, and have it invoke Codex (the Codex Claude Code plugin's codex app-server, or codex exec from Claude Code's shell) → repeated codex-windows-sandbox-setup.exe "The specified module could not be found" popups.

What I confirmed (source + logs)

  • The managed CODEX_HOME is separate from ~/.codex (src/main/codex/codex-home-paths.ts → getOrcaManagedCodexHomePath).
  • Orca copies ~/.codex/config.toml verbatim into it (src/main/codex-accounts/service.ts → syncCanonicalConfigIntoManagedHome), so [windows] sandbox = "elevated" is identical to the working direct setup.
  • Orca does not sync the .sandbox state (only skills/hooks/plugins/ plugin-state/profile-v2/themes/prompts — CODEX_SYSTEM_RESOURCE_ENTRIES in codex-home-paths.ts), so the managed home builds a fresh Windows sandbox: its setup_marker.json is created fresh and provisions the online proxy (proxy_ports: [<port>]), whereas the working ~/.codex marker has proxy_ports: [].
  • Codex's own sandbox log for the managed home shows sandbox setup marker missing or incompatible and re-runs setup per command, each logging setup binary completed / errors=[] — i.e. Codex itself does not record a failure; the "module not found" dialog is an OS-level popup.

What I ruled out (with evidence)

  • Not a missing DLL: the same exe works when Orca runs Codex directly and from a standalone shell; no Application Error / SxS load event is logged.
  • Not empty SystemRoot/windir: both are present in the launch environment.
  • Not an ACL gap: codex-runtime-home and its home\ already grant CodexSandboxUsers:(I)(OI)(CI)(RX), identical to the working ~/.codex.
  • Not an Orca env-strip or bad sandbox flag: Orca launches Codex as a plain interactive codex TUI (no --sandbox/approval flags; src/cli/help.ts), via node-pty/ConPTY with the full ...process.env (src/main/providers/local-pty-provider.ts:465-484) and even augments PATH from the registry (src/main/pty/windows-environment-path.ts).

Likely-relevant difference (hypothesis)

The working case (Orca's own Codex agent) runs Codex in a ConPTY with a console. The failing case runs Codex as a nested grandchild: Orca → Claude Code → the Codex plugin, which spawns codex app-server via a plain child_process with piped stdio and windowsHide: true (no ConPTY / no console), inheriting Claude Code's shell environment. Supporting evidence: a plain-shell codex sandbox -- cmd /c echo against the same managed home does not reproduce, while codex exec (full session, which provisions the online/elevated sandbox) does — pointing at the headless/nested + online-elevated sandbox setup path rather than the CODEX_HOME, config, or ACLs (all verified equivalent to a working direct Codex on the same machine).

Ask

When Orca hosts a Claude Code (or other) agent that itself invokes Codex under the managed CODEX_HOME, Codex's elevated Windows sandbox setup fails with the module popup, while Orca's own Codex agent works. Is nested/headless Codex under the managed home expected to work on Windows? Would seeding/sharing the .sandbox state from ~/.codex into the managed home, or pinning offline sandbox for managed homes on Windows, be appropriate — or is this better addressed on the Codex side (elevated sandbox setup under a console-less / nested process)? A Process Monitor capture of the failing codex-windows-sandbox-setup.exe launch is available on request.

Cainiaooo avatar Jul 06 '26 09:07 Cainiaooo

Agent reproduction package (Windows orchestration 2026-07-16)

Host context: Windows 11 / Orca 1.4.143.0 / repo path used: docs/bug-reproductions/
Labels applied: see issue labels (has_repro or cannot_repro).
Security: Do not run user-uploaded binaries from issue attachments. Recreate fixtures from the steps/scripts below.


Issue 7555 — codex-windows-sandbox-setup.exe “module not found” (nested Claude → Codex)

Status: needs_setup
Host: Windows 11, Orca 1.4.143, Codex CLI 0.144.4
Label: (none — not conclusive full repro)

Summary

Reporter: Codex as an Orca agent works; when a Claude Code agent hosted by Orca invokes Codex (codex app-server / codex exec) under the same managed CODEX_HOME, Windows repeatedly shows:

codex-windows-sandbox-setup.exe — "The specified module could not be found"

Hypothesis: elevated/online sandbox setup under headless / no-console nested spawn (Claude → child_process, windowsHide: true) vs Orca’s own ConPTY Codex TUI.

What we confirmed on this host

Check Result
codex-windows-sandbox-setup.exe present Yes — under @openai/codex-win32-x64 vendor resources
Managed CODEX_HOME %APPDATA%\orca\codex-runtime-home\home
System ~/.codex/.sandbox Present
Managed …/home/.sandbox Missing
[windows] sandbox (managed + system) unelevated (not elevated)
CODEX_SYSTEM_RESOURCE_ENTRIES skills/hooks/plugins/… — no .sandbox (src/main/codex/codex-home-paths.ts)
Claude on PATH Yes (claude.exe)

So the resource-sync gap (.sandbox not mirrored into managed home) is real. The full elevated popup was not reproduced because this machine does not use sandbox = "elevated".

Repro (another agent)

Probe only (safe, no elevated GUI storm):

cd <repo>
powershell -NoProfile -ExecutionPolicy Bypass -File docs/bug-reproductions/scripts/repro-7555-sandbox-setup.ps1
# exit 3 = setup gap confirmed; exit 2 = no gap

Full popup (needs setup)

  1. Set [windows] sandbox = "elevated" in system Codex config and let Orca sync into managed home (or write managed config carefully).
  2. In Orca: Claude Code agent → invoke Codex plugin / codex exec (not Orca’s native Codex TUI).
  3. Observe repeated codex-windows-sandbox-setup.exe module-not-found dialogs.
  4. Compare Process Monitor capture of setup exe under ConPTY vs nested headless spawn.

Do not download/run user-attached binaries from the issue.

Expected vs actual

Expected Nested Codex under managed CODEX_HOME provisions sandbox without OS error dialogs (or matches direct Orca Codex behavior)
Actual (reporter) Module-not-found popup on every sandbox refresh when nested; direct Orca Codex OK
Actual (this host) Cannot trigger elevated path; confirmed missing managed .sandbox + no sync of sandbox state

Evidence

  • docs/bug-reproductions/evidence/7555-20260716-022947-meta.json
  • docs/bug-reproductions/evidence/7555-sandbox-exe-search.txt
  • docs/bug-reproductions/evidence/7555-codex-sandbox-help.txt

Next steps

  1. Reproduce on a host with sandbox = "elevated" (or temporarily elevate managed config in an isolated CODEX_HOME).
  2. Capture ProcMon for missing DLL / delay-load under headless spawn.
  3. Product options: seed/share .sandbox from system home; pin offline/unelevated for managed homes; or fix Codex elevated setup without a console.

Repro script: repro-7555-sandbox-setup.ps1

# Repro #7555: probe nested Codex sandbox setup under Orca managed CODEX_HOME
# Usage: powershell -NoProfile -ExecutionPolicy Bypass -File docs/bug-reproductions/scripts/repro-7555-sandbox-setup.ps1
$ErrorActionPreference = "Continue"
$repo = Resolve-Path (Join-Path $PSScriptRoot "..\..\..")
$evDir = Join-Path $repo "docs\bug-reproductions\evidence"
New-Item -ItemType Directory -Path $evDir -Force | Out-Null
$stamp = Get-Date -Format "yyyyMMdd-HHmmss"

$managed = Join-Path $env:APPDATA "orca\codex-runtime-home\home"
$system = Join-Path $env:USERPROFILE ".codex"
$exeCandidates = @(
  (Join-Path $env:APPDATA "npm\node_modules\@openai\codex\node_modules\@openai\codex-win32-x64\vendor\x86_64-pc-windows-msvc\codex-resources\codex-windows-sandbox-setup.exe")
)
$exe = $exeCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1

function Get-SandboxSetting([string]$cfg) {
  if (-not (Test-Path $cfg)) { return $null }
  $text = Get-Content $cfg -Raw
  if ($text -match '(?m)^\s*sandbox\s*=\s*"([^"]+)"') { return $Matches[1] }
  return $null
}

$meta = @{
  issue = 7555
  stamp = $stamp
  managedHome = $managed
  systemHome = $system
  managedSandboxDir = (Test-Path (Join-Path $managed ".sandbox"))
  systemSandboxDir = (Test-Path (Join-Path $system ".sandbox"))
  managedSandboxSetting = Get-SandboxSetting (Join-Path $managed "config.toml")
  systemSandboxSetting = Get-SandboxSetting (Join-Path $system "config.toml")
  sandboxSetupExe = $exe
  sandboxSetupExeExists = [bool]$exe
  claudeOnPath = [bool](Get-Command claude -ErrorAction SilentlyContinue)
  codexVersion = ((& codex --version) 2>$null | Out-String).Trim()
  resourceEntriesOmitSandbox = $true
  notes = "Full module-not-found popup needs sandbox=elevated + nested Claude->Codex headless spawn. This probe only documents state sync gap."
  bugReproduced = $false
  setupGapConfirmed = (-not (Test-Path (Join-Path $managed ".sandbox"))) -and (Test-Path (Join-Path $system ".sandbox"))
}
$path = Join-Path $evDir "7555-$stamp-meta.json"
$meta | ConvertTo-Json -Depth 5 | Set-Content $path -Encoding utf8
Write-Host ($meta | ConvertTo-Json -Depth 5)
if ($meta.setupGapConfirmed) { exit 3 } else { exit 2 }


How another agent should use this

  1. Read this comment fully (status, expected vs actual, blockers).
  2. If a script is included above, copy it to a temp file and run it on a Windows 11 host with Orca installed (prefer production install under %LOCALAPPDATA%\Programs\orca).
  3. Capture evidence (CLI --json, screenshots, logs) under a local folder; optionally comment results back here.
  4. If status is cannot_repro / needs_setup, satisfy the listed prerequisites first, then re-attempt and flip labels: remove cannot_repro, add has_repro when conclusive.

OrcaWin avatar Jul 17 '26 00:07 OrcaWin

Third distinct failure variant on Windows, same component — the sandbox setup helper launch fails with error 1223 (ERROR_CANCELLED) instead of ERROR_FILE_NOT_FOUND (#11874) or ERROR_MOD_NOT_FOUND (#7555).

Environment

  • Orca 1.4.176
  • Windows, PowerShell 5.1
  • Codex 0.146.1 (0.147.0 update available)
  • UAC: EnableLUA=1, ConsentPromptBehaviorAdmin=5, PromptOnSecureDesktop=1
  • Triggered via orca orchestration worker-start --agent codex (orchestration worker), then any shell tool call

Symptoms

Every command the codex worker runs fails before execution with:

windows sandbox: orchestrator_helper_launch_canceled: ShellExecuteExW failed to launch setup helper: 1223

File-edit tools still work — only command execution is blocked. This also blocks the worker from sending worker_done (that's a shell command too), so the dispatch never settles and the coordinator must manually settle the task.

Log evidence

%APPDATA%\orca\codex-runtime-home\home\.sandbox\sandbox.2026-08-08.log shows the same line for every command attempt:

[codex.exe] sandbox setup required: sandbox setup marker missing or incompatible

The helper binaries are present:

  • home\plugins\.plugin-appserver\codex-windows-sandbox-setup.exe
  • home\.sandbox-bin\codex.exe (fs-helper, 358 MB, written on first launch)

.sandbox_migration contains only v1. Setup never completes, so the marker is never written and every command retries setup.

Hypothesis

Like #7555, the managed home starts from a fresh .sandbox (Orca doesn't sync the existing .sandbox state from ~/.codex). Since the elevated sandbox setup needs to elevate the helper via ShellExecuteExW and Windows cancels it (1223), this looks like the UAC elevation path being auto-canceled for the console-less/nested launch context — the helper exists and is reachable, so neither the #11874 nor #7555 mechanism applies.

Happy to provide a Process Monitor capture of the failing codex-windows-sandbox-setup.exe launch or any other diagnostics.

Flamingpuffins avatar Aug 08 '26 09:08 Flamingpuffins