Skip to content

fix: skip compressed assistant tool calls#1487

Open
guslegend0510 wants to merge 4 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1482-autocontext-loop
Open

fix: skip compressed assistant tool calls#1487
guslegend0510 wants to merge 4 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1482-autocontext-loop

Conversation

@guslegend0510
Copy link
Copy Markdown

背景

在 AutoContext 压缩场景下,assistant 消息会带有 _compress_meta 标记。原有逻辑在提取最近工具调用时,可能把这些压缩后的消息当成新的工具调用上下文,导致后续轮次恢复出的工具调用不正确,甚至出现重复执行风险。

修改内容

  • MessageUtils.extractRecentToolCalls() 中跳过带 _compress_meta 的 assistant 消息。
  • 避免压缩消息污染“最近工具调用”的提取结果。
  • 保持普通 assistant 消息和原有工具调用处理逻辑不变。

验证

  • mvn -pl agentscope-core -am -Dtest=MessageUtilsTest test

Fixes #1482

@guslegend0510 guslegend0510 requested a review from a team May 25, 2026 10:19
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 25, 2026

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LearningGp
Copy link
Copy Markdown
Collaborator

image

@AgentScopeJavaBot AgentScopeJavaBot added bug Something isn't working area/core Core library: agentscope-core (general) labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Core library: agentscope-core (general) bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AutoContextMemory导致工具重复调用,直到maxIters才结束,触发压缩后有概率出现这个问题

5 participants