Skip to content

bug(compaction): Summary generation fails with 'unavailable due to context limits' #4827

Description

@cal-brmmr

Bug Report

What happened

During automatic context compaction, the summary generation failed completely:

Summary unavailable due to context limits. Older messages were truncated.

This defeats the purpose of compaction — the context was too large, so it got compacted, but the compaction couldn't produce a summary because the context was too large.

Expected behavior

Compaction should always produce some summary, even if degraded:

  • Iterative/chunked summarization for large contexts
  • Partial summary of recent messages if full summary fails
  • At minimum, preserve the last N messages verbatim as fallback

Impact

Without a summary, the agent loses all context about:

  • What was being worked on
  • Decisions made
  • Pending tasks
  • Important details from the conversation

The memoryFlush pre-compaction hook helps if the agent writes to files in time, but if summary generation fails, even that context cue is lost.

Related

Environment

  • Clawdbot running on macOS
  • Main session with extended conversation history
  • Compaction triggered automatically

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions