Problem
The LLMSummarizingCondenser.get_condensation() raises NoCondensationAvailableException with message 'Cannot condense 0 events' when a tool loop spans almost the entire view, leaving no valid range for forgetting events.
When this happens with a HARD condensation requirement, the hard_context_reset() is called but may also fail or return None, causing the exception to bubble up and crash the conversation.
Root Cause Analysis
In _get_forgotten_events():
forgetting_start is calculated as the smallest manipulation index >= keep_first
forgetting_end is calculated as the smallest manipulation index >= naive_end
- When a tool loop spans most of the view, these can be equal
view[forgetting_start:forgetting_end] returns an empty list
- This triggers the 'Cannot condense 0 events' exception
Reproduction
This occurs in production when:
- A conversation has many events
- A tool loop (atomic unit) spans most of the recent events
- The condenser is triggered with a HARD requirement
Proposed Fix Options
- Graceful degradation: Instead of crashing, return the view uncondensed and log a warning
- Adjust boundaries: When
forgetting_start == forgetting_end, try to find an earlier manipulation index
- Hard reset improvement: Make
hard_context_reset() more robust to handle edge cases
References
- Linear ticket: ALL-5012
- DataDog error query:
environment:production status:error "Cannot condense 0 events."
- Example conversation:
1423d3a3-1999-4221-b85d-046246fcee2b
Problem
The
LLMSummarizingCondenser.get_condensation()raisesNoCondensationAvailableExceptionwith message 'Cannot condense 0 events' when a tool loop spans almost the entire view, leaving no valid range for forgetting events.When this happens with a HARD condensation requirement, the
hard_context_reset()is called but may also fail or returnNone, causing the exception to bubble up and crash the conversation.Root Cause Analysis
In
_get_forgotten_events():forgetting_startis calculated as the smallest manipulation index >=keep_firstforgetting_endis calculated as the smallest manipulation index >=naive_endview[forgetting_start:forgetting_end]returns an empty listReproduction
This occurs in production when:
Proposed Fix Options
forgetting_start == forgetting_end, try to find an earlier manipulation indexhard_context_reset()more robust to handle edge casesReferences
environment:production status:error "Cannot condense 0 events."1423d3a3-1999-4221-b85d-046246fcee2b