Compaction/Summarization Failures
Overview
This guide covers conversation compaction and summarization failures in OpenClaw agents, based on src/agents/compaction.ts. As conversations grow, OpenClaw uses LLM-powered summarization to keep context within model limits. When this fails, agents may stop responding or produce errors.
Symptoms
Summarization Errors
- Log message: "Full summarization failed"
- Log message: "Partial summarization also failed"
- Agent continues with minimal fallback summary
Context Window Exceeded
- Error from LLM provider about context length
- Token count exceeds model's maximum
- Messages rejected during API call
Agent Stops Responding
- No response after long conversation
- Error in agent logs about message processing
- Session appears frozen after many exchanges
Oversized Message Warnings
- Log entries indicating specific messages are too large
- Messages excluded from summarization
- Fallback notes added to summary
Root Causes
1. Oversized Messages (Lines 236-247)
Individual messages that are too large for summarization:
Detection: Token estimation per message Threshold: Configured based on context window size Impact: Message excluded from summarization, noted in fallback
2. LLM API Errors
Provider-side failures during summarization request:
Common causes:
- Network timeout to LLM API
- Rate limiting (429 errors)
- Model unavailable (503 errors)
- Invalid API credentials
Recovery: Automatic retry with backoff
3. Abort Signal Triggered
External cancellation of summarization:
Common causes:
- User cancels agent action
- Session timeout
- System shutdown signal
Recovery: Immediate fallback, no retry
Recovery Mechanisms
Progressive Fallback System (Lines 205-272)
OpenClaw implements a three-tier fallback strategy: