GeezerVison is showing github.com — fix(google): comprehensively eliminate Antigravity request-shape 400s by HaydernCenterpoint · Pull Request #309 · lidge-jun/opencodex
Conversation
Summary
This introduces a single conservative wire compiler for every Google-family request and comprehensively fixes the known Antigravity 400 invalid request class caused by request-shape incompatibilities.
- Compile AI Studio, Vertex, and Cloud Code Assist payloads through one final trust boundary before serialization.
- Normalize arbitrary MCP / JSON Schema input into Google's supported function-schema subset, including
x-mcp-header, draft 2020-12 annotations, nullable anyOf, local refs, hostile values, and recursion limits.
- Clamp unsupported Antigravity thinking levels (
xhigh, max, ultra) to Google's highest accepted high value.
- Normalize invalid, long, or colliding tool names and restore the original name when the model calls the tool.
- On a provider schema/thinking
400, rebuild a materially changed request and replay it exactly once; unrelated 400 responses remain non-retryable.
Root cause
Google request compatibility was previously enforced incrementally while building the payload. There was no final compiler guaranteeing wire invariants, so one provider-specific field or one third-party MCP schema could invalidate the entire tool catalog. The transport also treated every 400 as terminal even when the provider identified a safely repairable schema or thinking field.
Why this is comprehensive for Antigravity request-shape failures
The strict allowlist prevents unknown third-party schema keywords from reaching Antigravity, while the final compiler also covers generation config and tool-name constraints. If the Claude bridge still rejects a documented construct, the targeted open-schema fallback repairs the named tool and replays once. This closes the observed thinking_level=max, x-mcp-header, Serena nullable-union, and generic tools.N.custom.input_schema failure modes without depending on Serena or any specific MCP server.
This scope intentionally does not claim to suppress authentication, quota, permission, network, or upstream availability failures; those are separate provider conditions rather than malformed-request bugs.
Impact
- A single malformed MCP tool can no longer poison every tool in the request.
- Users without Serena are unaffected; all MCP catalogs receive the same provider-boundary normalization.
- Other providers are unchanged.
- No new dependency is added.
Validation
bun run typecheck
- 128 Google / Vertex / Antigravity tests passed across 10 files.
- Full local suite: 3453 passed, 4 skipped; the only 2 failures are the existing Windows Cursor
printf fixtures.
- Live isolated-dev E2E against Antigravity: 112 tools (22 Serena, 7 Yith, 20 adversarial schemas), with global
tools.64 = serena_replace_in_files, returned HTTP 200 and OK..
git diff --check
References:
Summary by CodeRabbit
-
New Features
- Improved compatibility with Google and Gemini request formats.
- Automatically retries certain invalid requests after safely repairing unsupported tool schemas or thinking settings.
- Preserves tool names across requests and responses, including names requiring compatibility formatting.
- Normalizes reasoning effort values to supported provider settings.
-
Bug Fixes
- Improved handling of unsupported and complex tool parameter schemas.
- Prevented invalid schema fields from being sent to Google services.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
coderabbitai
Bot
commented
Jul 23, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 49768f9a-c900-47cf-a9d9-450715c8c64c
📥 Commits
Reviewing files that changed from the base of the PR and between 54e0bbf and f1fdb82.
📒 Files selected for processing (9)
src/adapters/google-http.ts
src/adapters/google-tool-schema.ts
src/adapters/google-wire-compiler.ts
src/adapters/google.ts
src/providers/antigravity-models.ts
tests/google-antigravity-wire.test.ts
tests/google-tool-schema.test.ts
tests/google-vertex-http.test.ts
tests/google-wire-compiler.test.ts
📝 Walkthrough
Walkthrough
Changes
Google wire compatibility
| Layer / File(s) |
Summary |
Allowlisted tool schema sanitization src/adapters/google-tool-schema.ts, tests/google-tool-schema.test.ts |
Tool schemas now use bounded local $ref resolution, normalized types, controlled anyOf handling, recursive keyword filtering, and an object-root fallback. |
Wire request compilation and tool-name restoration src/adapters/google-wire-compiler.ts, src/adapters/google.ts, tests/google-wire-compiler.test.ts |
Requests are compiled into Google wire format, tool names are encoded for transport and restored in parsed tool-call events, and compiled bodies are used across Google modes. |
Invalid-request repair and compatibility replay src/adapters/google-wire-compiler.ts, src/adapters/google-http.ts, tests/google-vertex-http.test.ts, tests/google-wire-compiler.test.ts |
Selected schema and thinking-level 400 responses trigger one repaired request replay while preserving retry accounting. |
Antigravity thinking-level normalization src/providers/antigravity-models.ts, tests/google-antigravity-wire.test.ts |
Claude effort values are mapped to supported CCA thinking levels, including clamping max and ultra to high. |
Estimated code review effort: 4 (Complex) | ~45 minutes
Sequence Diagram(s)
sequenceDiagram
participant GoogleAdapter
participant WireCompiler
participant RetryFetcher
participant GoogleAPI
GoogleAdapter->>WireCompiler: compile request and tool schemas
WireCompiler-->>GoogleAdapter: wire body and name restoration
GoogleAdapter->>RetryFetcher: send compiled request
RetryFetcher->>GoogleAPI: request
GoogleAPI-->>RetryFetcher: 400 INVALID_ARGUMENT
RetryFetcher->>WireCompiler: repair request body
WireCompiler-->>RetryFetcher: repaired body
RetryFetcher->>GoogleAPI: one compatibility replay
GoogleAPI-->>GoogleAdapter: response with wire tool name
GoogleAdapter->>GoogleAdapter: restore original tool name
Loading
Suggested reviewers: ingwannu, lidge-jun
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
⚠️ Warning |
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name |
Status |
Explanation |
| Description Check |
✅ Passed |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
✅ Passed |
The title accurately captures the main change: Google/Antigravity request-shape handling to avoid 400 responses. |
| Linked Issues check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed against current dev. The wire compiler is a bounded allowlist rather than a permissive pass-through; tool-name encoding is deterministic and reversible per request, schema refs are local and depth-limited, and the compatibility replay is limited to one changed request after a matching 400. The adapter is instantiated per request, so the restore-name closure is not shared across concurrent turns. Focused Google tests passed in the combined stack, and the full pre-push suite passed 3,667 / 0 with typecheck and privacy scan. Approved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 3, 2026
This was referenced Aug 15, 2026
agentHits
pushed a commit
to agentHits/opencodex
that referenced
this pull request
Sep 17, 2026
…ism + Vertex allowlist overreach) — NEEDS_HUMAN, not merged
agentHits
pushed a commit
to agentHits/opencodex
that referenced
this pull request
Sep 17, 2026
…-wire-compatibility
fix(google): comprehensively eliminate Antigravity request-shape 400s
Reviewers
Ingwannu
Ingwannu approved these changes
lidge-jun
Awaiting requested review from lidge-jun
lidge-jun is a code owner
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|