Remote compaction v2 retains raw media and can trigger repeated auto-compaction
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- PR merge metrics
- PR metrics pending
Description
Summary
In a long-running Codex Desktop session with image inputs, repeated remote compaction retained raw media payloads in replacement history. The session then kept auto-compacting and the rollout grew continuously.
Observed behavior
- A successful compaction did not remove earlier inline image payloads from the retained history.
- Subsequent compaction requests carried those payloads forward again.
- The retained payload volume created a high context floor and repeated automatic compaction.
Root-cause hypothesis
The v2 retained-history path in codex-rs/core/src/compact_remote_v2.rs assigns zero text-token cost to InputImage and InputAudio, while preserving the raw items during truncation. Therefore a byte-heavy media item can survive the text-only budget indefinitely across compactions.
Expected behavior
After successful compaction, retained history must not contain raw image or audio payloads from previous turns, and all retained context should remain bounded by the retention budget.
Proposed fix
Before retained-history budget truncation, replace InputImage and InputAudio with bounded text markers. This preserves conversation structure without resending or persisting raw media. Add regression coverage that asserts compacted retained history contains no data:image or audio payload and that markers are charged by the existing budget.
Related discussion
This is a current reproduction and source-level analysis related to #33493.
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 in codex-rs/core/src/compact_remote_v2.rs and trace the retained-history budget truncation for InputImage and InputAudio. Locate the existing compaction regression tests or test entry point, then add coverage showing retained history contains no data:image or audio payloads after compaction. Done means bounded text markers remain and are charged by the retention budget.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- ai-infra-agents
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100