openai / openai/codex

Windows Desktop: pytest temporary artifacts accumulate under .codex\visualizations and consume multiple GB

Open
#41,802 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug sandbox windows-os
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of the Codex App are you using (From “About Codex” dialog)?

26.825.6671.0

What subscription do you have?

ChatGPT Plus

What platform is your computer?

Windows x64

What issue are you seeing?
What version of the Codex App are you using?

Codex Desktop 26.825.6671.0

What platform are you using?

Windows x64

What issue are you seeing?

Codex Desktop accumulated several gigabytes of pytest temporary artifacts under:

%USERPROFILE%\.codex\visualizations\YYYY\MM\DD\<thread-id>\...

In my case, .codex\visualizations reached approximately 7.26 GiB.

The large files were not visualization images. They were pytest temporary files produced while Codex was running repository tests. Example paths had shapes such as:

%USERPROFILE%\.codex\visualizations\2026\08\30\<thread-id>\pytest_...\test_...\pending_with_evidence.pt

and

%USERPROFILE%\.codex\visualizations\2026\08\29\<thread-id>\pytest_...\test_...\aligned_without_evidence.pt

The largest individual files were approximately 176.77 MiB each.

Examples included:

  • pending.pt

  • pending_with_evidence.pt

  • aligned.pt

  • aligned_without_evidence.pt

  • tampered.pt

  • unknown.pt

  • official-real.pth

  • standalone-real.pth

A filename-level size aggregation showed, for example:

File | Copies | Total size -- | -- | -- pending.pt | 7 | ~1237 MiB pending_with_evidence.pt | 5 | ~884 MiB aligned.pt | 5 | ~884 MiB tampered.pt | 5 | ~884 MiB aligned_without_evidence.pt | 5 | ~884 MiB unknown.pt | 5 | ~884 MiB official-real.pth | 5 | ~884 MiB standalone-real.pth | 5 | ~884 MiB

The repository tests themselves were responsible for creating the checkpoint contents. In particular, some pytest cases instantiated and serialized a full model into their temporary directory.

I have since optimized the repository tests so metadata-only rejection tests use minimal synthetic checkpoints, but that only reduces how much data is produced. The Codex-side issue is that completed pytest temporary directories remained persisted under .codex\visualizations across multiple Codex threads/runs instead of being cleaned up.

Some of these directories also had sandbox ACLs that caused normal recursive inspection/deletion to return Access denied, for example on directories named similarly to:

  • pytest-preflight-2

  • pytest-review-tmp

I ultimately had to close Codex Desktop, rename the entire visualizations directory, take ownership of the old tree, grant deletion permission, and remove it manually.

Steps that reproduced the behavior
  1. Open a local Python repository in Codex Desktop on Windows.

  2. Ask Codex to implement/review changes that involve running pytest.

  3. Have tests create files through pytest temporary directories (tmp_path or equivalent).

  4. Repeat focused tests/reviews/preflights across several Codex turns or threads.

  5. Inspect:

    %USERPROFILE%\.codex\visualizations

  6. Observe pytest temporary directories retained below per-date/per-thread visualization directories after the test runs have finished.

  7. Over repeated runs, disk usage grows as the temporary test artifacts remain on disk.

In my case the retained visualization tree reached approximately 7.26 GiB.

Expected behavior

Pytest/sandbox temporary artifacts used during a Codex command should have a bounded lifetime.

Ideally:

  • pytest temporary directories should use an appropriate disposable temp root;

  • completed command/test temporary artifacts should be cleaned up after they are no longer needed;

  • .codex\visualizations should not retain arbitrary large test artifacts indefinitely;

  • cleanup should also work for sandbox-created directories with restricted Windows ACLs;

  • if artifacts intentionally need to be retained, there should be a size/age limit or a supported cleanup mechanism.

A single test suite can legitimately generate hundreds of MiB of temporary integration artifacts. Persisting those artifacts across every review/preflight/rerun can quickly consume many GiB.

Additional information

I am not reporting the large model checkpoint itself as a Codex bug. The repository test created that file, and I have separately reduced unnecessary test checkpoint generation.

The issue here is the lifetime and cleanup of test/sandbox temporary artifacts stored under Codex's .codex\visualizations state directory.

Related issues that appear adjacent but not identical:

  • #37225 — Windows Codex leaves orphaned temporary files that are not cleaned up.

  • #34970 — Windows tasks receive .codex\visualizations\... as an additional writable root.

I have omitted repository names, prompts, thread IDs, and raw test files because they may contain private project information.

What steps can reproduce the bug?
  1. Use Codex Desktop on Windows with a local Python repository that has pytest tests using tmp_path or similar temporary directories.

  2. Ask Codex to run focused tests, reviews, or preflight checks multiple times across several turns.

  3. Let some tests create relatively large temporary artifacts, for example model checkpoints.

  4. After the test runs complete, inspect:

    %USERPROFILE%\.codex\visualizations

  5. Observe that per-thread directories contain retained pytest temporary folders such as pytest_*, including completed test artifacts.

  6. Repeat the test/review workflow several times.

  7. Disk usage under .codex\visualizations continues to grow because the completed pytest temporary artifacts are not cleaned up.

In my case, .codex\visualizations reached approximately 7.26 GiB and contained many retained checkpoint files around 176.77 MiB each.

What is the expected behavior?

No response

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how Codex Desktop creates and retains pytest or sandbox temporary directories beneath %USERPROFILE%\.codex\visualizations, then reproduce the behavior on Windows with a Python repository using tmp_path. Done means completed command artifacts no longer accumulate indefinitely, retention is bounded or removable, and cleanup handles the restricted ACL cases described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
desktop, operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.