From 1264275cc3dca3ed2cbaa7a032d002c3c442192b Mon Sep 17 00:00:00 2001 From: teknium1 Date: Tue, 17 Mar 2026 04:11:32 -0700 Subject: [PATCH] fix(core): compression_attempts counter resets each loop iteration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit compression_attempts was initialized inside the outer while loop, resetting to 0 on every iteration. Since compression triggers a 'continue' back to the top of the loop, the counter never accumulated past 1 — effectively allowing unlimited compression attempts. Move initialization before the outer while loop so the cap of 3 applies across the entire run_conversation() call. --- run_agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_agent.py b/run_agent.py index f71206c58..2e0031adf 100644 --- a/run_agent.py +++ b/run_agent.py @@ -4884,6 +4884,7 @@ class AIAgent: codex_ack_continuations = 0 length_continue_retries = 0 truncated_response_prefix = "" + compression_attempts = 0 # Clear any stale interrupt state at start self.clear_interrupt() @@ -5029,7 +5030,6 @@ class AIAgent: api_start_time = time.time() retry_count = 0 max_retries = 3 - compression_attempts = 0 max_compression_attempts = 3 codex_auth_retry_attempted = False anthropic_auth_retry_attempted = False