Repository navigation
Tell the model a pinned hook argument is fixed for every allowed method - #74380
Merged
Merged
Conversation
vatsrahul1001
approved these changes
Oct 7, 2026
Contributor
There was a problem hiding this comment.
LGTM, Static checks failure not related to this PR. I have a fix for it #74390
Lee-W
approved these changes
Oct 7, 2026
Member
|
should be fine to merge it after resolving conflict |
When the model supplied a pinned argument to a HookToolset method with named parameters, such as S3Hook.read_key, argument validation rejected it first with a generic "Extra inputs are not permitted" error, and the toolset's own "is fixed for this tool" message only ever reached methods that also take **kwargs. The toolset now validates against a schema that still accepts the pinned names, so every refusal tells the model the argument is fixed. The model is still shown the schema without them.
The refusal ran in execute_tool, after an approval gate had already asked a person to approve the call with the pinned argument in it. It now runs as the tool's args_validator_func, so the call is refused before any gate or the hook sees it; execute_tool keeps the check for the framework bridges, which validate arguments without that hook. The validator schema now adds the pinned names back as untyped optional properties instead of re-deriving the required list, so a pinned argument sent with the wrong type is also told it is fixed.
kaxil
force-pushed
the
hook-pinned-argument-message
branch
from
October 7, 2026 11:55
09db935 to
eaa6639
Compare
This was referenced Oct 8, 2026
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.
Stacked on #74379. Until that merges, this diff also shows its commit; the changes here are the last two commits.
HookToolset(pinned_arguments=...)leaves a pinned argument out of the schema the model sees, and refuses it if the model sends it anyway. The refusal is meant to tell the model the argument is fixed, but that only happened for methods that also take**kwargs. For an ordinary method with named parameters, such asS3Hook.read_key, the validator was built from the trimmed schema, so it rejected the pinned name first. The model got a generic pydantic error instead:The refusal also ran late, in
execute_tool. A toolset wrapped in.approval_required()therefore asked a person to approve the call withbucket_name='acme-payroll'in it, and only refused it after approval.Now the validator's schema adds the pinned names back as untyped optional properties, and the refusal runs as the tool's
args_validator_func, during validation. Whatever the method's signature or the value's type, the model getsbucket_name is fixed for this tool: call it again without it., and an approval gate never sees the call.execute_toolkeeps the same check for the framework bridges (LangChain, Strands, ADK), which validate arguments withoutargs_validator_func.args_validator_funcis present at the provider'spydantic-ai-slimfloor, 2.33.0.What the model is shown is unchanged, and the pinned value is still the one passed to the hook.
There are two regression tests, and each fails without the change:
.approval_required()and checks that the approval request contains only the corrected call.The hook guide's pinned-argument paragraph and the captured refusal are updated. The capture was re-run with the example Dag going through
AgentOperator.