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.
Currently if an unknown tool name is provided by the model, a
ModelRetry(f'Unknown tool name: {name!r}. {msg}')is raised and subsequently it will move to the retry step here. In this step, however, themax_retrieswill always be 1 because the tool name is unknown (i.e.tool is None). This causes theUnexpectedModelBehavior(f'Tool {name!r} exceeded max retries count of {max_retries}')to be raised, thus stopping the run.It would be nice if there was retry logic on unknown tools, so that the model can correct itself if it accidentally returns a malformed tool name (I've seen this happen, for example, with
gpt-oss-20b).This PR adds an
unknown_tool_retriesparameter for this purpose.