anthropics / anthropics/claude-agent-sdk-typescript
Regression: SDK no longer auto-compacts after 0.3.202
- 主要言語
- Shell
- スター
- 1.8k
- フォーク
- 226
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
After upgrading `@anthropic-ai/claude-agent-sdk` from `0.3.146` to newer versions, SDK sessions no longer auto-compact before the next turn, even when `getContextUsage()` reports that auto compact is enabled and the session is over the threshold.
Test setup:
- `rawMaxTokens`: `200000`
- `autoCompactThreshold`: `167000`
- `isAutoCompactEnabled`: `true`
- API: `query({ prompt, options: { model, resume, settingSources: ["user", "project", "local"], maxTurns: 1 } })`
Observed with `@anthropic-ai/claude-agent-sdk@0.3.211`:
fill-1:
totalTokens = 76453
input_tokens = 87721
success
fill-2:
totalTokens = 88425
input_tokens = 157730
success
fill-3:
totalTokens = 245410
rawMaxTokens = 200000
autoCompactThreshold = 167000
isAutoCompactEnabled = true
percentage = 123
result = Prompt exceeds max length
No compact event was emitted:
system compact_boundary
compact_result
compacting
I also tested 0.3.190 and saw the same behavior.
By comparison, @anthropic-ai/claude-agent-sdk@0.3.146 did auto-compact. In the same kind of long resumed session, it emitted:
EVENT system compact_boundary
and the next request was reduced to:
input_tokens = 18376
Expected behavior:
When isAutoCompactEnabled=true and totalTokens > autoCompactThreshold, the SDK should auto-compact before sending the next model request, as it did in 0.3.146.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。