Codex Max (medium) deletes whole files without need. Gets confused. Model behavior.
What version of Codex is running?
codex-cli 0.60.1
What subscription do you have?
Plus
Which model were you using?
gpt-5.1-codex-max (medium)
What platform is your computer?
Windows 11
What issue are you seeing?
The model at times deletes entire files instead of making localized edits. This behaviour is dangerous and sometimes the model gets lost/confused and has to revert files from git or rebuild the deleted files from previous context. This consumes a lot of tokens and is very slow and dangerous. The model sometimes says "I accidentally deleted the file".
What steps can reproduce the bug?
Is not easy to create initial conditions since depends on many variables. I recommend model observation on real engineering tasks.
What is the expected behavior?
Make several smaller minor edits, instead of attempting to rewrite whole files at once. Likely would save on tokens, the changes are easier to track by a human engineer and less dangerous (if not using git). The model sometimes in front of accidental delete rebuilds from context instead of making a git checkout from head. The git checkout would be the faster and cheaper way to perform the correction in front of that failure (context inspection would be useful to determine if is the proper corrective step).
Additional information
_No response_
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Thanks for the bug report. We'll share the feedback with the team responsible for training our codex models. If you see other model behavior that you'd like to report, please use the
/feedbackcommand in the CLI. That will provide us with additional details including logs and conversation text.I was able to catch one example where the model did this weird thing, please check it here: https://github.com/openai/codex/issues/new?template=2-bug-report.yml&steps=Uploaded%20thread:%20019aad7b-cb3e-7f40-aed1-72e880e8f022 . After using the trace to correct the problem or improve the model, please delete the trace.
Hi, I noticed Codex was deleting entire files without need. We provide granular tool permissions (https://mcp-shield.vercel.app) so agents can't overwrite or delete without explicit approval. Would love to chat about securing your agents!