Skip to content

Condenser crashes with 'Cannot condense 0 events' when tool loop spans view #2255

@neubig

Description

@neubig

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():

  1. forgetting_start is calculated as the smallest manipulation index >= keep_first
  2. forgetting_end is calculated as the smallest manipulation index >= naive_end
  3. When a tool loop spans most of the view, these can be equal
  4. view[forgetting_start:forgetting_end] returns an empty list
  5. 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

  1. Graceful degradation: Instead of crashing, return the view uncondensed and log a warning
  2. Adjust boundaries: When forgetting_start == forgetting_end, try to find an earlier manipulation index
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions