The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(agent): integer head/tail split in _bound_oversized_record
kshitijk4poor8e12cd92d7c3
diff --git a/agent/context_compressor.py b/agent/context_compressor.pyindex ff9d4b98f8c..34436254a96 100644--- a/agent/context_compressor.py+++ b/agent/context_compressor.py@@ -3541,10 +3541,10 @@ Summary generation was unavailable, so this is a best-effort deterministic fallbif limit <= marker_reserve:return record[:limit]remaining = limit - marker_reserve- head_len = int(remaining * 0.5)+ head_len = remaining // 2tail_len = remaining - head_lenhead = record[:head_len].rstrip("\n")- tail = record[-tail_len:].lstrip("\n") if tail_len else ""+ tail = record[-tail_len:].lstrip("\n")elided = len(record) - len(head) - len(tail)return head + marker_template.format(elided=elided) + tail