codex cli non interactive mode output very large text file, 500mb to 1.8gb
What version of Codex is running?
0.80.0
What subscription do you have?
chatgpt plus
Which model were you using?
gpt-5.1-codex-max high and gpt-5.2-codex-max high both have this issue
What platform is your computer?
Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64
What issue are you seeing?
<img width="2497" height="1089" alt="Image" src="https://github.com/user-attachments/assets/6b1f8c24-706f-473c-abb1-ee1920089e19" />
As the title and the image suggests,
I was using codex cli non interactive mode mostly and use codex exec "$prompt" --json 2>&1 command to output the result to a local file.
Everything was normal yesterday, but then it starts to output this very large text file and stuck there (I assume the file was too big).
It does not happen every time I run, and happens to both gpt-5.1-codex-max high and gpt-5.2-codex high model.
I downgraded to my previous codex cli version such as 0.78.0 also tried gpt-5.1-codex-max high as well, but the issue happens still from time to time.
If anyone can take a look, that will be very appreciated.
What steps can reproduce the bug?
I just let codex to review the code I write, and provide audit report in a markdown format using table.
What is the expected behavior?
It should just be a normal text file like around 20kb
Additional information
_No response_
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
After further digging, the issue seems to be codex now dump too much info into the json output, for anyone having the same issue, use stream to read, like tee pipeline, I am testing this approach and will report back as I go.
Sounds like Codex CLI is working as intended here.
@etraut-openai
Thanks for the message.
Could you explain a bit further please?
So did you mean it is by design to dump 1gb of logs when using --json flag?
I have been using --json every day and it was not this case until yesterday, normally the output size is just in kb not in gb.
What should the recommended way to handle this please?
I am trying to get the agent_message.text field while also trying to preserve the thread_id so I can reuse the same context in the next run.
Thanks again.
For details about non-interactive mode and how it works, refer to this documentation.