refactor(compaction): append fitting input_text parts without copying

BN01 quality finding (Low): _truncate_input_text_parts copied each
fully-fitting part with {**part} although it never mutates it. The
fully-fitting item path already appends the original item uncopied,
and the clipped boundary part is still a new dict. No caller mutates
the returned parts (the result is only placed into the retained
message), so the copy was dead work.
This commit is contained in:
kshitijk4poor
2026-10-03 15:25:58 +05:30
committed by kshitij
parent fe422a690a
commit a304e716bf

View File

@@ -206,7 +206,7 @@ def _truncate_input_text_parts(content: List[Dict[str, Any]], budget: int) -> Li
if lo:
head.append({**part, "text": text[:lo]})
break
head.append({**part})
head.append(part)
budget -= cost
return head