test(native-compaction): cover image-only retention with an interleaved assistant message

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.
This commit is contained in:
Eric Maddox
2026-08-30 04:32:02 -07:00
committed by Teknium
parent 532b2d8874
commit 52637fee63
@@ -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?"}