Skip to content

Fix Windows pseudoconsole attribute handling for sandboxed PTY sessions#20042

Merged
jif-oai merged 2 commits intomainfrom
codex/windows-pseudoconsole-attribute-handle
Apr 29, 2026
Merged

Fix Windows pseudoconsole attribute handling for sandboxed PTY sessions#20042
jif-oai merged 2 commits intomainfrom
codex/windows-pseudoconsole-attribute-handle

Conversation

@iceweasel-oai
Copy link
Copy Markdown
Collaborator

@iceweasel-oai iceweasel-oai commented Apr 28, 2026

Summary

Fix the Windows sandbox PTY spawn path to pass the pseudoconsole handle value directly into UpdateProcThreadAttribute.

Why

Sandboxed unified_exec PTY sessions on Windows were failing during child process startup with 0xc0000142 (STATUS_DLL_INIT_FAILED). In practice this showed up as PowerShell DLL init popups when the sandboxed background-terminal path tried to launch an interactive shell.

The root cause was that we were passing a pointer to a local isize variable instead of the pseudoconsole handle value in the form Windows expects for PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE.

Validation

  • cargo build -p codex-windows-sandbox --bins
  • Reproduced the real sandboxed codex exec flow with windows.sandbox_private_desktop=true
  • Verified a tty=true interactive session launched through the normal PowerShell wrapper, printed READY, accepted follow-up stdin, and exited cleanly
  • Confirmed no new 0xc0000142 / Application Popup events appeared after the successful repro

@iceweasel-oai iceweasel-oai requested a review from jif-oai April 28, 2026 17:42
@iceweasel-oai iceweasel-oai changed the title [codex] Fix Windows pseudoconsole attribute handling for sandboxed PTY sessions Fix Windows pseudoconsole attribute handling for sandboxed PTY sessions Apr 28, 2026
@iceweasel-oai iceweasel-oai marked this pull request as ready for review April 28, 2026 17:43
@iceweasel-oai iceweasel-oai force-pushed the codex/windows-pseudoconsole-attribute-handle branch from c589b1c to 00e6a07 Compare April 28, 2026 18:54
@jif-oai jif-oai merged commit 5cac3f8 into main Apr 29, 2026
25 checks passed
@jif-oai jif-oai deleted the codex/windows-pseudoconsole-attribute-handle branch April 29, 2026 09:59
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants