Skip to content

fix(core): handle pending tool calls when maxIters reached (#1005)#1261

Open
Wzy19930507 wants to merge 4 commits intoagentscope-ai:mainfrom
Wzy19930507:issue-1005-maxiters-pending-tool-calls-clean
Open

fix(core): handle pending tool calls when maxIters reached (#1005)#1261
Wzy19930507 wants to merge 4 commits intoagentscope-ai:mainfrom
Wzy19930507:issue-1005-maxiters-pending-tool-calls-clean

Conversation

@Wzy19930507
Copy link
Copy Markdown

AgentScope-Java Version

io.agentscope:agentscope-parent:pom:1.0.12-SNAPSHOT

Description

Closes #1005

This PR fixes a session-state consistency bug in ReActAgent when maxIters is reached with pending tool calls.
What was wrong:

  • If an iteration ended at maxIters while there were unresolved ToolUseBlocks, the agent could leave memory with tool_use entries but no matching tool_result.
  • On the next user turn, validation throw failed.

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@Wzy19930507 Wzy19930507 requested a review from a team April 20, 2026 11:30
@Wzy19930507 Wzy19930507 changed the title Issue 1005 maxiters pending tool calls clean fix(core): maxiters pending tool calls clean #1005 Apr 20, 2026
@Wzy19930507 Wzy19930507 changed the title fix(core): maxiters pending tool calls clean #1005 fix(core): maxiters pending tool calls clean (#1005) Apr 20, 2026
@Wzy19930507 Wzy19930507 changed the title fix(core): maxiters pending tool calls clean (#1005) fix(core): handle pending tool calls when maxIters reached (#1005) Apr 20, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:超过了 maxIters 次数,再次发送消息报错

2 participants