fix: handle unknown tool calls gracefully instead of failing#8183
Closed
xr843 wants to merge 1 commit intoblock:mainfrom
Closed
fix: handle unknown tool calls gracefully instead of failing#8183xr843 wants to merge 1 commit intoblock:mainfrom
xr843 wants to merge 1 commit intoblock:mainfrom
Conversation
When a model emits a tool call for a non-existent tool, the error message now includes the list of available tools so the model can self-correct and retry with a valid tool name. Also adds telemetry logging for unknown tool call rate tracking. Fixes block#8166 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> Signed-off-by: Tim Ren <[email protected]>
a64ed0e to
e8e4cec
Compare
Collaborator
|
Hi @xr843, thanks for the contribution! Unfortunately I'm going to close this one for now. The main procedural issue is that as a first-time contributor, you've opened three PRs (#8181, #8182, #8183) in quick succession without waiting for any of them to land first. Our contributing guidelines ask that new contributors start with one PR and wait for it to go through review before opening more — see Pull Requests. Beyond that, there are a few code-level concerns with this specific change:
We'd love to have you contribute! Please pick one of your open PRs to focus on, and feel free to open a discussion or issue first if you'd like feedback on the approach before writing code. |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #8166
When a model emits a tool call for a non-existent tool (e.g.
read_file,view_file,run_command), goose currently returns a generic"Tool 'X' not found"error. While this error is sent back to the model as a tool response, the message lacks context to help the model self-correct, often causing repeated failures and task interruption.This PR enhances the error handling in
resolve_toolto:monotonic_counter.goose.unknown_tool_calls) to track unknown tool call rates by provider/modelBefore
After
The existing error flow is preserved —
ErrorDatawithRESOURCE_NOT_FOUNDcode is returned and serialized as a tool response to the model, allowing it to retry with a valid tool name.Changed files
crates/goose/src/agents/extension_manager.rs— Enhancedresolve_tool()error path with available tool list and telemetryTest plan
test_dispatch_tool_calltest continues to pass (error code unchanged)🤖 Generated with Claude Code