Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
enyst committed Nov 13, 2024
1 parent 29fbad1 commit d85debd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openhands/controller/agent_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,8 @@ def _apply_conversation_window(self, events: list[Event]) -> list[Event]:
None,
)

# Initial cut in half
mid_point = len(events) // 2
# cut in half
mid_point = max(1, len(events) // 2)
kept_events = events[mid_point:]

# Handle first event in truncated history
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_truncation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def test_context_window_exceeded_handling(self, mock_event_stream, mock_agent):
cmd1 = CmdRunAction(command='ls')
cmd1._id = 2
obs1 = CmdOutputObservation(command='ls', content='file1.txt', command_id=2)
obs1._id = 3
obs1._cause = 2

# Set up mock event stream to return our events
Expand Down

0 comments on commit d85debd

Please sign in to comment.