From a304e716bf50ebb41eaa4bb065978b8e6ba8b09f Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Sat, 3 Oct 2026 15:25:58 +0530 Subject: [PATCH] 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. --- agent/native_compaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/native_compaction.py b/agent/native_compaction.py index 364cc1ecea..09dd1cc30f 100644 --- a/agent/native_compaction.py +++ b/agent/native_compaction.py @@ -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