Windows elevated sandbox loses logon session (CreateProcessAsUserW error 1312), causing repeated retries and excessive quota usage

Open
#34,575 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust

Research direction

Start at the Windows elevated sandbox SpawnChild path that calls CreateProcessAsUserW, using the reported error 1312 as the failure case. Trace how repeated failures and permission-reviewer timeouts are handled. Done means the sandbox reports an unrecoverable failure after bounded retries, recommends restarting or switching to unelevated mode, and preserves the task without continued retries.

Written by the indexing model from the issue text.

Description

app bug rate-limits sandbox tool-calls windows-os
What version of the Codex App are you using (From “About Codex” dialog)?

Codex App 26.715.7063.0 (ARM64).

What subscription do you have?

MAX 20X

What platform is your computer?

Microsoft Windows 11 25H2, build 26200 (10.0.26200.0), ARM64 — Snapdragon X Elite.

What issue are you seeing?

Feedback ID: 019f7f4b-a2df-7161-ad82-493ea7363e35

Description

A long-running local coding task remained active for approximately nine hours. After several hours of tool calls and native validation, the Windows elevated sandbox stopped being able to start processes.

Even a trivial PowerShell command failed before PowerShell was launched. The same commands worked when executed outside the sandbox with elevated permission, and the Codex App itself remained responsive.

The active configuration was:

[windows]
sandbox = "elevated"

The exact error was:

windows sandbox: runner failed during SpawnChild:
CreateProcessAsUserW failed: 1312
(A sessão de logon especificada não existe. Talvez ela já tenha sido finalizada.)

English translation:

The specified logon session does not exist. It may already have been terminated.

The local CodexSandboxOffline and CodexSandboxOnline accounts still existed and were enabled. Therefore, this appears to be a stale or invalid logon session/token rather than a missing sandbox account.

After the failure started, Codex repeatedly attempted to recover by launching commands again or requesting elevated execution. Some recovery attempts then failed with messages such as:

automatic permission reviewer expired

and:

command timed out
Exit code: 124

Codex did not recognize that the sandbox session was no longer recoverable. Because a persistent goal was active and I had asked the agent to continue monitoring the work, the task remained in error/retry cycles for hours and consumed nearly all of my weekly quota.

While using Codex with elevated mode (enabled by OpenAI's own build), the agent entered a prolonged failure state that consumed almost my entire weekly usage window.

What happened
  • The agent repeatedly froze due to internal errors.
  • The agent itself reported problems within Codex during the session.
  • Instead of failing fast, it spent approximately 9 hours applying workaround actions to patch its own errors, burning through my quota the entire time.
Expected behavior
  • Errors originating from the Codex build/infrastructure should not consume user quota, or at minimum the agent should halt instead of looping on self-remediation for hours.
What steps can reproduce the bug?

Feedback ID: 019f7f4b-a2df-7161-ad82-493ea7363e35

What is the expected behavior?

Codex should detect the repeated CreateProcessAsUserW error 1312 as an unrecoverable sandbox failure, stop retrying after a limited number of attempts, and display a clear message recommending that the user restart the app or switch temporarily to the unelevated sandbox.

It should preserve the task and worktree state and avoid consuming additional quota by repeatedly reasoning about and retrying the same infrastructure error.

Additional information

No response

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.