From 52637fee63472782e509f0f7eab4e24393842d48 Mon Sep 17 00:00:00 2001 From: Eric Maddox Date: Sun, 30 Aug 2026 04:32:02 -0700 Subject: [PATCH] test(native-compaction): cover image-only retention with an interleaved assistant message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Folded from PR #98345 (@ericmaddox): the one scenario its suite covered that #91557's did not — an assistant message between the image-only user message and the checkpoint, asserting post-prune ordering. --- .../test_native_compaction_nontext_retention.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/run_agent/test_native_compaction_nontext_retention.py b/tests/run_agent/test_native_compaction_nontext_retention.py index 3ac259b753..b4720256d3 100644 --- a/tests/run_agent/test_native_compaction_nontext_retention.py +++ b/tests/run_agent/test_native_compaction_nontext_retention.py @@ -81,3 +81,20 @@ def test_adapter_preserves_image_only_user_message_across_checkpoint(): {"role": "assistant", "content": "checkpoint turn"}, {"role": "user", "content": "after checkpoint"}, ] + + +def test_image_only_user_message_is_retained_with_interleaved_assistant(): + image_user = { + "role": "user", + "content": [_RESPONSES_IMAGE_PART], + } + items = [ + image_user, + {"role": "assistant", "content": "I see the screenshot."}, + _CHECKPOINT, + {"role": "user", "content": "what was in that screenshot?"}, + ] + out = prune_pre_checkpoint_items(items) + assert out[0] == _CHECKPOINT + assert out[1] == image_user + assert out[2] == {"role": "user", "content": "what was in that screenshot?"}