What happened

The OpenAI Codex bug that deleted files without permission is now officially fixed, according to a security update OpenAI shipped on August 19, 2026. Multiple users reported that GPT-5.6 Sol, the model powering Codex, was autonomously wiping real files while carrying out routine coding tasks — not sandboxed test files, but actual user data sitting in their home directories.

The root cause traced back to a cleanup command. Codex was designed to remove temporary working files it created during a session, a completely normal housekeeping step for an AI coding agent. The problem was how it located those temporary files. The model relied on system environment variables like $HOME to build file paths, and in certain conditions a faulty delete command resolved that variable to the user's actual home directory instead of a scoped temp folder. The result: a "clean up after yourself" instruction turned into a command that could erase real projects, documents, and configuration files.

OpenAI's fix addresses the issue at several layers rather than patching a single line of code. Codex now verifies deletion targets before executing any delete command, generates fresh, isolated temporary folders for each session instead of reusing shared paths, and no longer relies on ambiguous system variables that can be misresolved. Stricter checks now flag risky delete operations before they run, and OpenAI closed a separate loophole that let Codex's full-access mode — the setting with no file restrictions — get triggered by accident.

Why it matters

This wasn't a hypothetical vulnerability buried in a changelog. It was an AI agent with shell access silently destroying user data during normal use, with no warning and no confirmation prompt. For anyone who has started handing coding agents real repositories, real credentials, and real production-adjacent environments, that's the nightmare scenario: an assistant meant to save time instead erasing hours or days of work in seconds.

The incident also highlights a broader risk in agentic AI tools generally. As coding assistants gain more autonomy — running shell commands, managing files, executing multi-step tasks without a human checking every action — the blast radius of a single logic error grows. A bug that would have been a minor annoyance in a read-only chatbot becomes a data-loss event when the same model can execute `rm` commands on your filesystem. OpenAI's fix is a reminder that permission systems and sandboxing aren't optional extras for AI agents; they're the difference between a tool and a liability.

How to use it today

If you use Codex, the first step is simple: update to the latest version so the safeguards are actually active on your machine. OpenAI also recommends sticking to one of Codex's sandbox modes rather than full-access mode for everyday work. Sandbox modes restrict what the agent can touch, which limits the damage even if another edge case slips through in the future.

Beyond that, treat any AI coding agent the way you'd treat a junior developer with root access: give it version control, not blind trust. Commit your work frequently, keep backups outside the working directory, and avoid running agentic tools directly against folders you can't afford to lose. These habits matter regardless of which AI tool you use, since Codex is far from the only agent capable of running destructive commands.

MyKreaTool AI chat — try ChatGPT, Claude and Gemini in one place. Free on MyKreaTool.Open the tool →

If you're experimenting with lightweight AI tools for writing, research, or automation rather than full coding agents, it's worth comparing what's available before committing to a workflow — for instance, the free AI tools at [mykreatool.com](https://mykreatool.com) let you test different use cases without installing anything or granting filesystem access at all.

Who benefits

Developers and engineering teams using Codex for day-to-day coding are the most direct beneficiaries, since the patch removes a genuine risk of losing local work without warning. Solo founders and indie developers who lean on AI coding assistants to move fast — often without rigorous backup discipline — stand to gain even more, since a single wiped directory can set a small project back significantly.

Enterprise teams evaluating whether to roll out agentic coding tools organization-wide also benefit indirectly. Incidents like this one shape internal risk assessments and IT policies around AI tool permissions, and a documented, transparent fix from OpenAI gives security and DevOps teams something concrete to point to when setting guardrails for AI-assisted development.

Risks

Even with this patch, the underlying lesson doesn't disappear. Any AI system that can execute file or shell commands carries some residual risk, because no safeguard system catches every edge case on day one — this fix itself only exists because a prior set of assumptions about environment variables turned out to be wrong. Users should treat sandbox modes as a strong default, not a guarantee, and keep independent backups regardless of how much a vendor has hardened its permission checks.

There's also a trust cost to weigh. Every reported incident of an AI agent silently destroying data makes users, especially in professional or enterprise settings, more hesitant to grant these tools deeper system access — which is precisely the direction agentic AI products are heading. Vendors that want teams to hand over more autonomy will need to keep proving, incident by incident, that the safety layer around that autonomy actually holds.

Conclusion

The Codex file-deletion bug is a clear example of how a small technical oversight — a mishandled environment variable in a cleanup routine — can escalate into real data loss when an AI agent has shell-level access. OpenAI's fix closes that specific hole with target verification, isolated temp folders, and tighter restrictions on full-access mode, but the broader takeaway extends past this one tool: as coding agents become more capable and more autonomous, sandboxing, version control, and independent backups aren't optional precautions, they're the baseline cost of using these systems safely.