STUPID-2026-0115

A Codex subagent's malformed rmdir command escaped a __pycache__ cleanup and wiped roughly two weeks of work across two project directories on drive E: (GitHub #40329)

7.0high
August 23, 2026Source checked

Why 7/10

Two weeks of work across two projects was deleted, bypassing the Recycle Bin.

Scope
2/4
One project, repository, server or service, or a cost above roughly $10,000
Recoverability
3/3
Permanently lost or irreversible, including data that was exposed
Did it happen
2/2
Happened in real use
Beyond the user
0/1
Only the user's own non-production work

The score is the sum of these four factors. How each factor is scored · scored 2026-10-29

Guardrail rules for this command

Recursive deletes: make your agent stop and ask before running these. Free to copy; written in each tool’s documented format.

Codex · the agent in this incident
prefix_rule(pattern = ["rm", ["-r", "-rf", "-fr", "-R"]], decision = "prompt", justification = "Recursive delete: confirm the target first")
Save as ~/.codex/rules/stupidllm.rules and restart Codex. Codex's docs describe rules as controlling commands run outside its sandbox, and mark them experimental.

Stronger control: Keep Codex's OS sandbox on (it limits writes, typically to the workspace) and leave approvals on for sessions that can reach data you cannot lose. Docs

Claude Code
{
  "permissions": {
    "ask": [
      "Bash(rm -r*)",
      "Bash(rm -fr*)",
      "Bash(rm -R*)",
      "Bash(find * -delete*)",
      "PowerShell(Remove-Item *)",
      "Bash(cmd /c rmdir *)",
      "Bash(cmd /c del *)"
    ]
  }
}
Add to .claude/settings.json in the project (or ~/.claude/settings.json for every project). Each matching command then asks you first, including in auto mode.

Stronger control: Turn on the sandbox (/sandbox): shell commands can then write only to the project, a temp folder and directories you add. It runs on macOS, Linux and WSL2; on native Windows Claude Code runs commands unsandboxed. Docs

Gemini CLI
[[rule]]
toolName = "run_shell_command"
commandPrefix = ["rm -r", "rm -fr", "rm -R"]
decision = "ask_user"
priority = 100
denyMessage = "Destructive command: needs a human to confirm (stupidllm.com)"
Save as ~/.gemini/policies/stupidllm.toml. Workspace-level policy files are disabled in Gemini CLI, so this must be the user-level folder.

Stronger control: Policies in ~/.gemini/policies apply in every approval mode unless a rule's modes field narrows them. Docs

Copilot CLI
copilot --deny-tool='shell(rm)'
Pass on the command line. Copilot CLI matches the program name (and git/gh subcommands), so this blocks the whole command, not just its dangerous form.

Stronger control: Avoid --allow-all-tools on a machine with data you cannot lose; --deny-tool takes precedence over it. Docs

What these cannot do: a pattern rule matches the command text the agent writes. In Anthropic’s words it “isn’t a security boundary around the program”: /bin/rm, sh -c or a script that runs the same thing gets past it (STUPID-2026-0124 got past a guard with cmd /c). Use the sandbox as well, and keep backups of what you cannot lose.

  1. Instruction given

    Not fully disclosed. The user was running a multi-step "Codex Heavy-route goal" on Windows, and a Codex subagent was working toward it when it decided to remove a stray `__pycache__` directory as routine cleanup.

  2. Expected behavior

    The cleanup command should have been scoped and quoted so it only removed the intended `__pycache__` directory, never traversing above the project folder it was working in.

  3. Actual behavior

    Due to incorrect quoting, the Windows `rmdir` command the subagent ran escaped to the root of drive E:\ and recursively deleted accessible contents from E:\Main_Projects and E:\Projects. The command ran from 23:07:43 to 23:18:44 Europe/Bucharest on August 23, 2026.

  4. Damage

    Approximately two weeks of work across multiple projects on drive E: was permanently deleted, bypassing the Recycle Bin. The user backed the report with a session log identifier and its SHA-256 hash, then requested account credits, a refund, a usage reset, and formal documentation from OpenAI. As of publication the issue remained open with no visible maintainer response or compensation granted.

Full write-up

On August 24, 2026, a user filed openai/codex issue #40329 after a Codex subagent's cleanup command destroyed roughly two weeks of work on a Windows machine. The subagent was working toward a multi-step "Codex Heavy-route goal" and, as part of that work, decided to remove a stray __pycache__ directory. The Windows rmdir command it constructed for that cleanup was incorrectly quoted, and instead of targeting the __pycache__ directory it escaped to the root of drive E:\ and recursively deleted accessible contents from two top-level project directories, E:\Main_Projects and E:\Projects. The command executed between 23:07:43 and 23:18:44 Europe/Bucharest on August 23, 2026, deleting files outright rather than sending them to the Recycle Bin.

The reporter documented the incident with a specific session log identifier (rollout-2026-08-23T23-02-20-01a03037-86e7-7141-b7e7-8d9a2e29d77a.jsonl) and its SHA-256 hash as supporting evidence, then asked OpenAI for account credits, a refund, a usage reset, and formal documentation of what happened. The issue was still open with no visible maintainer response, fix, or compensation at the time of publication.

Classification

Agent
Codex
Failure mode
Destructive Action
Root cause
Tool Misuse
Domain
Other
OWASP Agentic Top 10 (our mapping)
ASI02 Tool Misuse and Exploitation list
MIT AI Risk Repository (our mapping)
7.3 Lack of capability or robustness taxonomy

Related incidents

Cite this record
StupidLLM. "STUPID-2026-0115: A Codex subagent's malformed rmdir command escaped a __pycache__ cleanup and wiped roughly two weeks of work across two project directories on drive E: (GitHub #40329)." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0115/ (accessed 2026-11-06). CC BY 4.0.

← STUPID-2026-0114By IDSTUPID-2026-0116 →

Get told when an agent breaks something

We document AI agent failures daily, severity-scored against a published scale. Each Monday, if any scored 7 or above that week — deleted data, leaked secrets, broken production — you get one email with the sources. When nothing did, you get nothing.

This database is callable over MCP — query it from inside your agent.