v2.2.1: fix compaction orphaning tool outputs (tested, all 8 tests pass)
- Compaction now walks tail boundary past fc/fco/assistant to keep pairs intact - All 8 pipeline tests pass: compaction, message translation, 5 Crof models - reasoning_effort=none confirmed working: 0 reasoning on mimo/kimi/deepseek - No orphaned function_call_output items after compaction
This commit is contained in:
Binary file not shown.
@@ -240,9 +240,13 @@ def _compact_input(input_data):
|
||||
head = input_data[:head_end]
|
||||
tail_start = len(input_data) - _COMPACT_KEEP_RECENT
|
||||
while tail_start > head_end:
|
||||
if input_data[tail_start].get("type") == "function_call_output":
|
||||
t = input_data[tail_start].get("type")
|
||||
r = input_data[tail_start].get("role", "")
|
||||
if t == "function_call_output":
|
||||
tail_start -= 1
|
||||
elif input_data[tail_start].get("type") == "message" and input_data[tail_start].get("role") == "assistant":
|
||||
elif t == "function_call":
|
||||
tail_start -= 1
|
||||
elif t == "message" and r == "assistant":
|
||||
tail_start -= 1
|
||||
else:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user