test(gateway): make queued follow-up regression generic

Replace tenant-specific example text in the transcript offset regression with generic follow-up turns so the upstream test documents the bug without customer-specific wording.
This commit is contained in:
Kong 2026-05-14 02:52:42 +08:00 committed by Teknium
parent 9a815b6c8c
commit cc64a04f61

View file

@ -282,22 +282,26 @@ class TestTranscriptHistoryOffset:
{"role": "user", "content": "Earlier question"},
{"role": "assistant", "content": "Earlier answer"},
]
cool_turn = [
{"role": "user", "content": "cool"},
{"role": "assistant", "content": "Quote again"},
first_followup_turn = [
{"role": "user", "content": "First follow-up question"},
{"role": "assistant", "content": "First follow-up answer"},
]
order_turn = [
{"role": "user", "content": "how to make order?"},
{"role": "assistant", "content": "Deposit flow"},
second_followup_turn = [
{"role": "user", "content": "Second follow-up question"},
{"role": "assistant", "content": "Second follow-up answer"},
]
current_result = {
"history_offset": len(history_before_chain),
"messages": history_before_chain + cool_turn,
"messages": history_before_chain + first_followup_turn,
}
followup_result = {
"history_offset": len(history_before_chain + cool_turn),
"messages": history_before_chain + cool_turn + order_turn,
"history_offset": len(history_before_chain + first_followup_turn),
"messages": (
history_before_chain
+ first_followup_turn
+ second_followup_turn
),
}
merged = _preserve_queued_followup_history_offset(
@ -307,7 +311,7 @@ class TestTranscriptHistoryOffset:
assert merged["history_offset"] == len(history_before_chain)
persisted = merged["messages"][merged["history_offset"]:]
assert persisted == cool_turn + order_turn
assert persisted == first_followup_turn + second_followup_turn
def test_recursive_queued_followup_preserves_smaller_existing_offset(self):
"""Do not widen the slice if the nested result is already conservative."""