Skip to content

Budget retained images during remote compaction - #40280

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/88868bbd09d2858939dbae3f8402e1f497b4e3c6
Aug 23, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/88868bbd09d2858939dbae3f8402e1f497b4e3c6

Conversation

@copyberry

@copyberry copyberry Bot commented Aug 23, 2026 •

Copy link
Copy Markdown

Budget retained images during remote compaction

Why

Remote compaction's retained-message budget counted text but not images, so
image-heavy history could retain more context than the budget represented.

What changed

  • Add the opt-in compaction_image_budget feature to charge retained images
    using the existing image size estimate.
  • Keep images and their adjacent labels atomic when truncating a boundary
    message, while preserving existing text, audio, metadata, and
    client-authored developer-message behavior.
  • Stop backfilling older messages when an image at the truncation boundary
    does not fit.

Testing

  • Add unit coverage for image boundaries, annotations, audio, text-only
    messages, and client-authored developer messages.
  • Add an integration test covering repeated remote compaction with the feature
    enabled, disabled, and left at its default.

## Why

Remote compaction's retained-message budget counted text but not images, so
image-heavy history could retain more context than the budget represented.

## What changed

- Add the opt-in `compaction_image_budget` feature to charge retained images
  using the existing image size estimate.
- Keep images and their adjacent labels atomic when truncating a boundary
  message, while preserving existing text, audio, metadata, and
  client-authored developer-message behavior.
- Stop backfilling older messages when an image at the truncation boundary
  does not fit.

## Testing

- Add unit coverage for image boundaries, annotations, audio, text-only
  messages, and client-authored developer messages.
- Add an integration test covering repeated remote compaction with the feature
  enabled, disabled, and left at its default.

GitOrigin-RevId: 88868bbd09d2858939dbae3f8402e1f497b4e3c6
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/88868bbd09d2858939dbae3f8402e1f497b4e3c6 branch from d595fa3 to 6677fd8 Compare August 23, 2026 21:30
@copyberry
copyberry Bot merged commit 6677fd8 into main Aug 23, 2026
27 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/88868bbd09d2858939dbae3f8402e1f497b4e3c6 branch August 23, 2026 21:31
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant