fix(agent): recover unknown tool calls before they abort the turn - #273
Open
PsiACE wants to merge 2 commits into
Open
fix(agent): recover unknown tool calls before they abort the turn#273PsiACE wants to merge 2 commits into
PsiACE wants to merge 2 commits into
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bub | 5173100 | Commit Preview URL Branch Preview URL |
Aug 10 2026, 03:57 PM |
The model can emit a tool name outside the agent tool set. tool_invocation_from_native used to raise there, ending the turn before any hook could react. Now an unknown name resolves to a placeholder Tool and flows through ToolExecutor, where the builtin before_tool_call replaces it with a tool_result listing the available tools so the model can re-issue. after_tool_call still observes the outcome. No signature changes outside the new hooks.
PsiACE
force-pushed
the
fix/unknown-tool-recovery
branch
from
August 10, 2026 15:51
4cc6ca4 to
be8b31b
Compare
PsiACE
marked this pull request as ready for review
August 10, 2026 15:57
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.
Why
The model can call a tool that does not exist (a hallucinated name). The resolver used to raise there, so the whole turn stopped before any hook ran.
What
(name, arguments), no resolve or decision.ToolExecutor.execute_asynctakes(name, args)plus the available tools, builds the tool map, and routes each call through the hooks.before_tool_call, where the builtin impl replaces them with atool_resultlisting the available tools so the model can re-issue.after_tool_callstill observes.Unknown tool nameerror instead of crashing.Net effect: the model loop keeps running and the model corrects its own call.
Notes
ToolExecutor.execute_asyncchanged signature: pass(name, args)andtools=.