codex icon indicating copy to clipboard operation
codex copied to clipboard

Improve error handling for Windows sandbox initialization

Open anant2526 opened this issue 1 month ago • 5 comments

  1. Identify the Root Cause I analyzed the codex-rs/windows-sandbox-rs crate, specifically how it handles file permissions (ACLs) for the sandboxed environment.

The Bug: In src/lib.rs, the system was identifying which file paths strictly needed read or write access. It then attempted to grant these permissions using add_allow_ace. However, it was silently ignoring any errors during this process. The Consequence: If the system failed to grant the necessary permissions (e.g., due to file locking or OS restrictions), it would proceed anyway. This meant the sandboxed process would start without the rights it needed, leading to "access denied" errors, retries, hangs, and the "sluggish" behavior users reported. 2. Implement the Fix I modified codex-rs/windows-sandbox-rs/src/lib.rs to correctly handle these errors.

Stop Silent Failures: I replaced the if let Ok(...) checks with proper match statements. Error Propagation: If granting permissions (add_allow_ace) or blocking access (add_deny_write_ace) fails, the function now immediately returns an error. Improved Logging: I added log_failure calls to record exactly which file path caused the permission error.

anant2526 avatar Dec 13 '25 20:12 anant2526

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

github-actions[bot] avatar Dec 13 '25 20:12 github-actions[bot]

Thanks for the contribution. Please look at the code review feedback from codex. You'll also need to sign the CLA and fix the CI failures.

etraut-openai avatar Dec 13 '25 21:12 etraut-openai

I have read the CLA Document and I hereby sign the CLA

anant2526 avatar Dec 14 '25 14:12 anant2526

@anant2526, there are still some lint failures. Looks like a simple formatting issue.

etraut-openai avatar Dec 14 '25 17:12 etraut-openai

@anant2526, there are still formatting issues. Run just fmt locally to auto-format the code. There's also an "unused import" lint failure. Run cargo clippy locally to check for any additional lint failures.

etraut-openai avatar Dec 14 '25 20:12 etraut-openai

Closed due to lack of response from contributor.

etraut-openai avatar Dec 25 '25 16:12 etraut-openai