Skip to content

Safeguard compaction mode fails to generate summary at 186k tokens #3436

@namp

Description

@namp

Summary

compaction.mode: "safeguard" fails to produce a summary when session hits ~186k tokens, resulting in:

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

Expected Behavior

Safeguard mode should chunk the large history and produce a summarized compaction, preserving conversation context.

Actual Behavior

Compaction entry shows:

{
  "type": "compaction",
  "summary": "Summary unavailable due to context limits. Older messages were truncated.",
  "tokensBefore": 186094,
  "fromHook": true
}

Environment

  • Session ran for ~12.5 hours before hitting the limit
  • Config: agents.defaults.compaction.mode: "safeguard"
  • Model: anthropic/claude-opus-4-5
  • Memory flush did fire (~38s before compaction)
  • Two compactions fired in quick succession (186k tokens, then 19 tokens)

Notes

  • Memory flush safeguard worked correctly (fired at soft threshold)
  • Bug appears to be in chunked summarization logic — it should have broken 186k tokens into pieces but bailed out instead
  • Gemini embeddings showed quota exhaustion (429 RESOURCE_EXHAUSTED) ~40s before compaction, but that is for memory search, not summarization

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions