[Feature Request] When the codex process exits, it cleans up the temporary files created by codex under /tmp.
Open 💬 6 comments Opened Aug 1, 2026 by LIghtJUNction
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What variant of Codex are you using?
CLI
What feature would you like to see?
I've noticed that over time, my /tmp filesystem gets increasingly full because Codex loads too many temporary files into it without timely cleanup. Since tmpfs resides in memory, these numerous temporary files consume a significant amount of memory, directly impacting device performance.
Additional information
_No response_
6 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
No, I'm not closing it; these two issues are different.
I really envy OpenAI; your /tmp is so big that you can stuff all these junk files into it. My laptop only has a pitifully small amount of memory, so this problem is a huge one for me.
I implemented a candidate lifecycle fix for Codex-owned hook temporary output:
/tmpcontent is not deleted blindly.4c9440e8dMy account cannot create the upstream PR because it has read-only permissions on
openai/codex. Please review the fork PR or cherry-pick the commit.I have a suggestion: the Codex shouldn’t simply discard temporary files directly /tmp.
It should be discarded at /tmp/chatgpt or /tmp/codex.
Since Codex has been merged into ChatGPT, I recommend using the former option.
Secondly, it is necessary to introduce a mechanism for regular cleanup operations.
Secondly, it should support the configuration. The /tmp/chatgpt folder actually contains two sub-folders.
For example:
/tmp/chatgpt/tmpfs
/tmp/chatgpt/non-tmpfs
It’s best to use names that directly convey the meaning. After all, these names are meant to be understood by AI. This way, AI will know which data should be stored in tmpfs to achieve faster processing.
What data should be discarded from the regular file system, rather than using tmpfs, which consumes all of the memory available.
Similar improvements should also be made for other systems.
Basically, after a while, I need to clean up the /tmp directory. It’s quite tedious. It would be best if this process could be automated.
@fcoury @genki @simonw @longouyang Please help me take a look for me. Thank you.