Skip to content

fix(antigravity): allow cloudcode envelope through messages guard#7582

Open
dongwook-chan wants to merge 1 commit into
diegosouzapw:release/v3.8.49from
dongwook-chan:fix/antigravity-cloudcode-envelope-guard
Open

fix(antigravity): allow cloudcode envelope through messages guard#7582
dongwook-chan wants to merge 1 commit into
diegosouzapw:release/v3.8.49from
dongwook-chan:fix/antigravity-cloudcode-envelope-guard

Conversation

@dongwook-chan

Copy link
Copy Markdown

Summary

Closes #7581.

This fixes two Antigravity MITM routing problems:

  • /v1/antigravity cloudcode envelopes no longer get rejected by the OpenAI top-level messages guard. Antigravity requests carry turns under request.contents, so missing top-level messages is valid for this endpoint.
  • Standalone MITM routing now prefers the client-facing mitmRouteAlias.antigravity namespace and only falls back to mitmAlias.antigravity, keeping MITM model routing separate from executor upstream-id cleanup while preserving compatibility.

Verification

Ran targeted regression tests:

node --import tsx/esm --test tests/unit/chat-messages-validation-6402.test.ts tests/unit/mitm-server-antigravity-route-alias.test.ts tests/unit/antigravity-format-detection.test.ts tests/unit/antigravity-mitm-model-resolution.test.ts

Result: 31/31 tests passed.

The Antigravity cloudcode regression loop covers the Gemini-family model set derived from ANTIGRAVITY_PUBLIC_MODELS, AGY_PUBLIC_MODELS, and ANTIGRAVITY_MODEL_ALIASES/values. It currently verifies 21 model IDs, including gemini-3.5-flash-low, gemini-3.5-flash-medium, gemini-3.5-flash-high, gemini-3.1-pro-high, gemini-3.1-pro-low, gemini-pro-agent, and rev19-uic3-1p, and asserts they route through the Antigravity executor without returning the missing-messages 400.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for the mitmRouteAlias namespace in src/mitm/server.cjs to separate client-facing OmniRoute model IDs from mitmAlias, prioritizing it during model mapping. Additionally, it updates src/sse/handlers/chat.ts to identify Antigravity requests by path and bypass the early validation guard requiring messages or input fields, as Antigravity requests utilize a cloudcode request envelope. Corresponding unit tests have been added to validate the routing behavior and the alias resolution order. No review comments were provided, so there is no feedback to address.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks for tracking down the cloudcode-envelope guard bug — the chat.ts fix (bypassing the OpenAI messages requirement for /v1/antigravity) is correct and well-tested; I verified it applies cleanly to the current release/v3.8.49 tip and passes 26/26 in isolation.

The src/mitm/server.cjs half has drifted, though: getMappedModel() was renamed to getMappedOverride() on the release tip as part of the Antigravity reasoning-effort override feature (returns {model, reasoningEffort} via aliasConfigShim.normalizeAliasMappings(), not a plain string). Your getMappingFromSqlite/getMappingFromJson split needs to be re-applied on top of that shape rather than the old one — could you rebase onto release/v3.8.49 and reconcile there? Happy to help if useful. Also worth noting mitmRouteAlias isn't written anywhere yet in the codebase, so that half is prep for a future writer, not an active behavior change today — that's fine, just flagging so it's not mistaken for a live fix.

@dongwook-chan

dongwook-chan commented Jul 18, 2026

Copy link
Copy Markdown
Author

Rebased onto the current release/v3.8.49 tip and reconciled the MITM alias lookup with the newer normalized override shape. Follow-up update: I also replaced the source-regex alias regression with behavior tests against the extracted route-alias resolver.\n\n- Kept getMappedOverride() returning { model?, reasoningEffort? } via aliasConfigShim.normalizeAliasMappings().\n- Added mitmRouteAlias as the first lookup namespace, with mitmAlias as the compatibility fallback.\n- Preserved applyAntigravityOverride() and reasoning-effort propagation through intercept().\n- Extracted route-alias resolution into src/mitm/_internal/routeAlias.cjs so SQLite and legacy JSON behavior are tested directly instead of asserted via source regex.\n- Confirmed mitmRouteAlias is currently preparatory because there is no writer yet.\n\nValidation:\n- node --check src/mitm/server.cjs\n- node --check src/mitm/_internal/routeAlias.cjs\n- node --import tsx/esm --test tests/unit/mitm-server-antigravity-route-alias.test.ts tests/unit/mitm-alias-config-shim.test.ts tests/unit/mitm-antigravity-reasoning-effort-override.test.ts tests/unit/chat-messages-validation-6402.test.ts\n- Result: 50/50 tests passed\n- git diff --check passed\n\nCurrent PR state: mergeable, Semgrep passed.

@dongwook-chan
dongwook-chan force-pushed the fix/antigravity-cloudcode-envelope-guard branch from 7c16f71 to aa39a6f Compare July 18, 2026 05:22
@dongwook-chan
dongwook-chan force-pushed the fix/antigravity-cloudcode-envelope-guard branch from 5a5c413 to c57e07a Compare July 18, 2026 09:22
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.

fix(api): Antigravity MITM cloudcode requests are rejected by OpenAI messages guard

2 participants