agentscope-java icon indicating copy to clipboard operation
agentscope-java copied to clipboard

[Bug]:2.0.5中压缩上下文的模型如果带有思考,压缩会一直失败,导致超出模型上限

Open BEN5890 opened this issue 1 week ago • 1 comments

在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

BEN5890 avatar Nov 20 '26 08:11 BEN5890

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.

  • main already ignores non-text blocks other than ToolUseBlock (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.

shanuo0312 avatar Nov 20 '26 09:11 shanuo0312