Agent used git clean on nested ignored paths and deleted the entire ignored parent directory
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Environment
- Codex CLI 0.152.1
- Windows
- Repository contained an ignored
config/directory with local secrets and operational files
What happened
The user requested removal of several specific unused skill directories after backing them up. The agent created a partial backup of the selected skills and prompts, then ran a command equivalent to:
git clean -fdX -- config/<nested-paths>
The intended scope was only the named nested directories. Because the parent directory was ignored, Git removed the entire config/ directory. This deleted API key files and operational scripts that were not included in the partial backup.
The command was executed without a prior destructive-operation warning, without an explicit confirmation of the resolved deletion scope, and without first running and reviewing git clean -ndX. The loss was only disclosed after execution.
No secrets or repository contents are attached to this report.
Expected behavior
Before running git clean or an equivalent recursive destructive command, Codex should:
- Resolve and display the actual deletion scope.
- Run a dry-run and verify that every candidate remains within the explicitly requested paths.
- Stop if an ignored parent directory would be removed instead of only the requested children.
- Require explicit confirmation when untracked or ignored files may be permanently deleted.
- Prefer literal, individually validated paths for targeted removal.
- Verify that the backup covers every file in the effective deletion scope.
Impact
The entire local configuration directory was deleted. The user recovered the API keys only because they had independently created a separate backup.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Codex CLI path that constructs and executes git clean or equivalent recursive deletion commands. Reproduce the nested ignored-parent case with git clean -ndX, then verify that the effective scope is displayed, backups are checked, destructive confirmation is required, and unsafe parent-directory deletion is blocked.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, rust
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100