Skip to content

fix(tool): preserve tool id and name in timeout error results#1431

Open
Sparkle6979 wants to merge 2 commits into
agentscope-ai:mainfrom
Sparkle6979:fix/tool-executor-timeout-result-id-name
Open

fix(tool): preserve tool id and name in timeout error results#1431
Sparkle6979 wants to merge 2 commits into
agentscope-ai:mainfrom
Sparkle6979:fix/tool-executor-timeout-result-id-name

Conversation

@Sparkle6979
Copy link
Copy Markdown

When a tool call times out in executeWithInfrastructure(), the error path via onErrorResume creates a ToolResultBlock.error() without calling withIdAndName(). The normal path goes through .map() which correctly sets id/name, but timeout errors bypass .map().

This causes PostActingEvent.getToolResult() to return a ToolResultBlock with null id and name, while getToolResultMsg() has the correct values (rebuilt from ToolUseBlock by ToolResultMessageBuilder).

Fix: chain .withIdAndName(toolCall.getId(), toolCall.getName()) in the onErrorResume handler.

Fixes #1389

When a tool call times out in executeWithInfrastructure(), the error
path via onErrorResume creates a ToolResultBlock.error() without
calling withIdAndName(). The normal path goes through .map() which
sets id/name, but timeout errors bypass .map().

This causes PostActingEvent.getToolResult() to return a ToolResultBlock
with null id and name, while getToolResultMsg() has the correct values
(rebuilt from ToolUseBlock by ToolResultMessageBuilder).

Fix by chaining .withIdAndName() in the onErrorResume handler.

Fixes agentscope-ai#1389
@Sparkle6979 Sparkle6979 requested a review from a team May 17, 2026 08:31
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 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]: agent tool ExecutionConfig timeout make postActingEvent.getToolResult() id name is null

2 participants