fix(agent/compaction): skipped truncating tiny tool outputs during pruning

- Added a 50-token minimum floor constant for pruning decisions.
- Allowed non-superseded, non-useless tool results below that floor to avoid truncation.
This commit is contained in:
can1357
2026-06-15 12:43:23 +02:00
parent e8ef706abf
commit f40e528073
6 changed files with 38 additions and 3 deletions
+1
View File
@@ -151,6 +151,7 @@ Default prune policy:
- Protect newest `40_000` tool-output tokens.
- Require at least `20_000` total estimated savings.
- Never blank a result below `50` tokens (`MIN_PRUNE_TOKENS`): the `[Output truncated - N tokens]` placeholder costs ~8 tokens, so pruning a sub-floor result would grow the context and churn the prompt cache for nothing. (Superseded and useless results keep their own rules — the useless collector already drops no-savings candidates; superseded reads prune for correctness regardless of size.)
- Never prune `skill` tool results, `read` results of `skill://` paths, or reads of the active plan reference file (added via `AgentSession`'s plan protection).
Pruned tool results are replaced with: