fix(tool_call): sanitize invalid property names in function signatures #848
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.36) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 191 lines diff across 2 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.315
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #848"
general
weight: 0.35
andimarafioti
signature_from_schemabuilt Python function signatures directly from JSON Schema property names. JSON Schema allows arbitrary strings as property keys, butinspect.Parameterrequires valid, non-keyword identifiers. A schema containinguser-name,first name,class,from,123abc, etc. crashed the signature builder withValueError: '<name>' is not a valid parameter name. This is reachable from client input (session.update / request payloads) and crashes tool-calling setup before any text is emitted.Added
_sanitize_identifierthat:___2,_3, … for multiple properties that sanitize to the same nameUpdated
signature_from_schemato use sanitized names for the signature while preserving the original schema.Updated
function_call.pyto map between sanitized names (used by the model, from the prompt) and original names (used in the schema'spropertiesandrequired) during argument validation, so required-parameter checks and undeclared-argument filtering work correctly.RED: the new tests (
test_invalid_identifier_hyphen,test_invalid_identifier_space,test_python_keyword,test_starts_with_digit,test_collision_handling,test_empty_property_name) all failed on the original code withValueError: '<name>' is not a valid parameter name. GREEN: all 113 tests intests/tool_call/andtests/test_text_prompt.pypass.