fix(antigravity): wrap cross-format requests in the v1internal envelope

The gemini:generate_content URL hook rewrites any Antigravity endpoint to
/v1internal:generateContent, but only the same-format passthrough and the two
OpenAI decision paths ever built the matching envelope. A Claude Messages or
Gemini client therefore reached the standard family planner, picked up the
rewritten URL, and posted a bare Gemini body that upstream rejects with
"Invalid JSON payload received. Unknown name \"contents\"" -- four retries
across every account, then a 503 that names none of this.

Route the standard family through the shared v1internal builder the same way
gemini_cli already is, so the URL and the body come from one decision. The
OpenAI-image-to-Gemini path cannot carry an envelope at all, so it now skips
Antigravity candidates instead of sending a request upstream can only reject.

Also stop treating a configured proxy as locally unsupported. The execution
plan carries the proxy itself, and the generic and Vertex gates moved to
transport_proxy_is_locally_supported long ago; Antigravity kept rejecting on
proxy.is_some(), which no longer matches how the local runtime executes. A
proxy that resolves to no route still disqualifies the request, and transport
profiles stay unsupported because the v1internal payload never carries one.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
stabey
2026-09-04 22:53:09 +08:00
co-authored by Claude Opus 5
parent 27b0381a9a
commit a6dc43d5f6
4 changed files with 351 additions and 5 deletions
@@ -2893,6 +2893,22 @@ fn ai_serving_standard_attempts_consume_eligible_local_candidates_without_transp
);
}
let standard_family_request = read_workspace_file(
"apps/aether-gateway/src/ai_serving/planner/standard/family/request.rs",
);
for pattern in [
"is_antigravity_provider_transport(",
"build_antigravity_v1internal_provider_request(",
"is_gemini_cli_provider_transport(",
"build_gemini_cli_v1internal_provider_request(",
] {
assert!(
standard_family_request.contains(pattern),
"standard family request preparation should build v1internal envelopes through {pattern} \
so a cross-format client never posts a bare Gemini body to a v1internal URL"
);
}
let provider_transport_standard =
read_workspace_file("crates/aether-provider/transport/src/standard/mod.rs");
for pattern in [