Skip to content

Codex copied the image file 150,000 times, consuming 400 GiB of disk space #35470

Description

@Glavo

What version of Codex CLI is running?

0.145.0

What subscription do you have?

Pro 20x

Which model were you using?

gpt-5.6-sol

What platform is your computer?

Microsoft Windows NT 10.0.26220.0 x64

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

Windows Terminal (PowerShell)

Codex doctor report

What issue are you seeing?

Codex Base64-encodes every image sent by the user and stores the encoded data in the session’s JSONL file. Whenever context compaction occurs, previously uploaded images are stored again in the JSONL file as part of the compacted output. When a subagent is invoked, it copies the contents of the main session’s JSONL file.

In one session, I sent 57 images totaling approximately 3.5 MiB. The session underwent 1,052 context compactions, resulting in as many as 1,049 copies of these images within a single JSONL file. The file contained 483,017 image-data entries in total, occupying more than 2.8 GB. The session also created 169 subagents, causing those 1,049 copies to be duplicated up to another 142 times.

As a result of context compaction and subagent duplication, the earliest image I sent had approximately 150,000 copies under .codex/sessions, and the entire .codex/sessions directory consumed more than 400 GB of disk space.

Image

What steps can reproduce the bug?

  1. Open the Codex CLI/App.
  2. Send an image.
  3. Continue the session.
  4. Watch the .codex folder keep growing until it consumes the entire disk.

What is the expected behavior?

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingcontextIssues related to context management (including compaction)performancesessionIssues involving session (thread) management, resuming, forking, naming, archivingsubagentIssues involving subagents or multi-agent featureswindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions