From 721e0b96cd59e90b0951e098c401ef2935c57527 Mon Sep 17 00:00:00 2001 From: dmahan93 Date: Thu, 16 Apr 2026 01:10:11 -0500 Subject: [PATCH] add length eviction if no compression --- run_agent.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/run_agent.py b/run_agent.py index b16738d96..008d4b00e 100644 --- a/run_agent.py +++ b/run_agent.py @@ -7059,6 +7059,15 @@ class AIAgent: finish_reason = response.choices[0].finish_reason if finish_reason == "length": + if not self.compression_enabled: + return { + "final_response": None, + "messages": messages, + "api_calls": api_call_count, + "completed": False, + "partial": True, + "error": "Response truncated due to output length limit", + } self._vprint(f"{self.log_prefix}⚠️ Response truncated (finish_reason='length') - model hit max output tokens", force=True) # ── Detect thinking-budget exhaustion ──────────────