From 0b7c08d3928e35efa36da67b92a7a7b73b3924c6 Mon Sep 17 00:00:00 2001 From: Engel Nyst Date: Thu, 14 Nov 2024 02:20:56 +0100 Subject: [PATCH] fix initialization --- openhands/controller/agent_controller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openhands/controller/agent_controller.py b/openhands/controller/agent_controller.py index ad80cdcb385d3..2e4c7c599c89a 100644 --- a/openhands/controller/agent_controller.py +++ b/openhands/controller/agent_controller.py @@ -699,7 +699,7 @@ def _init_history(self): events: list[Event] = [] # If we have a truncation point, get first user message and then rest of history - if hasattr(self.state, 'truncation_id') and self.state.truncation_id: + if hasattr(self.state, 'truncation_id') and self.state.truncation_id > 0: # Find first user message from stream first_user_msg = next( ( @@ -822,7 +822,7 @@ def _apply_conversation_window(self, events: list[Event]) -> list[Event]: # Handle first event in truncated history if kept_events: - i = mid_point + i = 0 while i < len(kept_events): first_event = kept_events[i] if isinstance(first_event, Observation) and first_event.cause: