Files
codex/codex-rs/context-fragments
pakrym-oai 0a80fab240 Preserve content metadata when truncating messages (#40264)
## Why

Rebuilding a truncated message from its content fields can drop passthrough
metadata and leave positional content classifications out of sync with the
items that remain.

## What changed

- Convert message content and its classifications into `AnnotatedContent`
  before applying the token budget, then write both back together.
- Preserve other message and envelope metadata during truncation.
- Assign the `unknown` classification to content from legacy messages that do
  not provide classifications.

## Testing

Expanded truncation coverage to verify that retained text and image items keep
their matching classifications and that unrelated passthrough metadata is
preserved.

GitOrigin-RevId: f84e2ebc3e97392e45f321dec3c171713864bdcd
2026-08-23 18:53:15 +00:00
..