[Bug]:2.0.5中压缩上下文的模型如果带有思考,压缩会一直失败,导致超出模型上限
在ConversationCompactor中 void accept(ChatResponse response) { if (response.getContent() != null) { for (ContentBlock block : response.getContent()) { if (block instanceof TextBlock tb) { text.append(tb.getText()); } else { sawNonText = true; } } } if (response.getFinishReason() != null && !response.getFinishReason().isBlank()) { finishReason = response.getFinishReason(); finishMetadata = response.getMetadata() == null ? Map.of() : response.getMetadata(); } } 只要返回的不是TextBlock 就会设置sawNonText 为true
This is by an automated agent, not a human.
This duplicates #4210: the 2.0.x backport of #3855 widened the summary check from tool calls to every non-text block, so a normal ThinkingBlock invalidates an otherwise complete text summary and the history is never replaced.
mainalready ignores non-text blocks other thanToolUseBlock(fixed by #3855 / 616ab47), so it no longer rejects summaries that contain thinking.- For the 2.0.x line, #4212 has the targeted fix (ignore
ThinkingBlock, keep rejecting tool calls and other unsupported blocks) plus regression coverage for reasoning and text in the same chunk and in separate chunks.
No separate fix PR is needed here; tracking this as a duplicate of #4210.