feat(agent): add opt-in ToolCall argument validation gate before dispatch (T31) #149
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 369 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.354
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #149"
general
weight: 0.35
yuluo-yx
Targets #134 (T31). First of the two PRs announced in the claim comment.
What
Opt-in (
validateToolArguments, defaultfalse) validation of tool-call argumentsagainst the tool's declared input schema, in
AgentToolNode's baseHandler — afterresolve()and beforeexecuteToolByType(), so the single insertion point coverssync, async and
wrapSyncToolsAsAsyncdispatch.Because the interceptor chain and the dynamic resolver both run outside/before the
baseHandler, the gate always validates the final arguments against the final
schema — the acceptance item "interceptor 改写后/换 Schema 后校验最终执行版本" holds
by construction, with no extra re-validation logic.
Design notes
enum / numeric range /
additionalProperties: false/ null type handling) over therule set defined in the issue — zero new runtime dependencies (Jackson databind
is already on the classpath via argi-graph-core).
$refnodes are skipped ratherthan resolved, so remote references can never be fetched and recursion is bounded
by the finite schema document. If reviewers prefer wiring
com.networknt:json-schema-validator(already version-managed in the root pom)instead, the swap is local to
ToolArgumentValidator.ToolCallResponsewithstatus=errorand metadata carryingerrorCode+ safefieldPath; argument values are never echoed (asserted intests). Per the discussion in #134, no structured error protocol is introduced
here — that stays with T38.
SubAgentInterceptor, matching howwrapSyncToolsAsAsyncbehaves today.Scope vs. remaining (PR2)
Covered here: parse + schema rules above, sync/async paths, opt-in plumbing
(
Builder→DefaultBuilder→AgentToolNode).Left for PR2 per the issue: byte/depth/collection resource limits, local
$refexpansion, hardened sanitization tests.
Tests
ToolArgumentValidatorTest(16): every rule incl. nested paths ($.user.age),array indexes (
$.tags[1]), value-free failure messages, malformed schemafail-closed,
$refskip.ToolArgumentValidationGateTest(7): rejection before callback (invocation count= 0) with metadata assertions, illegal JSON, valid pass-through, default-off
legacy behavior, async path gating, and interceptor-rewrite validation (original
args valid → rewritten args rejected, proving post-rewrite validation).
argi-graph-core579 +argi-agent-framework754 tests,0 failures (three pre-existing Windows-only env failures in
FileSystemStoreTest/FilesystemInterceptorTest/FileSystemToolsTest are excluded and
reproduce identically on a clean
f3bcbefbaseline — symlink privileges / driverelativize, unrelated to this change).
existing files.