claude-code-router/src
jesieleo daf745ac3f fix(codex-middleware): stop forcing sandbox_mode=workspace-write to avoid repeated COM+ setup failures
When Codex runs through the ccr middleware, every command execution
fails with three repeated Windows error dialogs:

  codex-windows-sandbox-setup.exe
  COM+ 注册表数据库检测到一个系统错误
  (COM+ registry database system error)

Root cause: the middleware's config/read handler hard-coded
`sandbox_mode: "workspace-write"` in the virtual config returned to
Codex (codex-cli-middleware-runtime.ts configRead). Unlike the
`elevated` mode Codex reads from its own config.toml when run directly
(or via tools that only swap config like cc-switch), `workspace-write`
triggers `codex-windows-sandbox-setup.exe` setup refresh on every
command. On systems where the COM+ catalog is unavailable (COMSysApp
stopped or the catalog itself misbehaves — see openai/codex#29332),
that refresh fails and surfaces as the repeated error dialogs.

Empirically verified across the three legal sandbox_mode values:

  - read-only          : does not trigger setup, but cannot write files
  - workspace-write    : triggers setup refresh every command -> fails
                         on affected systems (this bug)
  - danger-full-access : does not trigger setup, can write files, but
                         has no isolation

Forcing workspace-write therefore both overrides the user's own
config.toml preference AND guarantees the failure on affected systems.

Fix: omit sandbox_mode from the virtual config entirely, letting Codex
read it from its own config.toml ([windows] sandbox / sandbox_mode) —
matching the behavior of config-only tools like cc-switch. The user
keeps full control: those who want isolation set workspace-write (and
must ensure their COM+ works); those on affected systems set
danger-full-access.

This is a one-line removal plus an explanatory comment; configValues
was already empty ({}), so Codex now falls back to its config file
exactly as it does without any middleware.

Refs: openai/codex#29332
2026-07-04 18:52:04 +08:00
..
main fix(codex-middleware): stop forcing sandbox_mode=workspace-write to avoid repeated COM+ setup failures 2026-07-04 18:52:04 +08:00
renderer Add TeamoRouter provider preset and docs 2026-07-03 22:53:10 +08:00
server fix(gateway): prevent three crashes from non-ASCII names, client disconnect, and immutable headers 2026-07-04 18:52:03 +08:00
shared Refactor router configuration and expand provider support 2026-07-03 15:11:52 +08:00