diff --git a/apps/aether-gateway/src/ai_serving/planner/standard/openai/chat/decision/request.rs b/apps/aether-gateway/src/ai_serving/planner/standard/openai/chat/decision/request.rs index 4bfa07dea..ce719f126 100644 --- a/apps/aether-gateway/src/ai_serving/planner/standard/openai/chat/decision/request.rs +++ b/apps/aether-gateway/src/ai_serving/planner/standard/openai/chat/decision/request.rs @@ -2763,7 +2763,7 @@ mod tests { payload.provider_request_body["userAgent"], "vscode/1.X.X (Antigravity/4.3.0)" ); - assert_eq!(payload.provider_request_body["requestType"], "agent"); + assert!(payload.provider_request_body.get("requestType").is_none()); assert!(payload.provider_request_body.get("contents").is_none()); assert!(payload.provider_request_body["request"] .get("contents") diff --git a/apps/aether-gateway/src/tests/ai_execute/finalize_local.rs b/apps/aether-gateway/src/tests/ai_execute/finalize_local.rs index 3bac90c5d..dd8c0350a 100644 --- a/apps/aether-gateway/src/tests/ai_execute/finalize_local.rs +++ b/apps/aether-gateway/src/tests/ai_execute/finalize_local.rs @@ -1972,7 +1972,7 @@ async fn gateway_executes_openai_chat_antigravity_cross_format_sync_via_local_fi seen_execution_runtime_request.user_agent, aether_provider_transport::antigravity::ANTIGRAVITY_REQUEST_USER_AGENT ); - assert_eq!(seen_execution_runtime_request.request_type, "agent"); + assert_eq!(seen_execution_runtime_request.request_type, ""); assert_eq!(seen_execution_runtime_request.contents_len, 1); assert!(!seen_execution_runtime_request.request_has_model); diff --git a/apps/aether-gateway/src/tests/ai_execute/finalize_local_cli/cross_format.rs b/apps/aether-gateway/src/tests/ai_execute/finalize_local_cli/cross_format.rs index 0cedf3111..f199ee5f3 100644 --- a/apps/aether-gateway/src/tests/ai_execute/finalize_local_cli/cross_format.rs +++ b/apps/aether-gateway/src/tests/ai_execute/finalize_local_cli/cross_format.rs @@ -1570,7 +1570,7 @@ async fn gateway_executes_openai_responses_antigravity_cross_format_upstream_str seen_remote_execution_runtime_request.user_agent, aether_provider_transport::antigravity::ANTIGRAVITY_REQUEST_USER_AGENT ); - assert_eq!(seen_remote_execution_runtime_request.request_type, "agent"); + assert_eq!(seen_remote_execution_runtime_request.request_type, ""); assert_eq!(seen_remote_execution_runtime_request.contents_len, 1); assert!(!seen_remote_execution_runtime_request.request_has_model); diff --git a/apps/aether-gateway/src/tests/ai_execute/finalize_local_provider/gemini.rs b/apps/aether-gateway/src/tests/ai_execute/finalize_local_provider/gemini.rs index 7c3575c2f..6a84c0e24 100644 --- a/apps/aether-gateway/src/tests/ai_execute/finalize_local_provider/gemini.rs +++ b/apps/aether-gateway/src/tests/ai_execute/finalize_local_provider/gemini.rs @@ -2155,7 +2155,7 @@ async fn gateway_executes_antigravity_gemini_cli_sync_upstream_stream_via_local_ seen_remote_execution_runtime_request.user_agent, aether_provider_transport::antigravity::ANTIGRAVITY_REQUEST_USER_AGENT ); - assert_eq!(seen_remote_execution_runtime_request.request_type, "agent"); + assert_eq!(seen_remote_execution_runtime_request.request_type, ""); assert_eq!(seen_remote_execution_runtime_request.contents_len, 0); assert!((seen_remote_execution_runtime_request.exact_temperature - 0.2).abs() < f64::EPSILON); assert!(!seen_remote_execution_runtime_request.request_has_model); diff --git a/apps/aether-gateway/src/tests/ai_execute/stream_provider_gemini/local_cli.rs b/apps/aether-gateway/src/tests/ai_execute/stream_provider_gemini/local_cli.rs index 5c5d26cd0..603ba0d64 100644 --- a/apps/aether-gateway/src/tests/ai_execute/stream_provider_gemini/local_cli.rs +++ b/apps/aether-gateway/src/tests/ai_execute/stream_provider_gemini/local_cli.rs @@ -2060,7 +2060,7 @@ async fn gateway_executes_antigravity_gemini_cli_stream_via_local_decision_gate_ seen_execution_runtime_request.user_agent, aether_provider_transport::antigravity::ANTIGRAVITY_REQUEST_USER_AGENT ); - assert_eq!(seen_execution_runtime_request.request_type, "agent"); + assert_eq!(seen_execution_runtime_request.request_type, ""); assert_eq!(seen_execution_runtime_request.contents_len, 0); assert!((seen_execution_runtime_request.exact_temperature - 0.2).abs() < f64::EPSILON); assert!(!seen_execution_runtime_request.request_has_model); diff --git a/apps/aether-gateway/src/tests/ai_execute/sync/gemini/cli.rs b/apps/aether-gateway/src/tests/ai_execute/sync/gemini/cli.rs index 8abd3a094..bf491eef1 100644 --- a/apps/aether-gateway/src/tests/ai_execute/sync/gemini/cli.rs +++ b/apps/aether-gateway/src/tests/ai_execute/sync/gemini/cli.rs @@ -2374,7 +2374,7 @@ async fn gateway_executes_antigravity_gemini_cli_sync_via_local_decision_gate_af seen_execution_runtime_request.user_agent, aether_provider_transport::antigravity::ANTIGRAVITY_REQUEST_USER_AGENT ); - assert_eq!(seen_execution_runtime_request.request_type, "agent"); + assert_eq!(seen_execution_runtime_request.request_type, ""); assert_eq!(seen_execution_runtime_request.contents_len, 0); assert!((seen_execution_runtime_request.exact_temperature - 0.2).abs() < f64::EPSILON); assert!(!seen_execution_runtime_request.request_has_model); diff --git a/crates/aether-provider/transport/src/antigravity/request.rs b/crates/aether-provider/transport/src/antigravity/request.rs index b0ddc5b9b..c25a1cb97 100644 --- a/crates/aether-provider/transport/src/antigravity/request.rs +++ b/crates/aether-provider/transport/src/antigravity/request.rs @@ -83,17 +83,21 @@ pub fn build_antigravity_safe_v1internal_request( let request_id = non_empty_string_field(source, "requestId").unwrap_or(request_id); let user_agent = non_empty_string_field(source, "userAgent").unwrap_or(ANTIGRAVITY_REQUEST_USER_AGENT); - let request_type = - existing_v1internal_request_type(source).unwrap_or_else(|| request_type.as_str()); + let existing_request_type = existing_v1internal_request_type(source); - return AntigravityRequestEnvelopeSupport::Supported(serde_json::json!({ + let mut envelope = serde_json::json!({ "project": auth.project_id, "requestId": request_id, "request": Value::Object(inner_request), "model": model, "userAgent": user_agent, - "requestType": request_type, - })); + }); + if let Some(existing_request_type) = existing_request_type { + envelope["requestType"] = Value::String(existing_request_type.to_string()); + } else if request_type != AntigravityEnvelopeRequestType::Agent { + envelope["requestType"] = Value::String(request_type.as_str().to_string()); + } + return AntigravityRequestEnvelopeSupport::Supported(envelope); } let mut inner_request: Map = source.clone(); @@ -103,14 +107,17 @@ pub fn build_antigravity_safe_v1internal_request( normalize_antigravity_builtin_tool_names(&mut inner_request); normalize_antigravity_function_declaration_parameters(&mut inner_request); - AntigravityRequestEnvelopeSupport::Supported(serde_json::json!({ + let mut envelope = serde_json::json!({ "project": auth.project_id, "requestId": request_id, "request": Value::Object(inner_request), "model": model, "userAgent": ANTIGRAVITY_REQUEST_USER_AGENT, - "requestType": request_type.as_str(), - })) + }); + if request_type != AntigravityEnvelopeRequestType::Agent { + envelope["requestType"] = Value::String(request_type.as_str().to_string()); + } + AntigravityRequestEnvelopeSupport::Supported(envelope) } /// Antigravity's private v1internal Gemini surface still uses the legacy @@ -298,7 +305,7 @@ mod tests { assert_eq!(envelope["requestId"], "request-ant-agent-123"); assert_eq!(envelope["model"], "gemini-3.5-flash-low"); assert_eq!(envelope["userAgent"], ANTIGRAVITY_REQUEST_USER_AGENT); - assert_eq!(envelope["requestType"], "agent"); + assert!(envelope.get("requestType").is_none()); assert!(envelope["request"].get("model").is_none()); assert!(envelope["request"].get("safetySettings").is_none()); assert_eq!(