From f7930b00a5e444fbf1b0edea163bcb0a34f1643a Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sat, 10 Oct 2026 14:09:27 +0800 Subject: [PATCH] compacting resets usage counters --- kcpp_agent.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kcpp_agent.py b/kcpp_agent.py index 40db46b2b..c03780b8f 100644 --- a/kcpp_agent.py +++ b/kcpp_agent.py @@ -2295,7 +2295,7 @@ def run_agent( continue try: with Throbber("Summarizing session"): - summary, last_usage = compact_session( + summary, _ = compact_session( messages, base_url, api_key, model, temperature, max_tokens, request_timeout, ) @@ -2306,6 +2306,7 @@ def run_agent( {"role": "system", "content": system_prompt(disabled_tools)}, {"role": "assistant", "content": f"Summary of the earlier session:\n{summary}"}, ] + last_usage = None print(f"Session compacted:\n{summary}\n") continue if command == "/workdir":