[Agent] Surface tool-argument resolution failures to the LLM - #2365
Merged
chr-hertel merged 1 commit intoSep 22, 2026
Merged
chr-hertel merged 1 commit into
chr-hertel merged 1 commit into
Conversation
Berenger
force-pushed
the
fix/2137-surface-tool-argument-resolution-errors
branch
from
July 25, 2026 14:10
ae3ccf1 to
0e7cd15
Compare
chr-hertel
force-pushed
the
fix/2137-surface-tool-argument-resolution-errors
branch
from
September 22, 2026 22:22
0e7cd15 to
afbe754
Compare
chr-hertel
force-pushed
the
fix/2137-surface-tool-argument-resolution-errors
branch
from
September 22, 2026 22:28
afbe754 to
e50342b
Compare
chr-hertel
approved these changes
Sep 22, 2026
chr-hertel
left a comment
Member
There was a problem hiding this comment.
Sorry for the delay @Berenger - somehow this slipped. I took care about the update and an UPGRADE.md note.
chr-hertel
force-pushed
the
fix/2137-surface-tool-argument-resolution-errors
branch
from
September 22, 2026 22:31
e50342b to
d06678a
Compare
Member
|
Thank you @Berenger. |
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.
Problem
When
ToolCallArgumentResolver::resolveArguments()fails because of invalid LLM-generated tool-call input—such as a missing mandatory parameter or a value that cannot be denormalized (for example, an invalid backed-enum value)—the exception is caught by the generic\Throwablearm inToolbox::execute().It is then wrapped in a
ToolExecutionException, whosegetToolCallResult()only returns:As a result,
FaultTolerantToolboxrelays no actionable feedback to the model. The model cannot self-correct and typically repeats the same invalid call.Solution
This PR treats argument-resolution failures as agent-correctable errors by reusing the existing
InvalidToolCallArgumentsException.This exception implements
ToolExecutionExceptionInterface, allowing its message to reach the LLM as the tool result. This is the same mechanism already used byValidateToolCallArgumentsListener.A missing mandatory parameter now throws
InvalidToolCallArgumentsExceptionwith the existing message:A denormalization failure is caught and rethrown as
InvalidToolCallArgumentsException:The original Serializer exception is preserved as the previous exception for debugging and logging purposes, but is not exposed directly to the LLM.
These messages are derived from the model's input and the tool's argument metadata. Exceptions raised during tool execution remain hidden and continue to produce the generic error message.
Compatibility
Code catching the component's
ExceptionInterfaceremains unaffected, since both the old and new exceptions implement it.Consumers catching the concrete
ToolExecutionExceptionmay need to handleInvalidToolCallArgumentsExceptionas well.Technical Note
Toolbox::execute()now initializes$argumentsbefore entering thetryblock, ensuring that it is safely available to the catch arms, as reported by PHPStan.Tests
This behavior is covered by:
ToolboxandFaultTolerantToolbox.