Skip to content

fix(translator): keep a tool property named 'pattern' through Gemini schema sanitization - #4339

Merged
diegosouzapw merged 2 commits into
release/v3.8.30from
fix/port-issue-1368-gemini-pattern-property
Jun 20, 2026
Merged

diegosouzapw merged 2 commits into
release/v3.8.30from
fix/port-issue-1368-gemini-pattern-property

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Summary

  • The Gemini/Antigravity tool-schema sanitizer strips JSON-Schema constraint keywords Gemini rejects (pattern, minLength, …) recursively, but it also deleted any tool property literally named one of those keywords.
  • glob/grep tools declare a property called pattern, so on ag/* (Antigravity) backends that property — and its required entry — was silently dropped, leaving the tool with an incomplete schema.

Root cause

removeUnsupportedKeywords (open-sse/translator/helpers/geminiHelper.ts) deleted any key in GEMINI_UNSUPPORTED_SCHEMA_KEYS at every nesting level, including inside a properties map whose keys are arbitrary, user-defined property names. cleanupRequired then dropped the now-missing pattern from required.

Fix

Make keyword stripping position-aware: only remove constraint keywords at the schema-node level, and when descending into a properties map, recurse into each property's subschema without running keyword-deletion against the property names. A genuine string-level pattern constraint is still stripped.

Test plan

  • New regression test tests/unit/translator-gemini-schema-pattern-property.test.ts (property-named-pattern survives; constraint-pattern still 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 — clean

Attribution

Thanks to @youthanh for the original report.

…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>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw merged commit 70a3330 into release/v3.8.30 Jun 20, 2026
@diegosouzapw diegosouzapw mentioned this pull request Jun 20, 2026
@diegosouzapw
diegosouzapw deleted the fix/port-issue-1368-gemini-pattern-property branch June 20, 2026 19:27
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant