Files
whatevertogo 6ff0b08303 perf(context): reduce repeated work in token estimation and truncation (#11167)
* perf(context): avoid recounting retained history during truncation

Subtract dropped-round estimates for the built-in token counter and
compressors instead of rescanning all retained content. Preserve full
recounts for custom implementations, whole tool rounds, and the latest
request even when it exceeds the context limit.

* perf(context): skip redundant text scans and history list rebuilds

Estimate ASCII text directly with the existing weight and rounding.
Rebuild retained history once for built-in compression while preserving
current messages and full recounts for custom implementations.

Cover character boundaries, per-part rounding, and custom compressor
message/count consistency.
2026-11-16 23:03:19 +08:00
..