fix(context_compressor): off-by-one in tail protection for short conversations
This commit is contained in:
parent
2997ef9446
commit
b194617d00
@ -538,7 +538,7 @@ class ContextCompressor(ContextEngine):
|
|||||||
# Token-budget approach: walk backward accumulating tokens
|
# Token-budget approach: walk backward accumulating tokens
|
||||||
accumulated = 0
|
accumulated = 0
|
||||||
boundary = len(result)
|
boundary = len(result)
|
||||||
min_protect = min(protect_tail_count, len(result) - 1)
|
min_protect = min(protect_tail_count, len(result))
|
||||||
for i in range(len(result) - 1, -1, -1):
|
for i in range(len(result) - 1, -1, -1):
|
||||||
msg = result[i]
|
msg = result[i]
|
||||||
raw_content = msg.get("content") or ""
|
raw_content = msg.get("content") or ""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user