File tree Expand file tree Collapse file tree
nemo_gym/sandbox/providers/opensandbox Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -971,12 +971,9 @@ async def endpoint(
971971 if not endpoint_url :
972972 raise RuntimeError (f"OpenSandbox returned an empty endpoint for sandbox { handle .sandbox_id !r} port { port } " )
973973 if "://" not in endpoint_url :
974- domain = str (self ._connection .domain or "" )
975- # urlsplit("host.example:8080") treats the hostname as a scheme.
976- # Only read a scheme from a domain that actually contains ``://``;
977- # otherwise use ConnectionConfig.protocol just as the SDK does.
978- domain_scheme = urlsplit (domain ).scheme if "://" in domain else ""
979- scheme = domain_scheme or self ._connection .protocol or "http"
974+ # Use the SDK handle's effective configuration so environment-
975+ # resolved domains and protocols match the lifecycle request.
976+ scheme = urlsplit (handle .raw .connection_config .get_base_url ()).scheme or "http"
980977 endpoint_url = f"{ scheme } ://{ endpoint_url .lstrip ('/' )} "
981978 headers = dict (handle .raw .connection_config .headers )
982979 # Match the SDK's service adapters: connection-wide headers apply to
Original file line number Diff line number Diff line change @@ -286,6 +286,7 @@ async def test_pool_create_uses_sdk_compatibility_image_and_proxy_auth(
286286async def test_endpoint_normalizes_missing_scheme_and_merges_sdk_headers () -> None :
287287 class FakeRaw :
288288 connection_config = SimpleNamespace (
289+ get_base_url = lambda : "https://sandbox.example/v1" ,
289290 headers = {
290291 "OPEN-SANDBOX-API-KEY" : "pool-api-key" , # pragma: allowlist secret
291292 "X-Shared" : "connection" ,
@@ -325,18 +326,17 @@ async def get_endpoint(self, port: int) -> Any:
325326 }
326327
327328
328- async def test_endpoint_uses_configured_protocol_for_domain_without_scheme () -> None :
329+ async def test_endpoint_uses_effective_sdk_scheme_when_provider_input_is_unset () -> None :
329330 class FakeRaw :
330- connection_config = SimpleNamespace (headers = {})
331+ connection_config = SimpleNamespace (
332+ get_base_url = lambda : "https://gateway.example/v1" ,
333+ headers = {},
334+ )
331335
332336 async def get_endpoint (self , _port : int ) -> Any :
333337 return SimpleNamespace (endpoint = "sandbox.example:5000" , headers = {})
334338
335339 provider = opensandbox_provider .OpenSandboxProvider (
336- connection = {
337- "domain" : "gateway.example:8080/" ,
338- "protocol" : "https" ,
339- },
340340 operations = {"retries" : 0 },
341341 probe = {"command" : None },
342342 )
You can’t perform that action at this time.
0 commit comments