Add default lifecycle management for agent-created build caches and artifacts
Nobody has claimed this yet.
- 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:
- Resolve toolchain compatibility before downloading multiple large versions.
- Download the minimum distribution by default (for example, Gradle
-bin); use-allonly when sources or offline documentation are explicitly required. - Classify task paths as source, deliverable, validation evidence, cache, or ephemeral output.
- Give task-local caches an owner, size limit, retention period, and cleanup hook.
- At task completion, audit regenerable intermediates and present a safe cleanup preview for user approval.
- For continuing projects, reuse one managed cache and retain only the newest useful copy of regenerable intermediate outputs.
- Preserve source code, Git history, uncommitted changes, the latest useful deliverable, and unique validation/release evidence.
- 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_HOMEunder 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 Gradle8.13-allafter switching to AGP8.11.1. -
Codex explicitly excluded
gradle-homefrom 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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