Skip to content

Bug: Autocompact is thrashing due to rapid context refill #958

@naidanLuo

Description

@naidanLuo

Describe the bug

I am encountering an issue where the autocompact feature is thrashing. The system throws the following error/warning:

"Autocompact is thrashing: the context refilled to the limit within 3 turns of the previous compact, 3 times in a row. A file being read or a tool output is likely too large for the context window. Try reading in smaller chunks, or use /clear to start fresh."

This appears to happen when reading files or processing tool outputs that are relatively large, causing the context window to hit its limit almost immediately after a compact operation.

Steps to Reproduce

  1. [Explain what you were doing, e.g., "I asked the agent to read a specific large file using the file-read tool."]
  2. [Explain the subsequent interactions, e.g., "The agent attempted to process the output."]
  3. The "Autocompact is thrashing" error is triggered.

Expected Behavior

The agent or SDK should ideally handle large tool outputs more gracefully, perhaps by automatically chunking the content or preventing the context limit from being overwhelmed instantly after an autocompact.

skill number:64
subagent:6
command:2
dialog 1 count error:Autocompact is thrashing: the context refilled to the limit within 3 turns of the previous compact, 3 times in a row. A file being read or a tool output is likely too large for the context window. Try reading in smaller chunks, or use /clear to start fresh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions