codex - 💡(How to fix) Fix codex is dropping zero length .codex files in filesystems. [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#17236Fetched 2026-04-10 03:43:34
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×2closed ×1commented ×1cross-referenced ×1

Code Example

2061 $ ll .codex
-r--r--r-- 1 h h 0 Apr  9 12:18 .codex
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

codex-cli 0.118.0

What subscription do you have?

pro

Which model were you using?

various

What platform is your computer?

Linux 6.19.8-arch1-1 x86_64 unknown

What terminal emulator and version are you using (if applicable)?

ghostty

What issue are you seeing?

Codex is dropping these files everywhere, this causes issues with git becoming unclean. Instead of just making the file and not writing anything, the file should only be created if there is something to write.

What steps can reproduce the bug?

run codex run 'ls -l' exit

2061 $ ll .codex
-r--r--r-- 1 h h 0 Apr  9 12:18 .codex

What is the expected behavior?

only create a file if you're writing something.

Additional information

No response

extent analysis

TL;DR

The issue can be mitigated by modifying the Codex CLI to only create files when there is content to write, potentially through a configuration change or a code modification.

Guidance

  • Review the Codex CLI documentation for any configuration options that control file creation behavior, specifically looking for settings that might allow for conditional file creation based on content presence.
  • Investigate the Codex CLI source code to identify where file creation is handled and consider submitting a pull request or issue to modify this behavior if it's not currently configurable.
  • Consider using a temporary workaround, such as a script that periodically cleans up empty files created by Codex, to mitigate the issue until a more permanent solution is found.
  • Verify that the issue persists across different models and subscriptions to determine if it's a widespread problem or specific to certain configurations.

Example

No specific code example can be provided without accessing the Codex CLI source code or documentation, but a potential solution might involve modifying a function responsible for file creation to check for content before writing to a file.

Notes

The solution may require modifications to the Codex CLI codebase or the introduction of new configuration options, which could have implications for compatibility and maintenance. Additionally, the effectiveness of any workaround will depend on the specific use case and environment.

Recommendation

Apply workaround: Implement a script to periodically clean up empty files created by Codex, as this provides a temporary solution to mitigate the issue without requiring immediate changes to the Codex CLI codebase.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING