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:
Roman
2026-05-20 13:23:06 +04:00
Unverified
parent 6c67642522
commit 0a3cd3fd7a
2 changed files with 6 additions and 2 deletions

Binary file not shown.

View File

@@ -240,9 +240,13 @@ def _compact_input(input_data):
head = input_data[:head_end] head = input_data[:head_end]
tail_start = len(input_data) - _COMPACT_KEEP_RECENT tail_start = len(input_data) - _COMPACT_KEEP_RECENT
while tail_start > head_end: 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 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 tail_start -= 1
else: else:
break break