Critical: Unexpected file deletion on Windows 11 (D: drive) during execution.
What version of Codex CLI is running?
codex-cli 0.114.0
What subscription do you have?
team
Which model were you using?
gpt-5.4
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What terminal emulator and version are you using (if applicable)?
VSCode
What issue are you seeing?
Critical data loss caused by autonomous execution of destructive commands under Default Permissions.
AGENTS.MD:
Engineering Rules
- Prefer simple, shippable implementation over broad framework expansion.
- Make all async states explicit (loading/success/error/empty).
- Keep contracts explicit: units, defaults, optional vs required.
- Surface any document conflicts immediately with the override applied.
- After each completed task, always build deliverables for the affected platform(s).
- After each completed task, always create a local Git commit for that completed task.
- Before writing new deliverables, always delete old artifacts to avoid stale outputs.
- Artifact output directory for packaged results:
output/packages/<timestamp-or-version>/. - Never delete
.git, Git history, refs, index, or any other Git metadata under any circumstance. - In the current session, deletion is only allowed inside this project directory:
D:\code\android\frame.
What steps can reproduce the bug?
Environment: VS Code on Windows 11 with Codex CLI installed.
Setup: Using Default Permissions (I did not manually elevate or change any security settings after installation).
Trigger: I implemented a "suggestion-execution hook" (self-correction loop) as suggested by the model's documentation/capabilities.
Action: Prompted the CLI to manage or optimize files on the D: drive.
The Bug: The model generated a destructive deletion command (e.g., rm or del) for files in the D:\Photo folder.
Failure: Because of the Default Permission settings, the CLI executed the deletion of large files (~30MB each) autonomously for two consecutive days without any terminal-level confirmation or safety prompt.
What is the expected behavior?
_No response_
Additional information
_No response_
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Sorry to hear that you experienced data loss.
I presume that you're running in "--yolo" (aka "--dangerously-bypass-approvals-and-sandbox") mode. We do not recommend running in this mode unless you have some external sandbox configured (like a VM or container). You should not run Codex in this mode on your computer without a sandbox. By default, Codex runs in a mode where all tool calls are mediated by sandbox policies which prevents unexpected file deletions like you've seen here.
For more details about the sandboxing capabilities built into Codex, refer to this documentation.
Thanks for the explanation.
I’m using Codex CLI in VSCode with default permissions, and I never used --yolo or any bypass flags. I don’t even know how to disable the sandbox.
I launched it with a command like codex --full-auto resume --last, and I’ve actually been looking up how to make sure Codex CLI runs in proper sandbox mode afterward.
I prefer the CLI over the regular Codex UI because the UI isn’t very convenient to use.