fix: cap percentage displays at 100% in stats, gateway, and memory tool (#3599)

Salvage of PR #3533 (binhnt92). Follow-up to #3480 — applies min(100, ...) to 5 remaining unclamped percentage display sites in context_compressor, cli /stats, gateway /stats, and memory tool. Defensive clamps now that the root cause (estimation heuristic) was already removed in #3480.

Co-Authored-By: binhnt92 <binhnt92@users.noreply.github.com>
This commit is contained in:
Teknium
2026-03-28 14:55:18 -07:00
committed by GitHub
parent 1b2d4f21f3
commit 9a364f2805
5 changed files with 159 additions and 5 deletions

2
cli.py
View File

@@ -4506,7 +4506,7 @@ class HermesCLI:
compressor = agent.context_compressor
last_prompt = compressor.last_prompt_tokens
ctx_len = compressor.context_length
pct = (last_prompt / ctx_len * 100) if ctx_len else 0
pct = min(100, (last_prompt / ctx_len * 100)) if ctx_len else 0
compressions = compressor.compression_count
msg_count = len(self.conversation_history)