Repository navigation
fix(translator): do not treat a properties map as a schema node - #12931
killer30001000 wants to merge 5 commits into
Conversation
Vertex AI rejects tool schemas when Phase 7 of cleanJSONSchemaForAntigravity() mistakes a properties map for a schema node and injects a synthetic type entry. A tool that legitimately declares a parameter named `properties` triggers this path, producing an invalid ninth parameters.properties value (`"object"`). Make injectObjectType() schema-map aware: descend into values of a `properties` map without processing the map itself as a schema node. Add a focused regression reproducing the Vertex failure and guard other keyword-named parameters.
35a19f2 to
4b722c6
Compare
|
Thanks for tracking this down against a real Vertex failure — the reproduction Since we can't ship both diffs against the same lines, I'm recommending #13690 Triage note: this is the review recommendation — the close itself happens only after the maintainer's per-PR sign-off (and, where a superseding PR is named, after it has landed). Nothing is being closed by this comment. |
|
Sounds great! |
Vertex AI rejects tool schemas when Phase 7 of
cleanJSONSchemaForAntigravity()mistakes apropertiesmap for a schema node and injects a synthetictypeentry. A tool that legitimately declares a parameter namedpropertiestriggers this path, producing an invalid ninthparameters.propertiesvalue ("object").Make
injectObjectType()schema-map aware: descend into values of apropertiesmap without processing the map itself as a schema node. Add a focused regression reproducing the Vertex failure and guard other keyword-named parameters.Summary
properties.injectObjectType) from treating thepropertiesmap container itself as a schema node.The failure reproduced as:
The synthetic ninth entry was created because the visitor recursively processed the property map itself. Since that map contained a user-defined key named
properties,record.properties !== undefinedincorrectly matched and causedtype: "object"to be inserted into the map.Related Issues
Validation
npm run lintValidation performed for the patch:
The branch was subsequently rebuilt directly on the current
release/v3.8.51tip. The resulting diff is one commit touching only the translator helper and the new regression test.The same translator fix was also validated manually in a Docker build against the original Vertex request: the previously failing Combo/tool request succeeds.
Tests Added Or Updated
tests/unit/gemini-schema-properties-named-property.test.tsThe regression test verifies that:
propertiesdoes not cause a synthetictypeentry to be inserted into the surrounding property map;type: "object";propertiesparameter remains an array with a valid objectitemsschema;additionalPropertiessanitization continues to work;required,items,type, anddescriptionremain valid user-defined property names.Coverage Notes
tests/unit/gemini-schema-properties-named-property.test.tsdirectly exercises the changed Phase 7 behavior inopen-sse/translator/helpers/geminiHelper.tsand reproduces the schema shape responsible for the Vertex 400.No existing assertions or schema sanitization behavior were weakened.
Reviewer Notes
The root cause is traversal context, not
additionalProperties.propertiesis a map from user-defined property names to subschemas. The fix therefore descends into the map's values without processing the map container itself as a schema node, matching the traversal pattern already used byremoveUnsupportedKeywords().There are no migrations, feature flags, API changes, provider-specific hardcodes, or tool-specific workarounds.