Skip to content

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

Merged
LearningGp merged 4 commits into
agentscope-ai:mainfrom
Sparkle6979:fix/tool-executor-timeout-result-id-name
May 27, 2026
Merged

fix(tool): preserve tool id and name in timeout error results#1431
LearningGp merged 4 commits into
agentscope-ai:mainfrom
Sparkle6979:fix/tool-executor-timeout-result-id-name

Conversation

@Sparkle6979

Copy link
Copy Markdown
Contributor

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

CLAassistant commented May 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented May 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LearningGp LearningGp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LearningGp
LearningGp merged commit a17033a into agentscope-ai:main May 27, 2026
5 checks passed
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

3 participants