openai / openai/codex

Add default lifecycle management for agent-created build caches and artifacts

Open
#41,686 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

agent app enhancement
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

Codex App — latest unified ChatGPT/Codex desktop app on macOS, observed on 2026-08-30.

What feature would you like to see?

Codex should treat build caches and regenerable artifacts that it creates for a task as managed resources with an explicit lifecycle, instead of leaving them indefinitely after a successful delivery.

Suggested default behavior:

  1. Resolve toolchain compatibility before downloading multiple large versions.
  2. Download the minimum distribution by default (for example, Gradle -bin); use -all only when sources or offline documentation are explicitly required.
  3. Classify task paths as source, deliverable, validation evidence, cache, or ephemeral output.
  4. Give task-local caches an owner, size limit, retention period, and cleanup hook.
  5. At task completion, audit regenerable intermediates and present a safe cleanup preview for user approval.
  6. For continuing projects, reuse one managed cache and retain only the newest useful copy of regenerable intermediate outputs.
  7. Preserve source code, Git history, uncommitted changes, the latest useful deliverable, and unique validation/release evidence.
  8. Never automatically delete unique databases, user files, credentials, task history, or sole rollback/release evidence.

User-authored hooks should remain an optional safeguard, not the primary solution for unsafe default accumulation.

Additional information

Concrete observed case:

  • During continued development of an Android file-manager project, Codex created a task-local GRADLE_USER_HOME under this sanitized pattern:

    /Users/<user>/Documents/Codex/<date>/<task>/work/gradle-home
    
  • While resolving toolchain compatibility, it first downloaded Gradle 9.1.0-all, then Gradle 8.13-all after switching to AGP 8.11.1.

  • Codex explicitly excluded gradle-home from the source deliverable, so it was known to be non-deliverable, regenerable task state.

  • After successful delivery it left approximately 1.70 GiB of task-local Gradle distributions/caches, along with obsolete build outputs and older APK packages.

  • Manual cleanup of those verified-regenerable files released approximately 1.92 GiB, while preserving the working source repository, Git state, newest APK/source package, and validation evidence.

  • The retained wrapper still referenced gradle-8.13-all.zip, meaning the unnecessary distribution could be downloaded again until separately corrected to -bin.

This is not a request for aggressive automatic deletion. The product should distinguish durable/unique data from regenerable intermediates, verify the retained current copy, and require approval before destructive cleanup.

Related issue #27230 discusses cleanup and retention for Codex's own local runtime/state. This request is specifically about project/task build caches and generated artifacts created by Codex while executing development work.

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 reviewing related issue #27230 and the observed task-local GRADLE_USER_HOME behavior described here. Map the requested classifications, ownership, retention, cleanup preview, and approval safeguards before proposing an implementation. Done means managed caches and regenerable artifacts can be audited and safely cleaned while preserving source, Git state, deliverables, and unique evidence.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, devtools, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.