Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Nov 13, 2025

Fixes 400 error when tool execution fails with native tool calls enabled.

The issue occurred when both handleError and the tool's result handler called pushToolResult, creating duplicate tool_result blocks with the same tool_use_id. Anthropic's API rejects this as invalid.

Added hasToolResult flag to track and prevent duplicate results per tool call in native protocol mode.

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. bug Something isn't working labels Nov 13, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 13, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete - no issues found.

This PR successfully addresses the duplicate tool_result block issue in native tool protocol. The implementation correctly tracks whether a tool result has been pushed and prevents duplicate calls, which was causing 400 errors from Anthropic's API.

The changes are well-tested with comprehensive test coverage for both the duplicate prevention and the mode-based tool filtering.

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@daniel-lxs daniel-lxs force-pushed the fix/native-tool-calls-duplicate-results branch from e533e82 to 231bade Compare November 13, 2025 22:23
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Nov 13, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 13, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 13, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Nov 13, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Nov 13, 2025
@mrubens mrubens merged commit bc99f41 into main Nov 15, 2025
22 checks passed
@mrubens mrubens deleted the fix/native-tool-calls-duplicate-results branch November 15, 2025 04:04
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Nov 15, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants