fix(translator): keep a tool property named 'pattern' through Gemini schema sanitization - #4339
Merged
diegosouzapw merged 2 commits intoJun 20, 2026
Conversation
…schema sanitization (port from 9router#1368) The Gemini/Antigravity schema sanitizer strips JSON-Schema constraint keywords Gemini rejects (pattern, minLength, ...) at every nesting level, but it also deleted any tool property literally NAMED one of those keywords. glob/grep tools declare a property called `pattern`, so on ag/* backends that argument (and its `required` entry) was silently dropped, breaking the tools. Keyword stripping is now position-aware: constraint keywords are only removed at the schema-node level, never against the user-defined names inside a `properties` map. A genuine string-level `pattern` constraint is still stripped. Reported-by: youthanh (decolua/9router#1368) Co-authored-by: youthanh <74104625+youthanh@users.noreply.github.com>
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Merged
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
…schema sanitization (diegosouzapw#4339) The Gemini/Antigravity schema sanitizer strips JSON-Schema constraint keywords Gemini rejects (pattern, minLength, ...) at every nesting level, but it also deleted any tool property literally NAMED one of those keywords. glob/grep tools declare a property called `pattern`, so on ag/* backends that argument (and its `required` entry) was silently dropped, breaking the tools. Keyword stripping is now position-aware: constraint keywords are only removed at the schema-node level, never against the user-defined names inside a `properties` map. A genuine string-level `pattern` constraint is still stripped. Reported-by: youthanh (decolua/9router#1368) Co-authored-by: youthanh <74104625+youthanh@users.noreply.github.com>
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.
Summary
pattern,minLength, …) recursively, but it also deleted any tool property literally named one of those keywords.pattern, so onag/*(Antigravity) backends that property — and itsrequiredentry — was silently dropped, leaving the tool with an incomplete schema.Root cause
removeUnsupportedKeywords(open-sse/translator/helpers/geminiHelper.ts) deleted any key inGEMINI_UNSUPPORTED_SCHEMA_KEYSat every nesting level, including inside apropertiesmap whose keys are arbitrary, user-defined property names.cleanupRequiredthen dropped the now-missingpatternfromrequired.Fix
Make keyword stripping position-aware: only remove constraint keywords at the schema-node level, and when descending into a
propertiesmap, recurse into each property's subschema without running keyword-deletion against the property names. A genuine string-levelpatternconstraint is still stripped.Test plan
tests/unit/translator-gemini-schema-pattern-property.test.ts(property-named-patternsurvives; constraint-patternstill stripped) — failing before, passing after.gemini-helper+agy-gemini-400+ enum + translator-helper-branches + antigravity-format-detection suites green (43 tests)npm run typecheck:core, eslint on changed files — cleanAttribution
Thanks to @youthanh for the original report.