Skip to content

Skip tool hooks for internal output tools#5128

Merged
DouweM merged 1 commit intomainfrom
output-tool-call-hook
Apr 17, 2026
Merged

Skip tool hooks for internal output tools#5128
DouweM merged 1 commit intomainfrom
output-tool-call-hook

Conversation

@DouweM
Copy link
Copy Markdown
Collaborator

@DouweM DouweM commented Apr 17, 2026

Tool hooks (validation and execution) were firing for internal output tools like final_result, leaving after_tool_execute free to return a ToolReturn that leaked through as result.output instead of the typed value.

Exclude kind='output' tools from tool hook dispatch, matching how WrapperToolset and prepare_tools already exclude them. Follow-up PR #4859 will add dedicated output hooks for cases where users do want to wrap output tool calls.

Checklist

  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • No breaking changes in accordance with the version policy.
  • PR title is fit for the release changelog.

Tool hooks (validation and execution) were firing for internal output tools
like `final_result`, leaving `after_tool_execute` free to return a `ToolReturn`
that leaked through as `result.output` instead of the typed value.

Exclude `kind='output'` tools from tool hook dispatch, matching how
`WrapperToolset` and `prepare_tools` already exclude them.

Closes #5111
@github-actions github-actions Bot added size: S Small PR (≤100 weighted lines) bug Report that something isn't working, or PR implementing a fix and removed auto-review labels Apr 17, 2026
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@github-actions
Copy link
Copy Markdown
Contributor

@DouweM DouweM merged commit 3540277 into main Apr 17, 2026
56 checks passed
@DouweM DouweM deleted the output-tool-call-hook branch April 17, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Report that something isn't working, or PR implementing a fix size: S Small PR (≤100 weighted lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

after_tool_execute hook fires for internal output tools, corrupting result.output when returning ToolReturn

1 participant