fix(gateway): honor previewed replies in queued follow-ups

This commit is contained in:
Dave Tist 2026-04-16 14:06:38 +02:00 committed by Teknium
parent d67e602cc8
commit 35bbc6851b
2 changed files with 19 additions and 2 deletions

View file

@ -324,9 +324,24 @@ class TestQueuedMessageAlreadyStreamed:
def test_queued_path_detects_confirmed_final_stream_delivery(self):
"""Confirmed final streamed delivery should skip the resend."""
_sc = self._make_mock_sc(already_sent=True, final_response_sent=True)
response = {"response_previewed": False}
_already_streamed = bool(
_sc and getattr(_sc, "final_response_sent", False)
(_sc and getattr(_sc, "final_response_sent", False))
or bool(response.get("response_previewed"))
)
assert _already_streamed is True
def test_queued_path_detects_previewed_response_delivery(self):
"""A response already previewed via the adapter should not be resent
before processing the queued follow-up."""
_sc = self._make_mock_sc(already_sent=False, final_response_sent=False)
response = {"response_previewed": True}
_already_streamed = bool(
(_sc and getattr(_sc, "final_response_sent", False))
or bool(response.get("response_previewed"))
)
assert _already_streamed is True