OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

fix: Avoid infinite loop with rolling condensers and history truncation

Open csmith49 opened this issue 10 months ago • 0 comments

End-user friendly description of the problem this fixes or functionality that this introduces

  • [ ] Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

Give a summary of what the PR does, explaining any non-trivial design decisions

There's some unusual behavior that happens when a rolling condenser implementation produces a condensation that exceeds the model's max token limits: the agent controller will truncate the history, and the rolling condenser will continue to use the old condensation, hitting the max token limits and entering an infinite loop of history truncation.

This PR addresses this issue and adds a simple unit test.

Rolling condensers will now reset their state if they detect a truncated history. This will have some strange behavior whereby previous information stored in a condensation (like summaries) will be lost, but the agent will continue to operate from the truncated history.


Link of any specific issues this addresses

csmith49 avatar Feb 18 '25 18:02 csmith49