anthropics / anthropics/claude-agent-sdk-python

Bug: Autocompact is thrashing due to rapid context refill

未关闭
#958 4 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Python
星标
8.1k
派生
1.3k
平均合并
2 天 31 分钟
30 天内合并 PR
1

描述

### 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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。