Skip to content

Commit f2161f2

Browse files
committed
fix: address review feedback and fix failing tests
- Remove redundant single-item special case in function_response handling - Extract common auto-healing test setup into pytest fixture - Update compaction tests to account for auto-healing synthetic responses
1 parent 7ba9e51 commit f2161f2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/unittests/apps/test_compaction.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,9 @@ async def test_sliding_window_pending_function_call_remains_in_contents(
10021002
result_contents[1].parts[0].function_call.name,
10031003
'tool',
10041004
)
1005-
self.assertEqual(result_contents[2].parts[0].text, 'e3')
1005+
# Auto-healing injects a synthetic response for the orphaned call
1006+
self.assertIsNotNone(result_contents[2].parts[0].function_response)
1007+
self.assertEqual(result_contents[3].parts[0].text, 'e3')
10061008

10071009
async def test_token_threshold_excludes_pending_function_call_events(self):
10081010
"""Token-threshold compaction stays contiguous before pending calls."""
@@ -1087,7 +1089,9 @@ async def test_token_threshold_pending_function_call_remains_in_contents(
10871089
result_contents[1].parts[0].function_call.name,
10881090
'tool',
10891091
)
1090-
self.assertEqual(result_contents[2].parts[0].text, 'e3')
1092+
# Auto-healing injects a synthetic response for the orphaned call
1093+
self.assertIsNotNone(result_contents[2].parts[0].function_response)
1094+
self.assertEqual(result_contents[3].parts[0].text, 'e3')
10911095

10921096
async def test_completed_function_call_pair_is_still_compacted(self):
10931097
"""Completed function call/response pairs must still be compacted."""

0 commit comments

Comments
 (0)